diff --git a/build.gradle b/build.gradle index b77cd97b..5ac3a582 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,17 @@ buildscript { repositories { jcenter() - maven { url 'https://www.dimdev.org/maven/' } maven { url 'https://repo.spongepowered.org/maven' } maven { url 'https://plugins.gradle.org/m2/' } + maven { url 'https://jitpack.io' } + maven { url 'https://files.minecraftforge.net/maven' } } dependencies { - classpath 'org.dimdev:ForgeGradle:2.3-SNAPSHOT' + if(gradle.startParameter.projectProperties.mc == null) { + classpath 'com.github.Irtimaled:ForgeGradle:1.13.2-SNAPSHOT' + } else { + classpath "com.github.Irtimaled:ForgeGradle:${mc}-SNAPSHOT" + } classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' } } @@ -16,7 +21,7 @@ apply plugin: 'java' apply plugin: 'org.spongepowered.mixin' apply plugin: 'maven-publish' -def mcVersion = '1.13' +def mcVersion = project.hasProperty('mc') ? project.mc : '1.13.2' group 'com.irtimaled' version "1.0.4-$mcVersion" archivesBaseName = 'BBOutlineReloaded' @@ -27,8 +32,8 @@ targetCompatibility = 1.8 repositories { mavenCentral() maven { url 'https://libraries.minecraft.net/' } - maven { url 'https://www.dimdev.org/maven/' } maven { url 'https://repo.spongepowered.org/maven/' } + maven { url 'https://jitpack.io' } } dependencies { @@ -40,7 +45,7 @@ dependencies { minecraft { version = mcVersion - mappings = 'snapshot_20180908' + mappings = 'snapshot_20181106' runDir = 'run' tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker' makeObfSourceJar = false diff --git a/src/main/java/com/irtimaled/bbor/client/ClientProxy.java b/src/main/java/com/irtimaled/bbor/client/ClientProxy.java index 6b26bc68..fd84cd66 100644 --- a/src/main/java/com/irtimaled/bbor/client/ClientProxy.java +++ b/src/main/java/com/irtimaled/bbor/client/ClientProxy.java @@ -7,7 +7,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.NetworkManager; -import net.minecraft.world.dimension.DimensionType; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -40,7 +39,7 @@ public void render(float partialTicks) { PlayerData.setPlayerPosition(partialTicks, entityPlayer); if (this.active) { - renderer.render(DimensionType.getById(entityPlayer.dimension), outerBoxOnly); + renderer.render(entityPlayer.dimension, outerBoxOnly); } } diff --git a/src/main/java/com/irtimaled/bbor/client/NBTFileParser.java b/src/main/java/com/irtimaled/bbor/client/NBTFileParser.java index 719fb189..056d3c2d 100644 --- a/src/main/java/com/irtimaled/bbor/client/NBTFileParser.java +++ b/src/main/java/com/irtimaled/bbor/client/NBTFileParser.java @@ -51,10 +51,10 @@ private static void loadWorldData(File localStructuresFolder, DimensionCache dim if (nbt == null) return; - NBTTagCompound data = nbt.getCompoundTag("Data"); + NBTTagCompound data = nbt.getCompound("Data"); long seed = data.getLong("RandomSeed"); - int spawnX = data.getInteger("SpawnX"); - int spawnZ = data.getInteger("SpawnZ"); + int spawnX = data.getInt("SpawnX"); + int spawnZ = data.getInt("SpawnZ"); Logger.info("Loaded level.dat (seed: %d, spawn: %d,%d)", seed, spawnX, spawnZ); dimensionCache.setWorldData(seed, spawnX, spawnZ); } @@ -121,11 +121,11 @@ private static void loadStructure(File localStructuresFolder, BoundingBoxCache c if (nbt == null) return; - NBTTagCompound features = nbt.getCompoundTag("data") - .getCompoundTag("Features"); + NBTTagCompound features = nbt.getCompound("data") + .getCompound("Features"); int loadedStructureCount = 0; - for (Object key : features.getKeySet()) { - NBTTagCompound feature = features.getCompoundTag((String) key); + for (Object key : features.keySet()) { + NBTTagCompound feature = features.getCompound((String) key); BoundingBox structure = BoundingBoxStructure.from(feature.getIntArray("BB"), color); Set boundingBoxes = new HashSet<>(); NBTTagCompound[] children = getChildCompoundTags(feature, "Children"); @@ -147,11 +147,11 @@ private static void loadVillages(File localStructuresFolder, BoundingBoxCache ca if (nbt == null) return; - NBTTagCompound[] villages = getChildCompoundTags(nbt.getCompoundTag("data"), "Villages"); + NBTTagCompound[] villages = getChildCompoundTags(nbt.getCompound("data"), "Villages"); for (NBTTagCompound village : villages) { - BlockPos center = new BlockPos(village.getInteger("CX"), village.getInteger("CY"), village.getInteger("CZ")); - int radius = village.getInteger("Radius"); - int population = village.getInteger("PopSize"); + BlockPos center = new BlockPos(village.getInt("CX"), village.getInt("CY"), village.getInt("CZ")); + int radius = village.getInt("Radius"); + int population = village.getInt("PopSize"); Set doors = getDoors(village); BoundingBox boundingBox = BoundingBoxVillage.from(center, radius, village.hashCode(), population, doors); cache.addBoundingBox(boundingBox); @@ -163,7 +163,7 @@ private static void loadVillages(File localStructuresFolder, BoundingBoxCache ca private static Set getDoors(NBTTagCompound village) { Set doors = new HashSet<>(); for (NBTTagCompound door : getChildCompoundTags(village, "Doors")) { - doors.add(new BlockPos(door.getInteger("X"), door.getInteger("Y"), door.getInteger("Z"))); + doors.add(new BlockPos(door.getInt("X"), door.getInt("Y"), door.getInt("Z"))); } return doors; } @@ -179,10 +179,10 @@ private static NBTTagCompound loadNbtFile(File file) { } private static NBTTagCompound[] getChildCompoundTags(NBTTagCompound parent, String key) { - NBTTagList tagList = parent.getTagList(key, 10); + NBTTagList tagList = parent.getList(key, 10); NBTTagCompound[] result = new NBTTagCompound[tagList.size()]; for (int index = 0; index < tagList.size(); index++) { - result[index] = tagList.getCompoundTagAt(index); + result[index] = tagList.getCompound(index); } return result; } diff --git a/src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinEntityRenderer.java b/src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinGameRenderer.java similarity index 85% rename from src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinEntityRenderer.java rename to src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinGameRenderer.java index 44e52229..6282ccbc 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinEntityRenderer.java +++ b/src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinGameRenderer.java @@ -1,14 +1,14 @@ package com.irtimaled.bbor.mixin.client.renderer; import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded; -import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GameRenderer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(EntityRenderer.class) -public class MixinEntityRenderer { +@Mixin(GameRenderer.class) +public class MixinGameRenderer { @Inject(method = "updateCameraAndRender(FJ)V", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE)) private void render(float partialTicks, long ignored, CallbackInfo ci) { BoundingBoxOutlineReloaded.render(partialTicks); diff --git a/src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java b/src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java index 936a5fcc..21410177 100644 --- a/src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java +++ b/src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java @@ -4,20 +4,24 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraft.world.WorldServer; +import net.minecraft.world.dimension.DimensionType; +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; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Map; + @Mixin(MinecraftServer.class) public class MixinMinecraftServer { - @Shadow public WorldServer[] worlds; + @Shadow @Final private Map worlds; @Inject(method = "initialWorldChunkLoad", at = @At("HEAD")) private void initialWorldChunkLoad(CallbackInfo ci) { - for(World world : worlds) { + for(World world : worlds.values()) { BoundingBoxOutlineReloaded.worldLoaded(world); } } diff --git a/src/main/resources/mixins.bbor.json b/src/main/resources/mixins.bbor.json index 65c188b4..8dd8d85b 100644 --- a/src/main/resources/mixins.bbor.json +++ b/src/main/resources/mixins.bbor.json @@ -12,7 +12,7 @@ ], "client": [ "client.MixinMinecraft", - "client.renderer.MixinEntityRenderer", + "client.renderer.MixinGameRenderer", "client.multiplayer.MixinWorldClient", "client.settings.MixinKeyBinding", "client.settings.MixinGameSettings"