Skip to content

Commit

Permalink
Update tweaker for 1.13.1 & 1.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
irtimaled committed Feb 3, 2019
1 parent b3c42a8 commit 1667ddd
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 27 deletions.
15 changes: 10 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}
Expand All @@ -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'
Expand All @@ -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 {
Expand All @@ -40,7 +45,7 @@ dependencies {

minecraft {
version = mcVersion
mappings = 'snapshot_20180908'
mappings = 'snapshot_20181106'
runDir = 'run'
tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker'
makeObfSourceJar = false
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/irtimaled/bbor/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down
28 changes: 14 additions & 14 deletions src/main/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,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<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 src/main/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",
"client.settings.MixinGameSettings"
Expand Down

0 comments on commit 1667ddd

Please sign in to comment.