Skip to content

Commit

Permalink
Update tweaker for 1.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
irtimaled committed Jan 31, 2019
1 parent 099161f commit 2aa5b84
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
3 changes: 1 addition & 2 deletions java/com/irtimaled/bbor/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.NetworkManager;
import net.minecraft.world.dimension.DimensionType;
import org.apache.commons.lang3.ArrayUtils;

import java.net.InetSocketAddress;
Expand Down Expand Up @@ -48,7 +47,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);
}
}

Expand Down
28 changes: 14 additions & 14 deletions java/com/irtimaled/bbor/client/NBTFileParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<BoundingBox> boundingBoxes = new HashSet<>();
NBTTagCompound[] children = getChildCompoundTags(feature, "Children");
Expand All @@ -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<BlockPos> doors = getDoors(village);
BoundingBox boundingBox = BoundingBoxVillage.from(center, radius, village.hashCode(), population, doors);
cache.addBoundingBox(boundingBox);
Expand All @@ -163,7 +163,7 @@ private static void loadVillages(File localStructuresFolder, BoundingBoxCache ca
private static Set<BlockPos> getDoors(NBTTagCompound village) {
Set<BlockPos> 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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@
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<DimensionType, WorldServer> worlds;

@Inject(method = "initialWorldChunkLoad", at = @At("HEAD"))
private void initialWorldChunkLoad(CallbackInfo ci)
{
for(World world : worlds) {
for(World world : worlds.values()) {
BoundingBoxOutlineReloaded.worldLoaded(world);
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/mixins.bbor.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"client": [
"client.MixinMinecraft",
"client.renderer.MixinEntityRenderer",
"client.renderer.MixinGameRenderer",
"client.multiplayer.MixinWorldClient",
"client.settings.MixinKeyBinding"
]
Expand Down

0 comments on commit 2aa5b84

Please sign in to comment.