Skip to content

Commit

Permalink
V1 of amber sinking based on height of mobs
Browse files Browse the repository at this point in the history
  • Loading branch information
KekeCreations committed May 6, 2024
1 parent 55d4eea commit f7858d7
Showing 1 changed file with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,34 @@ public void entityInside(BlockState pState, Level pLevel, BlockPos pPos, Entity
if (pEntity instanceof Player) {
pEntity.makeStuckInBlock(pState, new Vec3(0.8F, 0.1D, 0.8F));
} else if (pEntity instanceof Mob mob) {
mob.makeStuckInBlock(pState, new Vec3(0.0F, 0.1D, 0.0F));
if (mob.onGround()) {
amber.makeEntityStuck(mob);
if (mob.getBoundingBox().getYsize() < 1.5F) {
mob.makeStuckInBlock(pState, new Vec3(0F, 0.1D, 0F));
if (mob.onGround()) {
amber.makeEntityStuck(mob);
}
}
else if (mob.getBoundingBox().getYsize() < 2F) {
if (pLevel.getBlockState(new BlockPos(mob.getBlockX(), mob.getBlockY() + 1, mob.getBlockZ())).is(SMBlocks.AMBER.get())) {
mob.makeStuckInBlock(pState, new Vec3(0F, 0.1D, 0F));
if (mob.onGround()) {
amber.makeEntityStuck(mob);
}
} else {
mob.makeStuckInBlock(pState, new Vec3(0.8F, 0.1D, 0.8F));
}
}
else if (mob.getBoundingBox().getYsize() < 3.5F) {
if (pLevel.getBlockState(new BlockPos(mob.getBlockX(), mob.getBlockY() + 1, mob.getBlockZ())).is(SMBlocks.AMBER.get()) && pLevel.getBlockState(new BlockPos(mob.getBlockX(), mob.getBlockY() + 2, mob.getBlockZ())).is(SMBlocks.AMBER.get())) {
mob.makeStuckInBlock(pState, new Vec3(0F, 0.1D, 0F));
if (mob.onGround()) {
amber.makeEntityStuck(mob);
}
} else {
mob.makeStuckInBlock(pState, new Vec3(0.8F, 0.1D, 0.8F));
}
}
else {
mob.makeStuckInBlock(pState, new Vec3(0.8F, 0.1D, 0.8F));
}
}
if (pLevel.isClientSide) {
Expand Down

0 comments on commit f7858d7

Please sign in to comment.