From e961699127f1a7d7be68c88fb6ca71486c8ea239 Mon Sep 17 00:00:00 2001 From: darkevilmac Date: Sun, 17 Jul 2016 20:12:14 -0700 Subject: [PATCH] I was Fixins da Mixins --- build.gradle | 4 ++-- .../common/asm/coremod/MovingWorldCoreMod.java | 8 +++----- .../common/chunk/MovingWorldAssemblyInteractor.java | 4 ++-- .../common/chunk/assembly/ChunkAssembler.java | 8 ++++---- .../movingworld/common/entity/EntityMovingWorld.java | 10 ++++++---- .../common/network/MovingWorldClientAction.java | 6 +++--- .../common/network/MovingWorldNetworking.java | 8 ++++---- src/main/resources/mixins.movingworld.json | 5 +++-- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index ee126c2d..1a93c328 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ group = "darkevilmac.movingworld" archivesBaseName = "movingworld" minecraft { - version = "1.10.2-12.18.0.2006-1.10.0" + version = "1.10.2-12.18.1.2014" runDir = "run" def replacementVersion = 'MOD_VERSION = \"' + project.version + '\"' @@ -36,7 +36,7 @@ minecraft { replace("MOD_VERSION = \"@MOVINGWORLDVER@\"", replacementVersion) - mappings = "snapshot_20160630" + mappings = "snapshot_20160715" } mixin { diff --git a/src/main/java/darkevilmac/movingworld/common/asm/coremod/MovingWorldCoreMod.java b/src/main/java/darkevilmac/movingworld/common/asm/coremod/MovingWorldCoreMod.java index 6d3ff138..1035b80f 100644 --- a/src/main/java/darkevilmac/movingworld/common/asm/coremod/MovingWorldCoreMod.java +++ b/src/main/java/darkevilmac/movingworld/common/asm/coremod/MovingWorldCoreMod.java @@ -3,18 +3,16 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; import org.spongepowered.asm.launch.MixinBootstrap; -import org.spongepowered.asm.mixin.MixinEnvironment; +import org.spongepowered.asm.mixin.Mixins; import java.util.Map; -@IFMLLoadingPlugin.MCVersion(value = "1.9") +@IFMLLoadingPlugin.MCVersion(value = "1.10.2") public class MovingWorldCoreMod implements IFMLLoadingPlugin { public MovingWorldCoreMod() { MixinBootstrap.init(); - MixinEnvironment.setCompatibilityLevel(MixinEnvironment.CompatibilityLevel.JAVA_7); - MixinEnvironment env = MixinEnvironment.getDefaultEnvironment(); - env.addConfiguration("mixins.movingworld.json"); + Mixins.addConfiguration("mixins.movingworld.json"); } @Override diff --git a/src/main/java/darkevilmac/movingworld/common/chunk/MovingWorldAssemblyInteractor.java b/src/main/java/darkevilmac/movingworld/common/chunk/MovingWorldAssemblyInteractor.java index 4827f740..a7f8b8bd 100644 --- a/src/main/java/darkevilmac/movingworld/common/chunk/MovingWorldAssemblyInteractor.java +++ b/src/main/java/darkevilmac/movingworld/common/chunk/MovingWorldAssemblyInteractor.java @@ -6,7 +6,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import darkevilmac.movingworld.MovingWorld; @@ -83,8 +82,9 @@ public void chunkAssembled(AssembleResult assembleResult) { public void chunkDissasembled(AssembleResult assembleResult) { } - public CanAssemble isBlockAllowed(World world, IBlockState state, BlockPos pos) { + public CanAssemble isBlockAllowed(World world, LocatedBlock lb) { CanAssemble canAssemble = new CanAssemble(false, false); + IBlockState state = lb.blockState; canAssemble.justCancel = !(!state.getMaterial().equals(Material.AIR) && !state.getMaterial().isLiquid() && MovingWorld.instance.getNetworkConfig().isStateAllowed(state)); diff --git a/src/main/java/darkevilmac/movingworld/common/chunk/assembly/ChunkAssembler.java b/src/main/java/darkevilmac/movingworld/common/chunk/assembly/ChunkAssembler.java index 31587990..7b7971af 100644 --- a/src/main/java/darkevilmac/movingworld/common/chunk/assembly/ChunkAssembler.java +++ b/src/main/java/darkevilmac/movingworld/common/chunk/assembly/ChunkAssembler.java @@ -78,7 +78,7 @@ private void assembleIterative(AssembleResult result, MovingWorldAssemblyInterac closedSet.add(mobileChunkPos); IBlockState blockState = worldObj.getBlockState(worldPos); - CanAssemble canAssemble = canUseBlockForVehicle(blockState, assemblyInteractor, worldPos); + CanAssemble canAssemble = canUseBlockForVehicle(new LocatedBlock(blockState, worldObj.getTileEntity(worldPos), worldPos), assemblyInteractor); if (canAssemble.justCancel) { continue; @@ -137,7 +137,7 @@ private void assembleRecursive(AssembleResult result, HashSet set, Mov IBlockState blockState = worldObj.getBlockState(pos); Block block = blockState.getBlock(); - CanAssemble canAssemble = canUseBlockForVehicle(blockState, assemblyInteractor, pos); + CanAssemble canAssemble = canUseBlockForVehicle(new LocatedBlock(blockState, worldObj.getTileEntity(pos), pos), assemblyInteractor); if (canAssemble.justCancel) { return; @@ -181,7 +181,7 @@ private void assembleRecursive(AssembleResult result, HashSet set, Mov result.movingWorldMarkingBlock = movingWorldMarker; } - public CanAssemble canUseBlockForVehicle(IBlockState state, MovingWorldAssemblyInteractor assemblyInteractor, BlockPos pos) { - return assemblyInteractor.isBlockAllowed(worldObj, state, pos); + public CanAssemble canUseBlockForVehicle(LocatedBlock lb, MovingWorldAssemblyInteractor assemblyInteractor) { + return assemblyInteractor.isBlockAllowed(worldObj, lb); } } diff --git a/src/main/java/darkevilmac/movingworld/common/entity/EntityMovingWorld.java b/src/main/java/darkevilmac/movingworld/common/entity/EntityMovingWorld.java index 75151dc5..97266d06 100644 --- a/src/main/java/darkevilmac/movingworld/common/entity/EntityMovingWorld.java +++ b/src/main/java/darkevilmac/movingworld/common/entity/EntityMovingWorld.java @@ -654,7 +654,7 @@ public float getHorizontalVelocity() { return (float) Math.sqrt(motionX * motionX + motionZ * motionZ); } - public void alignToGrid() { + public void alignToGrid(boolean doPosAdjustment) { rotationYaw = Math.round(rotationYaw / 90F) * 90F; rotationPitch = 0F; @@ -665,9 +665,11 @@ public void alignToGrid() { int iy = MathHelperMod.round_double(vec.yCoord + posY); int iz = MathHelperMod.round_double(vec.zCoord + posZ); - posX = ix - vec.xCoord; - posY = iy - vec.yCoord; - posZ = iz - vec.zCoord; + if (doPosAdjustment) { + posX = ix - vec.xCoord; + posY = iy - vec.yCoord; + posZ = iz - vec.zCoord; + } motionX = motionY = motionZ = 0D; } diff --git a/src/main/java/darkevilmac/movingworld/common/network/MovingWorldClientAction.java b/src/main/java/darkevilmac/movingworld/common/network/MovingWorldClientAction.java index 38b72c1d..92b9f045 100644 --- a/src/main/java/darkevilmac/movingworld/common/network/MovingWorldClientAction.java +++ b/src/main/java/darkevilmac/movingworld/common/network/MovingWorldClientAction.java @@ -1,7 +1,7 @@ package darkevilmac.movingworld.common.network; public enum MovingWorldClientAction { - NONE, ALIGN, DISASSEMBLE, DISASSEMBLEOVERWRITE; + NONE, ALIGN, DISASSEMBLE, DISASSEMBLEWITHOVERWRITE; public static byte toByte(MovingWorldClientAction action) { switch (action) { @@ -9,7 +9,7 @@ public static byte toByte(MovingWorldClientAction action) { return (byte) 1; case DISASSEMBLE: return (byte) 2; - case DISASSEMBLEOVERWRITE: + case DISASSEMBLEWITHOVERWRITE: return (byte) 3; default: return (byte) 0; @@ -23,7 +23,7 @@ public static MovingWorldClientAction fromByte(byte actionInt) { case 2: return DISASSEMBLE; case 3: - return DISASSEMBLEOVERWRITE; + return DISASSEMBLEWITHOVERWRITE; default: return NONE; } diff --git a/src/main/java/darkevilmac/movingworld/common/network/MovingWorldNetworking.java b/src/main/java/darkevilmac/movingworld/common/network/MovingWorldNetworking.java index 7d6a3cb4..6002197e 100644 --- a/src/main/java/darkevilmac/movingworld/common/network/MovingWorldNetworking.java +++ b/src/main/java/darkevilmac/movingworld/common/network/MovingWorldNetworking.java @@ -203,17 +203,17 @@ public void accept(EntityPlayer entityPlayer, Token token) { if (movingWorld != null && movingWorld.getControllingPassenger().getEntityId() == entityPlayer.getEntityId()) { switch (action) { case DISASSEMBLE: - movingWorld.alignToGrid(); + movingWorld.alignToGrid(true); movingWorld.updatePassengerPosition(entityPlayer, movingWorld.riderDestination, 1); movingWorld.disassemble(false); break; - case DISASSEMBLEOVERWRITE: - movingWorld.alignToGrid(); + case DISASSEMBLEWITHOVERWRITE: + movingWorld.alignToGrid(true); movingWorld.updatePassengerPosition(entityPlayer, movingWorld.riderDestination, 1); movingWorld.disassemble(true); break; case ALIGN: - movingWorld.alignToGrid(); + movingWorld.alignToGrid(true); break; default: break; diff --git a/src/main/resources/mixins.movingworld.json b/src/main/resources/mixins.movingworld.json index 53d9d698..29cc0968 100644 --- a/src/main/resources/mixins.movingworld.json +++ b/src/main/resources/mixins.movingworld.json @@ -1,11 +1,12 @@ { "required": true, "package": "darkevilmac.movingworld.common.asm.mixin.core", + "compatibilityLevel": "JAVA_8", + "refmap": "movingworld.mixin.refmap.json", "mixins": [ "entity.MixinEntity", "block.property.MixinPropertyEnum", "block.property.MixinPropertyInteger", "block.MixinBlockSkull" - ], - "refmap": "movingworld.mixin.refmap.json" + ] } \ No newline at end of file