Fixed muffin jankyness

This commit is contained in:
Sollace 2023-08-28 22:09:15 +01:00
parent c802e7aa56
commit 22bed1ee19
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -132,22 +132,16 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
@Override
protected void onBlockHit(BlockHitResult hit) {
BlockState state = getWorld().getBlockState(hit.getBlockPos());
BlockPos buttonPos = hit.getBlockPos().offset(hit.getSide());
BlockState state = getWorld().getBlockState(buttonPos);
BlockState posState = getBlockStateAtPos();
if (state.isIn(BlockTags.WOODEN_BUTTONS) && state.getBlock() instanceof ButtonBlock button) {
button.powerOn(state, getWorld(), hit.getBlockPos());
} else if (posState.isIn(BlockTags.WOODEN_BUTTONS) && posState.getBlock() instanceof ButtonBlock button) {
button.powerOn(posState, getWorld(), getBlockPos());
button.powerOn(state, getWorld(), buttonPos);
} else if (state.getBlock() instanceof LeverBlock lever) {
lever.togglePower(state, getWorld(), buttonPos);
}
if (state.getBlock() instanceof LeverBlock lever) {
lever.togglePower(state, getWorld(), hit.getBlockPos());
} else if (posState.getBlock() instanceof LeverBlock lever) {
lever.togglePower(posState, getWorld(), getBlockPos());
}
BlockPos belowPos = getBlockPos().down();
BlockPos belowPos = buttonPos.down();
BlockState below = getWorld().getBlockState(belowPos);
ItemStack stack = getStack();
if (below.getBlock() instanceof HopperBlock hopper) {