mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-19 11:59:19 +00:00
slightly better variable names
the lookVec rename was just to get Spotless to shorten that line :trollface:
This commit is contained in:
1 parent
9453c8e14d
commit
1db8b6cdd0
1 file changed
+10
-7
+10
-7
@@ -28,25 +28,28 @@ public abstract class MixinPlayerControllerMP {
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/Block;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;III)F"))
|
||||
private void storageDrawers$checkIfClickingDrawer(int x, int y, int z, int side, CallbackInfo ci) {
|
||||
if (!(mc.theWorld.getTileEntity(x, y, z) instanceof TileEntityDrawers ted)) return;
|
||||
if (ted.getDirection() != side) return;
|
||||
private void storageDrawers$checkIfClickingDrawer(int x, int y, int z, int clickedSide, CallbackInfo ci) {
|
||||
final var thisTile = mc.theWorld.getTileEntity(x, y, z);
|
||||
if (!(thisTile instanceof TileEntityDrawers drawer)) return;
|
||||
if (drawer.getDirection() != clickedSide) return;
|
||||
|
||||
final int reach = 5;
|
||||
double eyeX = mc.thePlayer.posX;
|
||||
double eyeY = mc.thePlayer.posY + mc.thePlayer.getEyeHeight();
|
||||
double eyeZ = mc.thePlayer.posZ;
|
||||
|
||||
Vec3 look = mc.thePlayer.getLookVec();
|
||||
Vec3 lookVec = mc.thePlayer.getLookVec();
|
||||
|
||||
Vec3 end = Vec3
|
||||
.createVectorHelper(eyeX + look.xCoord * reach, eyeY + look.yCoord * reach, eyeZ + look.zCoord * reach);
|
||||
Vec3 end = Vec3.createVectorHelper(
|
||||
eyeX + lookVec.xCoord * reach,
|
||||
eyeY + lookVec.yCoord * reach,
|
||||
eyeZ + lookVec.zCoord * reach);
|
||||
|
||||
MovingObjectPosition mop = mc.theWorld.rayTraceBlocks(Vec3.createVectorHelper(eyeX, eyeY, eyeZ), end);
|
||||
float hitX = (float) (mop.hitVec.xCoord - mop.blockX);
|
||||
float hitY = (float) (mop.hitVec.yCoord - mop.blockY);
|
||||
float hitZ = (float) (mop.hitVec.zCoord - mop.blockZ);
|
||||
boolean invertShift = StorageDrawers.config.cache.invertShift;
|
||||
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, side, hitX, hitY, hitZ, invertShift));
|
||||
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, clickedSide, hitX, hitY, hitZ, invertShift));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user