This commit is contained in:
IThundxr 2024-05-06 17:46:36 -04:00
parent d66170c8fe
commit f899bfe0ab
No known key found for this signature in database
GPG key ID: E291EC97BAF935E6

View file

@ -28,7 +28,7 @@ import net.minecraftforge.fml.DistExecutor;
public class LecternControllerBlockEntity extends SmartBlockEntity {
private ItemStack controller;
private ItemStack controller = ItemStack.EMPTY;
private UUID user;
private UUID prevUser; // used only on client
private boolean deactivatedThisTick; // used only on server
@ -161,9 +161,9 @@ public class LecternControllerBlockEntity extends SmartBlockEntity {
stopUsing((Player) playerEntity);
Direction dir = state.getValue(LecternControllerBlock.FACING);
double x = worldPosition.getX() + 0.5 + 0.25*dir.getStepX();
double x = worldPosition.getX() + 0.5 + 0.25 * dir.getStepX();
double y = worldPosition.getY() + 1;
double z = worldPosition.getZ() + 0.5 + 0.25*dir.getStepZ();
double z = worldPosition.getZ() + 0.5 + 0.25 * dir.getStepZ();
ItemEntity itementity = new ItemEntity(level, x, y, z, controller.copy());
itementity.setDefaultPickUpDelay();
level.addFreshEntity(itementity);
@ -172,8 +172,8 @@ public class LecternControllerBlockEntity extends SmartBlockEntity {
public static boolean playerInRange(Player player, Level world, BlockPos pos) {
//double modifier = world.isRemote ? 0 : 1.0;
double reach = 0.4*player.getAttributeValue(ForgeMod.REACH_DISTANCE.get());// + modifier;
return player.distanceToSqr(Vec3.atCenterOf(pos)) < reach*reach;
double reach = 0.4 * player.getAttributeValue(ForgeMod.REACH_DISTANCE.get());// + modifier;
return player.distanceToSqr(Vec3.atCenterOf(pos)) < reach * reach;
}
}