diff --git a/build.gradle b/build.gradle index 2f1d520c..f4a0e5bc 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT' + classpath 'org.spongepowered:mixingradle:' + project.mixinGradleVersion classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } @@ -66,19 +66,19 @@ mixin { } dependencies { - compile('org.spongepowered:mixin:0.6.9-SNAPSHOT') { + compile('org.spongepowered:mixin:' + project.mixinVersion) { exclude module: 'launchwrapper' exclude module: 'guava' } - compile 'com.elytradev:concrete:0.2.2:all' - shadow 'com.elytradev:concrete:0.2.2:all' + compile 'com.elytradev:concrete:' + project.concreteVersion + ':all' + shadow 'com.elytradev:concrete:' + project.concreteVersion + ':all' } shadowJar { exclude 'dummyThing' - relocate 'com.elytradev.concrete', "com.elytradev.movingworld.repackage.com.elytradev.concrete" + relocate 'com.elytradev.concrete', "com.elytradev.movingworld.repackage.com.elytradev.concrete" dependencies { include(dependency('org.spongepowered:mixin')) include(dependency('com.elytradev:concrete')) diff --git a/gradle.properties b/gradle.properties index d83732fa..6b37380a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,17 @@ modGroup=com.elytradev -modVersion=5 +modVersion=6 modBaseName=movingworld -forgeVersion=1.12-14.21.1.2406 -mcpVersion=snapshot_20170623 + +#Forge Stuff +forgeVersion=1.12.2-14.23.0.2493 +mcpVersion=snapshot_20170927 + +#Mixin Stuff +mixinVersion=0.7.4-SNAPSHOT +mixinGradleVersion=0.5-SNAPSHOT + +#Eytra Stuff +concreteVersion=0.3.2-SNAPSHOT # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. diff --git a/src/main/java/com/elytradev/movingworld/common/asm/coremod/MovingWorldCoreMod.java b/src/main/java/com/elytradev/movingworld/common/asm/coremod/MovingWorldCoreMod.java index 5b84941c..0a2aaf47 100644 --- a/src/main/java/com/elytradev/movingworld/common/asm/coremod/MovingWorldCoreMod.java +++ b/src/main/java/com/elytradev/movingworld/common/asm/coremod/MovingWorldCoreMod.java @@ -6,7 +6,7 @@ import java.util.Map; -@IFMLLoadingPlugin.MCVersion(value = "1.12") +@IFMLLoadingPlugin.Name(value = "MovingWorldCore") public class MovingWorldCoreMod implements IFMLLoadingPlugin { public MovingWorldCoreMod() { @@ -41,7 +41,7 @@ public void injectData(Map data) { @Override public String getAccessTransformerClass() { - return "com.elytradev.movingworld.common.asm.coremod.MovingWorldAccessTransformer"; + return null; } } diff --git a/src/main/java/com/elytradev/movingworld/common/chunk/ChunkCollisionHelper.java b/src/main/java/com/elytradev/movingworld/common/chunk/ChunkCollisionHelper.java index 15dcd753..905bd75e 100644 --- a/src/main/java/com/elytradev/movingworld/common/chunk/ChunkCollisionHelper.java +++ b/src/main/java/com/elytradev/movingworld/common/chunk/ChunkCollisionHelper.java @@ -170,10 +170,10 @@ public static boolean onEntityMove(Entity entity, MobileChunk mobileChunk, doubl entity.setEntityBoundingBox(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ)); mixinEntity.resetPosToBB(); - entity.isCollidedHorizontally = d6 != x || d8 != z; - entity.isCollidedVertically = d7 != y; - entity.onGround = entity.isCollidedVertically && d7 < 0.0D; - entity.isCollided = entity.isCollidedHorizontally || entity.isCollidedVertically; + entity.collidedHorizontally = d6 != x || d8 != z; + entity.collidedVertically = d7 != y; + entity.onGround = entity.collidedVertically && d7 < 0.0D; + entity.collided = entity.collidedVertically || entity.collidedVertically; int i = MathHelper.floor(entityChunkPosX); int j = MathHelper.floor(entityChunkPosY - 0.20000000298023224D); int k = MathHelper.floor(entityChunkPosZ); diff --git a/src/main/java/com/elytradev/movingworld/common/chunk/mobilechunk/MobileChunk.java b/src/main/java/com/elytradev/movingworld/common/chunk/mobilechunk/MobileChunk.java index 25e49ecb..5cc3cfcc 100644 --- a/src/main/java/com/elytradev/movingworld/common/chunk/mobilechunk/MobileChunk.java +++ b/src/main/java/com/elytradev/movingworld/common/chunk/mobilechunk/MobileChunk.java @@ -1,5 +1,7 @@ package com.elytradev.movingworld.common.chunk.mobilechunk; +import com.elytradev.concrete.reflect.accessor.Accessor; +import com.elytradev.concrete.reflect.accessor.Accessors; import com.elytradev.movingworld.MovingWorldMod; import com.elytradev.movingworld.api.IMovingTile; import com.elytradev.movingworld.common.chunk.LocatedBlock; @@ -33,6 +35,10 @@ import java.util.Map; public abstract class MobileChunk implements IBlockAccess { + + public static final Accessor TILE_BLOCK_TYPE = Accessors.findField(TileEntity.class, "blockType", "field_145854_h"); + public static final Accessor TILE_METADATA = Accessors.findField(TileEntity.class, "blockMetadata", "field_145847_g"); + public static final int CHUNK_SIZE = 16; public static final int CHUNK_MEMORY_USING = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE * (4 + 2); //(16*16*16 shorts and ints) @@ -256,8 +262,8 @@ public boolean addBlockWithState(BlockPos pos, IBlockState state) { setTileEntity(pos, tileentity); } else { tileentity.updateContainingBlockInfo(); - tileentity.blockType = block; - tileentity.blockMetadata = meta; + TILE_BLOCK_TYPE.set(tileentity, block); + TILE_METADATA.set(tileentity, meta); } } @@ -413,7 +419,7 @@ public boolean setBlockState(BlockPos pos, IBlockState state) { if (tileentity != null) { tileentity.updateContainingBlockInfo(); - tileentity.blockMetadata = block.getMetaFromState(state); + TILE_METADATA.set(tileentity, block.getMetaFromState(state)); } } @@ -509,7 +515,7 @@ private void setChunkBlockTileEntity(BlockPos pos, TileEntity newTile) { chunkTileEntityMap.get(chunkPosition).invalidate(); //RIP } - newTile.blockMetadata = block.getMetaFromState(blockState); + TILE_METADATA.set(newTile, block.getMetaFromState(blockState)); chunkTileEntityMap.put(chunkPosition, newTile); if (newTile instanceof IMovingTile) { diff --git a/src/main/java/com/elytradev/movingworld/common/entity/EntityMovingWorld.java b/src/main/java/com/elytradev/movingworld/common/entity/EntityMovingWorld.java index 5ee3be59..82bb1f28 100644 --- a/src/main/java/com/elytradev/movingworld/common/entity/EntityMovingWorld.java +++ b/src/main/java/com/elytradev/movingworld/common/entity/EntityMovingWorld.java @@ -634,10 +634,10 @@ private boolean handleCollision(double cPosX, double cPosY, double cPosZ) { if (block == Blocks.SNOW) { world.setBlockToAir(new BlockPos(i1, l1, j1)); - isCollidedHorizontally = false; + collidedHorizontally = false; } else if (block == Blocks.WATERLILY) { world.destroyBlock(new BlockPos(i1, l1, j1), true); - isCollidedHorizontally = false; + collidedHorizontally = false; } else { didCollide = true; } diff --git a/src/main/java/com/elytradev/movingworld/common/entity/MovingWorldHandlerClient.java b/src/main/java/com/elytradev/movingworld/common/entity/MovingWorldHandlerClient.java index 2a115112..8c2d7f6b 100644 --- a/src/main/java/com/elytradev/movingworld/common/entity/MovingWorldHandlerClient.java +++ b/src/main/java/com/elytradev/movingworld/common/entity/MovingWorldHandlerClient.java @@ -12,7 +12,7 @@ public MovingWorldHandlerClient(EntityMovingWorld movingWorld) { @Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { - if (player.getDistanceSqToEntity(getMovingWorld()) >= 36D) { + if (player.getDistanceSq(getMovingWorld()) >= 36D) { new FarInteractMessage(getMovingWorld(), hand).sendToServer(); } diff --git a/src/main/java/com/elytradev/movingworld/common/tile/TileMovingMarkingBlock.java b/src/main/java/com/elytradev/movingworld/common/tile/TileMovingMarkingBlock.java index bba3e5be..4707f672 100644 --- a/src/main/java/com/elytradev/movingworld/common/tile/TileMovingMarkingBlock.java +++ b/src/main/java/com/elytradev/movingworld/common/tile/TileMovingMarkingBlock.java @@ -5,6 +5,7 @@ import com.elytradev.movingworld.common.chunk.MovingWorldAssemblyInteractor; import com.elytradev.movingworld.common.chunk.assembly.AssembleResult; import com.elytradev.movingworld.common.chunk.assembly.ChunkAssembler; +import com.elytradev.movingworld.common.chunk.mobilechunk.MobileChunk; import com.elytradev.movingworld.common.entity.EntityMovingWorld; import com.elytradev.movingworld.common.entity.MovingWorldInfo; import com.elytradev.movingworld.common.util.LocatedBlockList; @@ -20,6 +21,8 @@ import java.util.UUID; +import static com.elytradev.movingworld.common.chunk.mobilechunk.MobileChunk.TILE_METADATA; + public abstract class TileMovingMarkingBlock extends TileEntity implements IMovingTile { public LocatedBlockList removedFluidBlocks; // A list of fluid blocks that were destroyed last disassemble, used to fill back in when we reassemble. @@ -175,7 +178,7 @@ public void readFromNBT(NBTTagCompound tag) { if (tag.hasKey("owner")) { getInfo().setOwner(UUID.fromString(tag.getString("owner"))); } - blockMetadata = tag.getInteger("meta"); + TILE_METADATA.set(this, tag.getInteger("meta")); if (tag.hasKey("ship") && world != null) { int id = tag.getInteger("ship"); Entity entity = world.getEntityByID(id); @@ -212,7 +215,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setString("owner", getInfo().getOwner().toString()); } - tag.setInteger("meta", blockMetadata); + tag.setInteger("meta", TILE_METADATA.get(this)); tag.setString("name", getInfo().getName()); if (getParentMovingWorld() != null && !getParentMovingWorld().isDead) { tag.setInteger("movingWorld", getParentMovingWorld().getEntityId()); @@ -241,7 +244,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound tag) { public void writeNBTForSending(NBTTagCompound tag) { super.writeToNBT(tag); - tag.setInteger("meta", blockMetadata); + tag.setInteger("meta", TILE_METADATA.get(this)); tag.setString("name", getInfo().getName()); if (getParentMovingWorld() != null && !getParentMovingWorld().isDead) { diff --git a/src/main/resources/MovingWorld_at.cfg b/src/main/resources/MovingWorld_at.cfg deleted file mode 100644 index a21f64de..00000000 --- a/src/main/resources/MovingWorld_at.cfg +++ /dev/null @@ -1,23 +0,0 @@ -public net.minecraft.tileentity.TileEntity field_145847_g # blockMetadata -public net.minecraft.tileentity.TileEntity field_145854_h # blockType -public net.minecraft.tileentity.TileEntity field_190562_f # REGISTRY -public net.minecraft.client.renderer.entity.RenderManager field_78725_b # renderPosX -public net.minecraft.client.renderer.entity.RenderManager field_78726_c # renderPosY -public net.minecraft.client.renderer.entity.RenderManager field_78723_d # renderPosZ - -public net.minecraft.server.management.PlayerChunkMap * # all fields. -public net.minecraft.server.management.PlayerChunkMap func_187302_c(II)Lnet/minecraft/server/management/PlayerChunkMapEntry; # getOrCreateEntry - -public net.minecraft.server.management.PlayerChunkMapEntry * -public net.minecraft.server.management.PlayerChunkMapEntry *() - -# Expose all methods and fields in world classes, we do weird shit to worlds so we need it ALL exposed. -public net.minecraft.world.World * -public net.minecraft.client.multiplayer.WorldClient * -public net.minecraft.world.WorldServer * -public net.minecraft.world.WorldServerMulti * - -public net.minecraft.world.World *() -public net.minecraft.client.multiplayer.WorldClient *() -public net.minecraft.world.WorldServer *() -public net.minecraft.world.WorldServerMulti *()