Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Martin Robertz committed 2026-01-30 10:52:50 +01:00
commit 1cec245874
6 files changed
+34 -33

No files matched your search

@@ -75,7 +75,9 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
int meta = world.getBlockMetadata(x, y, z);
renderHelper.state
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.YPOS][side]);
renderHelper.state
.setUVRotation(RenderHelper.YNEG, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.YNEG][side]);
boxRenderer.setUnit(block.getTrimWidth());
boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE);
@@ -40,7 +40,7 @@ public class EarlyMixinsLoader implements IFMLLoadingPlugin, IEarlyMixinLoader {
// rename the associated .json file by replacing the "mymodid" with your own mod ID
// in the .json file edit the "package" and "refmap" properties to match your mod
// also edit the "refmap" property in the "mixins.mymodid.json" file
return "mixins.storagedrawers.early.json";
return "mixins.StorageDrawers.early.json";
}
@Override
@@ -5,6 +5,7 @@ import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -12,45 +13,43 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
@Mixin(PlayerControllerMP.class)
@Mixin(value = PlayerControllerMP.class, priority = 10000)
public abstract class MixinPlayerControllerMP {
@Final
@Shadow
private Minecraft mc;
@Inject(
method = "onPlayerDamageBlock",
at = @At(
value = "INVOKE_ASSIGN",
value = "INVOKE",
target = "Lnet/minecraft/block/Block;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;III)F"))
private void mixin(int x, int y, int z, int side, CallbackInfo ci) {
if (mc.theWorld.getTileEntity(x, y, z) instanceof TileEntityDrawers ted
&& mc.theWorld.getBlock(x, y, z) instanceof BlockDrawers bd) {
if (ted.getDirection() == side) {
final int reach = 5;
double eyeX = mc.thePlayer.posX;
double eyeY = mc.thePlayer.posY + mc.thePlayer.getEyeHeight();
double eyeZ = mc.thePlayer.posZ;
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;
Vec3 look = mc.thePlayer.getLookVec();
final int reach = 5;
double eyeX = mc.thePlayer.posX;
double eyeY = mc.thePlayer.posY + mc.thePlayer.getEyeHeight();
double eyeZ = mc.thePlayer.posZ;
Vec3 end = Vec3.createVectorHelper(
eyeX + look.xCoord * reach,
eyeY + look.yCoord * reach,
eyeZ + look.zCoord * reach);
Vec3 lookVec = mc.thePlayer.getLookVec();
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));
}
}
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, clickedSide, hitX, hitY, hitZ, invertShift));
}
}
@@ -147,17 +147,17 @@ public class RenderHelperLL {
private void setFaceYNegUV(IIcon icon, double minX, double minZ, double maxX, double maxZ) {
int rotate = state.uvRotate[RenderHelper.YNEG];
if (rotate == RenderHelperState.ROTATE0)
setUV(icon, minX + state.shiftU, maxX + state.shiftU, maxZ + state.shiftV, minZ + state.shiftV);
setUV(icon, maxX + state.shiftU, minX + state.shiftU, maxZ + state.shiftV, minZ + state.shiftV);
if (rotate == RenderHelperState.ROTATE90)
setUV(icon, 1 - maxZ + state.shiftU, 1 - minZ + state.shiftU, minX + state.shiftV, maxX + state.shiftV);
setUV(icon, 1 - minZ + state.shiftU, 1 - maxZ + state.shiftU, minX + state.shiftV, maxX + state.shiftV);
if (rotate == RenderHelperState.ROTATE180) setUV(
icon,
1 - minX + state.shiftU,
1 - maxX + state.shiftU,
1 - minX + state.shiftU,
1 - maxZ + state.shiftV,
1 - minZ + state.shiftV);
if (rotate == RenderHelperState.ROTATE270)
setUV(icon, maxZ + state.shiftU, minZ + state.shiftU, 1 - minX + state.shiftV, 1 - maxX + state.shiftV);
setUV(icon, minZ + state.shiftU, maxZ + state.shiftU, 1 - minX + state.shiftV, 1 - maxX + state.shiftV);
}
private void setFaceYPosUV(IIcon icon, double minX, double minZ, double maxX, double maxZ) {
@@ -7,7 +7,7 @@ public class RenderHelperState {
public static final int ROTATE180 = 2;
public static final int ROTATE270 = 3;
public static final int[][] ROTATION_BY_FACE_FACE = { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 },
public static final int[][] ROTATION_BY_FACE_FACE = { { 0, 0, 0, 2, 1, 3 }, { 0, 0, 0, 2, 3, 1 },
{ 0, 0, 0, 2, 3, 1 }, { 0, 0, 2, 0, 1, 3 }, { 0, 0, 1, 3, 0, 2 }, { 0, 0, 3, 1, 2, 0 }, };
public static final int[][] FACE_BY_FACE_ROTATION = { { 0, 0, 0, 0 }, { 1, 1, 1, 1 }, { 2, 5, 3, 4 },
@@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8.5-GTNH",
"package": "com.jaquadro.minecraft.storagedrawers.mixins.early",
"refmap": "mixins.storagedrawers.refmap.json",
"refmap": "mixins.StorageDrawers.refmap.json",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}