--- /dev/null
+buildscript {
+ repositories {
+ jcenter()
+ maven { url 'https://www.dimdev.org/maven/' }
+ maven { url 'https://repo.spongepowered.org/maven' }
+ }
+ dependencies {
+ classpath 'org.dimdev:ForgeGradle:2.3-SNAPSHOT'
+ classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
+ }
+}
+
+apply plugin: 'net.minecraftforge.gradle.tweaker-client'
+apply plugin: 'java'
+apply plugin: 'org.spongepowered.mixin'
+
+group 'com.irtimaled'
+version project.buildVersion + '-' + project.mcVersion
+archivesBaseName = 'BBOutlineReloaded'
+
+sourceCompatibility = 1.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/' }
+}
+
+dependencies {
+ implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT') { transitive = false }
+ implementation('net.minecraft:launchwrapper:1.12') { transitive = false }
+ implementation 'org.ow2.asm:asm:6.2'
+ implementation 'org.ow2.asm:asm-commons:6.2'
+}
+
+minecraft {
+ version = project.mcVersion
+ mappings = 'snapshot_20180908'
+ runDir = 'run'
+ tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker'
+ makeObfSourceJar = false
+
+ replace "@VERSION@", project.version
+ replaceIn "com/irtimaled/bbor/install/Main.java"
+
+ replace "@MC_VERSION@", project.mcVersion
+ replaceIn "com/irtimaled/bbor/install/Main.java"
+}
+
+mixin {
+ defaultObfuscationEnv notch
+ add sourceSets.main, 'mixins.bbor.refmap.json'
+}
+
+sourceSets {
+ main
+ debug {
+ compileClasspath += main.compileClasspath
+ }
+}
+
+processResources {
+ filesMatching('profile.json') {
+ expand([
+ 'version': project.version,
+ 'mcVersion': project.mcVersion,
+ 'tweakClass': project.minecraft.tweakClass,
+ 'formattedTime': new Date().format("yyyy-MM-dd'T'HH:mm:ss'-08:00'")
+ ])
+ }
+
+ inputs.property "version", project.version
+ inputs.property "mcVersion", project.mcVersion
+}
+
+jar {
+ finalizedBy reobfJar
+ manifest.attributes(
+ 'Main-Class': 'com.irtimaled.bbor.install.Main'
+ )
+
+ classifier = 'vanilla'
+}
+
+artifacts {
+ archives jar
+}
--- /dev/null
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
--- /dev/null
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
--- /dev/null
+@if "%DEBUG%" == "" @echo off\r
+@rem ##########################################################################\r
+@rem\r
+@rem Gradle startup script for Windows\r
+@rem\r
+@rem ##########################################################################\r
+\r
+@rem Set local scope for the variables with windows NT shell\r
+if "%OS%"=="Windows_NT" setlocal\r
+\r
+set DIRNAME=%~dp0\r
+if "%DIRNAME%" == "" set DIRNAME=.\r
+set APP_BASE_NAME=%~n0\r
+set APP_HOME=%DIRNAME%\r
+\r
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
+set DEFAULT_JVM_OPTS=\r
+\r
+@rem Find java.exe\r
+if defined JAVA_HOME goto findJavaFromJavaHome\r
+\r
+set JAVA_EXE=java.exe\r
+%JAVA_EXE% -version >NUL 2>&1\r
+if "%ERRORLEVEL%" == "0" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:findJavaFromJavaHome\r
+set JAVA_HOME=%JAVA_HOME:"=%\r
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
+\r
+if exist "%JAVA_EXE%" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:init\r
+@rem Get command-line arguments, handling Windows variants\r
+\r
+if not "%OS%" == "Windows_NT" goto win9xME_args\r
+\r
+:win9xME_args\r
+@rem Slurp the command line arguments.\r
+set CMD_LINE_ARGS=\r
+set _SKIP=2\r
+\r
+:win9xME_args_slurp\r
+if "x%~1" == "x" goto execute\r
+\r
+set CMD_LINE_ARGS=%*\r
+\r
+:execute\r
+@rem Setup the command line\r
+\r
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
+\r
+@rem Execute Gradle\r
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
+\r
+:end\r
+@rem End local scope for the variables with windows NT shell\r
+if "%ERRORLEVEL%"=="0" goto mainEnd\r
+\r
+:fail\r
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
+rem the _cmd.exe /c_ return code!\r
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
+exit /b 1\r
+\r
+:mainEnd\r
+if "%OS%"=="Windows_NT" endlocal\r
+\r
+:omega\r
+++ /dev/null
-package com.irtimaled.bbor.forge;
-
-import com.irtimaled.bbor.client.ClientProxy;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraftforge.client.event.RenderWorldLastEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.InputEvent;
-import net.minecraftforge.fml.common.network.FMLNetworkEvent;
-
-public class ForgeClientProxy extends ForgeCommonProxy {
- private ClientProxy proxy;
-
- @Override
- public ClientProxy getProxy() {
- if (proxy == null) {
- proxy = new ClientProxy();
- }
- return proxy;
- }
-
- @SubscribeEvent
- public void onKeyInputEvent(InputEvent.KeyInputEvent evt) {
- getProxy().keyPressed();
- }
-
- @Override
- protected void onRegisteredPlayerCountChanged(int registeredPlayerCount) {
- getProxy().setRemoteUserCount(registeredPlayerCount-1);
- }
-
- @Override
- protected boolean isRemotePlayer(EntityPlayer player) {
- if (Minecraft.getMinecraft().isSingleplayer()) {
- EntityPlayer singlePlayer = Minecraft.getMinecraft().player;
- return singlePlayer != null && player.getGameProfile() != singlePlayer.getGameProfile();
- }
- return true;
- }
-
- @SubscribeEvent
- public void renderWorldLastEvent(RenderWorldLastEvent event) {
- getProxy().render(event.getPartialTicks());
- }
-
- @SubscribeEvent
- public void clientConnectionToServerEvent(FMLNetworkEvent.ClientConnectedToServerEvent evt) {
- if (!evt.isLocal()) {
- getProxy().playerConnectedToServer(evt.getManager());
- }
- }
-
- @SubscribeEvent
- public void clientDisconnectionFromServerEvent(FMLNetworkEvent.ClientDisconnectionFromServerEvent evt) {
- getProxy().playerDisconnectedFromServer();
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge;
-
-import com.irtimaled.bbor.Logger;
-import com.irtimaled.bbor.common.BoundingBoxCache;
-import com.irtimaled.bbor.common.CommonProxy;
-import com.irtimaled.bbor.common.DimensionCache;
-import com.irtimaled.bbor.common.IVillageEventHandler;
-import com.irtimaled.bbor.common.models.BoundingBox;
-import com.irtimaled.bbor.forge.messages.*;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.network.NetHandlerPlayServer;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.world.DimensionType;
-import net.minecraft.world.World;
-import net.minecraftforge.event.world.ChunkEvent;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.FMLCommonHandler;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.PlayerEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-import net.minecraftforge.fml.common.network.FMLNetworkEvent;
-import net.minecraftforge.fml.common.network.NetworkRegistry;
-import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
-import net.minecraftforge.fml.relauncher.Side;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class ForgeCommonProxy implements IVillageEventHandler {
- private Map<EntityPlayerMP, DimensionType> playerDimensions = new ConcurrentHashMap<>();
- private Map<EntityPlayerMP, Set<BoundingBox>> playerBoundingBoxesCache = new HashMap<>();
- private HashSet<EntityPlayerMP> registeredPlayers = new HashSet<>();
-
- protected CommonProxy getProxy() {
- if (commonProxy == null)
- commonProxy = new CommonProxy();
- return commonProxy;
- }
-
- @SubscribeEvent
- public void packetRegistrationEvent(FMLNetworkEvent.CustomPacketRegistrationEvent event) {
- if (event.getOperation().equals("REGISTER") &&
- event.getRegistrations().contains("bbor") &&
- event.getHandler() instanceof NetHandlerPlayServer) {
- registeredPlayers.add(((NetHandlerPlayServer) event.getHandler()).player);
- onRegisteredPlayerCountChanged(registeredPlayers.size());
- }
- }
-
- protected SimpleNetworkWrapper network;
- private CommonProxy commonProxy;
-
- void init() {
- CommonProxy proxy = getProxy();
- proxy.setEventHandler(this);
- proxy.init();
- network = NetworkRegistry.INSTANCE.newSimpleChannel("bbor");
- network.registerMessage(AddBoundingBoxMessageHandler.class, AddBoundingBoxMessage.class, 0, Side.CLIENT);
- network.registerMessage(RemoveBoundingBoxMessageHandler.class, RemoveBoundingBoxMessage.class, 1, Side.CLIENT);
- network.registerMessage(InitializeClientMessageHandler.class, InitializeClientMessage.class, 2, Side.CLIENT);
- }
-
- @SubscribeEvent
- public void worldEvent(WorldEvent.Load event) {
- World world = event.getWorld();
- getProxy().worldLoaded(world);
- }
-
- @SubscribeEvent
- public void chunkEvent(ChunkEvent.Load event) {
- getProxy().chunkLoaded(event.getChunk());
- }
-
- @SubscribeEvent
- public void playerChangedDimensionEvent(PlayerEvent.PlayerChangedDimensionEvent evt) {
- if (playerDimensions.containsKey(evt.player)) {
- EntityPlayerMP player = (EntityPlayerMP) evt.player;
- sendBoundingBoxes(player);
- }
- }
-
- @SubscribeEvent
- public void playerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent evt) {
- if (evt.player instanceof EntityPlayerMP &&
- isRemotePlayer(evt.player)) {
- EntityPlayerMP player = (EntityPlayerMP) evt.player;
- initializeClient(player);
- sendBoundingBoxes(player);
- }
- }
-
- private void sendBoundingBoxes(EntityPlayerMP player) {
- DimensionType dimensionType = DimensionType.getById(player.dimension);
- playerDimensions.put(player, dimensionType);
- sendToPlayer(player, getDimensionCache().getBoundingBoxes(dimensionType));
- }
-
- protected boolean isRemotePlayer(EntityPlayer player) {
- return registeredPlayers.contains(player);
- }
-
- private void initializeClient(EntityPlayerMP player) {
- network.sendTo(InitializeClientMessage.from(getDimensionCache().getWorldData()), player);
- }
-
- @SubscribeEvent
- public void playerLoggedOutEvent(PlayerEvent.PlayerLoggedOutEvent evt) {
- if (isRemotePlayer(evt.player)) {
- playerDimensions.remove(evt.player);
- playerBoundingBoxesCache.remove(evt.player);
- registeredPlayers.remove(evt.player);
- onRegisteredPlayerCountChanged(registeredPlayers.size());
- }
- }
-
- protected void onRegisteredPlayerCountChanged(int registeredPlayerCount) {
- }
-
- @SubscribeEvent
- public void tickEvent(TickEvent event) {
- for (EntityPlayerMP player : playerDimensions.keySet()) {
- MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance();
- if (!mc.getPlayerList().getPlayers().contains(player)) {
- playerDimensions.remove(player);
- } else {
- DimensionType dimensionType = playerDimensions.get(player);
- sendToPlayer(player, getDimensionCache().getBoundingBoxes(dimensionType));
- }
- }
- getProxy().tick();
- }
-
- private void sendToPlayer(EntityPlayerMP player, BoundingBoxCache boundingBoxCache) {
- if (boundingBoxCache == null)
- return;
- Map<BoundingBox, Set<BoundingBox>> cacheSubset = getBoundingBoxMap(player, boundingBoxCache.getBoundingBoxes());
-
- DimensionType dimensionType = DimensionType.getById(player.dimension);
- if (cacheSubset.keySet().size() > 0) {
- Logger.info("send %d entries to %s (%s)", cacheSubset.keySet().size(), player.getDisplayNameString(), dimensionType);
- }
-
- for (BoundingBox key : cacheSubset.keySet()) {
- Set<BoundingBox> boundingBoxes = cacheSubset.get(key);
- network.sendTo(AddBoundingBoxMessage.from(dimensionType, key, boundingBoxes), player);
-
- if (!playerBoundingBoxesCache.containsKey(player)) {
- playerBoundingBoxesCache.put(player, new HashSet<>());
- }
- playerBoundingBoxesCache.get(player).add(key);
- }
- }
-
- private Map<BoundingBox, Set<BoundingBox>> getBoundingBoxMap(EntityPlayerMP player, Map<BoundingBox, Set<BoundingBox>> boundingBoxMap) {
- Map<BoundingBox, Set<BoundingBox>> cacheSubset = new HashMap<>();
- for (BoundingBox key : boundingBoxMap.keySet()) {
- if (!playerBoundingBoxesCache.containsKey(player) || !playerBoundingBoxesCache.get(player).contains(key)) {
- cacheSubset.put(key, boundingBoxMap.get(key));
- }
- }
- return cacheSubset;
- }
-
- public void villageRemoved(DimensionType dimensionType, BoundingBox bb) {
- RemoveBoundingBoxMessage message = RemoveBoundingBoxMessage.from(dimensionType, bb);
- for (EntityPlayerMP player : playerDimensions.keySet()) {
- if (DimensionType.getById(player.dimension) == dimensionType) {
- Logger.info("remove 1 entry from %s (%s)", player.getDisplayNameString(), dimensionType);
- network.sendTo(message, player);
-
- if (playerBoundingBoxesCache.containsKey(player) &&
- playerBoundingBoxesCache.get(player).contains(bb)) {
- playerBoundingBoxesCache.get(player).remove(bb);
- }
- }
- }
- }
-
- public void setWorldData(long seed, int spawnX, int spawnZ) {
- getDimensionCache().setWorldData(seed, spawnX, spawnZ);
- }
-
- public void addBoundingBox(DimensionType dimensionType, BoundingBox key, Set<BoundingBox> boundingBoxes) {
- DimensionCache dimensionCache = getDimensionCache();
- BoundingBoxCache cache = dimensionCache.getBoundingBoxes(dimensionType);
- if (cache == null) {
- dimensionCache.put(dimensionType, cache = new BoundingBoxCache());
- }
- cache.addBoundingBoxes(key, boundingBoxes);
- }
-
- public void removeBoundingBox(DimensionType dimensionType, BoundingBox key) {
- BoundingBoxCache cache = getDimensionCache().getBoundingBoxes(dimensionType);
- if (cache != null) {
- cache.removeBoundingBox(key);
- }
- }
-
- private DimensionCache getDimensionCache() {
- return getProxy().getDimensionCache();
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge;
-
-import com.irtimaled.bbor.config.ConfigManager;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.common.SidedProxy;
-import net.minecraftforge.fml.common.event.FMLInitializationEvent;
-import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
-import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
-
-@Mod(modid = ForgeMod.MODID, name = ForgeMod.NAME, version = ForgeMod.VERSION, acceptedMinecraftVersions = ForgeMod.MCVERSION, acceptableRemoteVersions = "*")
-public class ForgeMod {
- static final String MODID = "bbor";
- static final String NAME = "BoundingBoxOutlineReloaded";
- static final String VERSION = "1.0.3";
- static final String MCVERSION = "1.12.2";
-
- public SimpleNetworkWrapper network;
-
- @Mod.Instance()
- public static ForgeMod instance;
-
- @SidedProxy(clientSide = "com.irtimaled.bbor.forge.ForgeClientProxy", serverSide = "com.irtimaled.bbor.forge.ForgeCommonProxy")
- public static ForgeCommonProxy proxy;
-
- @Mod.EventHandler
- public void preInit(FMLPreInitializationEvent evt) {
- ConfigManager.loadConfig(evt.getModConfigurationDirectory());
- }
-
- @Mod.EventHandler
- public void load(FMLInitializationEvent evt) {
- MinecraftForge.EVENT_BUS.register(proxy);
- proxy.init();
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.BoundingBox;
-import io.netty.buffer.ByteBuf;
-import net.minecraft.world.DimensionType;
-import net.minecraftforge.fml.common.network.ByteBufUtils;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class AddBoundingBoxMessage implements IMessage {
- private DimensionType dimensionType;
- private BoundingBox key;
- private Set<BoundingBox> boundingBoxes;
-
- public static AddBoundingBoxMessage from(DimensionType dimensionType, BoundingBox key, Set<BoundingBox> boundingBoxes) {
- AddBoundingBoxMessage message = new AddBoundingBoxMessage();
- message.dimensionType = dimensionType;
- message.key = key;
- message.boundingBoxes = boundingBoxes;
- return message;
- }
-
- @Override
- public void fromBytes(ByteBuf buf) {
- dimensionType = DimensionType.getById(ByteBufUtils.readVarInt(buf, 5));
- key = BoundingBoxDeserializer.deserialize(buf);
- boundingBoxes = new HashSet<>();
- while (buf.isReadable()) {
- BoundingBox boundingBox = BoundingBoxDeserializer.deserialize(buf);
- boundingBoxes.add(boundingBox);
- }
- if (boundingBoxes.size() == 0)
- boundingBoxes.add(key);
- }
-
- @Override
- public void toBytes(ByteBuf buf) {
- ByteBufUtils.writeVarInt(buf, dimensionType.getId(), 5);
- BoundingBoxSerializer.serialize(key, buf);
- if (boundingBoxes != null &&
- boundingBoxes.size() > 1) {
- for (BoundingBox boundingBox : boundingBoxes) {
- BoundingBoxSerializer.serialize(boundingBox, buf);
- }
- }
- }
-
- public DimensionType getDimensionType() {
- return dimensionType;
- }
-
- BoundingBox getKey() {
- return key;
- }
-
- Set<BoundingBox> getBoundingBoxes() {
- return boundingBoxes;
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.forge.ForgeMod;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
-import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
-
-public class AddBoundingBoxMessageHandler implements IMessageHandler<AddBoundingBoxMessage, IMessage> {
- @Override
- public IMessage onMessage(AddBoundingBoxMessage message, MessageContext ctx) {
- ForgeMod.proxy.addBoundingBox(message.getDimensionType(), message.getKey(), message.getBoundingBoxes());
- return null;
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.BoundingBox;
-import com.irtimaled.bbor.common.models.BoundingBoxStructure;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import io.netty.buffer.ByteBuf;
-import net.minecraft.util.math.BlockPos;
-import net.minecraftforge.fml.common.network.ByteBufUtils;
-
-import java.awt.*;
-import java.util.HashSet;
-import java.util.Set;
-
-class BoundingBoxDeserializer {
- static BoundingBox deserialize(ByteBuf buf) {
- char type = (char) ByteBufUtils.readVarShort(buf);
- switch (type) {
- case 'V':
- return deserializeVillage(buf);
- case 'S':
- return deserializeStructure(buf);
- }
- return null;
- }
-
- private static BoundingBox deserializeStructure(ByteBuf buf) {
- BlockPos minBlockPos = deserializeBlockPos(buf);
- BlockPos maxBlockPos = deserializeBlockPos(buf);
- Color color = new Color(ByteBufUtils.readVarInt(buf, 5));
- return BoundingBoxStructure.from(minBlockPos, maxBlockPos, color);
- }
-
- private static BoundingBox deserializeVillage(ByteBuf buf) {
- BlockPos center = deserializeBlockPos(buf);
- int radius = ByteBufUtils.readVarInt(buf, 5);
- boolean spawnsIronGolems = ByteBufUtils.readVarShort(buf) == 1;
- Color color = new Color(ByteBufUtils.readVarInt(buf, 5));
- Set<BlockPos> doors = new HashSet<>();
- while (buf.isReadable()) {
- BlockPos door = deserializeBlockPos(buf);
- doors.add(door);
- }
- return BoundingBoxVillage.from(center, radius, color, spawnsIronGolems, doors);
- }
-
- private static BlockPos deserializeBlockPos(ByteBuf buf) {
- int x = ByteBufUtils.readVarInt(buf, 5);
- int y = ByteBufUtils.readVarInt(buf, 5);
- int z = ByteBufUtils.readVarInt(buf, 5);
- return new BlockPos(x, y, z);
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.BoundingBox;
-import com.irtimaled.bbor.common.models.BoundingBoxStructure;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import io.netty.buffer.ByteBuf;
-import net.minecraft.util.math.BlockPos;
-import net.minecraftforge.fml.common.network.ByteBufUtils;
-
-import java.awt.*;
-
-class BoundingBoxSerializer {
- static void serialize(BoundingBox boundingBox, ByteBuf buf) {
- if (boundingBox instanceof BoundingBoxVillage) {
- serializeVillage((BoundingBoxVillage) boundingBox, buf);
- }
- if (boundingBox instanceof BoundingBoxStructure) {
- serializeStructure((BoundingBoxStructure) boundingBox, buf);
- }
- }
-
- private static void serializeVillage(BoundingBoxVillage boundingBox, ByteBuf buf) {
- ByteBufUtils.writeVarShort(buf, 'V');
- serializeBlockPos(boundingBox.getCenter(), buf);
- ByteBufUtils.writeVarInt(buf, boundingBox.getRadius(), 5);
- ByteBufUtils.writeVarShort(buf, boundingBox.getSpawnsIronGolems() ? 1 : 0);
- serializeColor(boundingBox.getColor(), buf);
- for (BlockPos door : boundingBox.getDoors()) {
- serializeBlockPos(door, buf);
- }
- }
-
- private static void serializeStructure(BoundingBoxStructure boundingBox, ByteBuf buf) {
- ByteBufUtils.writeVarShort(buf, 'S');
- serializeCuboid(boundingBox, buf);
- serializeColor(boundingBox.getColor(), buf);
- }
-
- private static void serializeColor(Color color, ByteBuf buf) {
- ByteBufUtils.writeVarInt(buf, color.getRGB(), 5);
- }
-
- private static void serializeCuboid(BoundingBox boundingBox, ByteBuf buf) {
- serializeBlockPos(boundingBox.getMinBlockPos(), buf);
- serializeBlockPos(boundingBox.getMaxBlockPos(), buf);
- }
-
- private static void serializeBlockPos(BlockPos blockPos, ByteBuf buf) {
- ByteBufUtils.writeVarInt(buf, blockPos.getX(), 5);
- ByteBufUtils.writeVarInt(buf, blockPos.getY(), 5);
- ByteBufUtils.writeVarInt(buf, blockPos.getZ(), 5);
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.WorldData;
-import io.netty.buffer.ByteBuf;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-
-public class InitializeClientMessage implements IMessage {
- private WorldData worldData;
-
- public static InitializeClientMessage from(WorldData worldData) {
- InitializeClientMessage message = new InitializeClientMessage();
- message.worldData = new WorldData(worldData.getSeed(), worldData.getSpawnX(), worldData.getSpawnZ());
- return message;
- }
-
- @Override
- public void fromBytes(ByteBuf buf) {
- long seed = buf.readLong();
- int spawnX = buf.readInt();
- int spawnZ = buf.readInt();
- worldData = new WorldData(seed, spawnX, spawnZ);
- }
-
- @Override
- public void toBytes(ByteBuf buf) {
- buf.writeLong(worldData.getSeed());
- buf.writeInt(worldData.getSpawnX());
- buf.writeInt(worldData.getSpawnZ());
- }
-
- WorldData getWorldData() {
- return worldData;
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.WorldData;
-import com.irtimaled.bbor.forge.ForgeMod;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
-import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
-
-public class InitializeClientMessageHandler implements IMessageHandler<InitializeClientMessage, IMessage> {
- @Override
- public IMessage onMessage(InitializeClientMessage message, MessageContext ctx) {
- WorldData worldData = message.getWorldData();
- ForgeMod.proxy.setWorldData(worldData.getSeed(), worldData.getSpawnX(), worldData.getSpawnZ());
- return null;
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.common.models.BoundingBox;
-import io.netty.buffer.ByteBuf;
-import net.minecraft.world.DimensionType;
-import net.minecraftforge.fml.common.network.ByteBufUtils;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-
-public class RemoveBoundingBoxMessage implements IMessage {
- private DimensionType dimensionType;
- private BoundingBox key;
-
- public static RemoveBoundingBoxMessage from(DimensionType dimensionType, BoundingBox key) {
- RemoveBoundingBoxMessage message = new RemoveBoundingBoxMessage();
- message.dimensionType = dimensionType;
- message.key = key;
- return message;
- }
-
- @Override
- public void fromBytes(ByteBuf buf) {
- dimensionType = DimensionType.getById(ByteBufUtils.readVarInt(buf, 5));
- key = BoundingBoxDeserializer.deserialize(buf);
- }
-
- @Override
- public void toBytes(ByteBuf buf) {
- ByteBufUtils.writeVarInt(buf, dimensionType.getId(), 5);
- BoundingBoxSerializer.serialize(key, buf);
- }
-
- public DimensionType getDimensionType() {
- return dimensionType;
- }
-
- BoundingBox getKey() {
- return key;
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.forge.messages;
-
-import com.irtimaled.bbor.forge.ForgeMod;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
-import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
-import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
-
-public class RemoveBoundingBoxMessageHandler implements IMessageHandler<RemoveBoundingBoxMessage, IMessage> {
- @Override
- public IMessage onMessage(RemoveBoundingBoxMessage message, MessageContext ctx) {
- ForgeMod.proxy.removeBoundingBox(message.getDimensionType(), message.getKey());
- return null;
- }
-}
--- /dev/null
+package com.irtimaled.bbor.install;
+
+import javax.swing.*;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class Main {
+ public static void main(String... args) throws Throwable {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ try {
+ String osName = getOsName();
+ File minecraftFolder = getMinecraftFolder(osName);
+ File versionFolder = new File(minecraftFolder, "versions/BBOR-@VERSION@/");
+ versionFolder.mkdirs();
+
+ File versionJson = new File(versionFolder, "BBOR-@VERSION@.json");
+ Files.copy(Main.class.getResourceAsStream("/profile.json"), versionJson.toPath(), StandardCopyOption.REPLACE_EXISTING);
+
+ try {
+ File profilesJson = new File(minecraftFolder, "launcher_profiles.json");
+ if (profilesJson.exists()) { // TODO: use gson instead
+ String identifier = "\"bbor-@MC_VERSION@\"";
+ String contents = new String(Files.readAllBytes(profilesJson.toPath()));
+ if (contents.contains(identifier)) {
+ contents = contents.replaceAll(",\n *" + identifier + ": \\{[^}]*},", ",");
+ contents = contents.replaceAll(",?\n *" + identifier + ": \\{[^}]*},?", "");
+ }
+
+ String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+
+ contents = contents.replace("\n \"profiles\": {", "\n \"profiles\": {\n" +
+ " " + identifier + ": {\n" +
+ " \"name\": \"Bounding Box Outline Reloaded\",\n" +
+ " \"type\": \"custom\",\n" +
+ " \"created\": \"" + date + "T00:00:00.000Z\",\n" +
+ " \"lastUsed\": \"2100-01-01T00:00:00.000Z\",\n" +
+ " \"lastVersionId\": \"BBOR-@VERSION@\"\n" +
+ " },");
+
+ Files.write(profilesJson.toPath(), contents.getBytes());
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ // Copy rift jar to libraries
+ try {
+ String source = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
+ if (source.startsWith("/") && osName.contains("win")) {
+ source = source.substring(1);
+ }
+ File riftJar = new File(minecraftFolder, "libraries/com/irtimaled/bbor/@VERSION@/bbor-@VERSION@.jar");
+ riftJar.getParentFile().mkdirs();
+ Files.copy(Paths.get(source), riftJar.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ JOptionPane.showMessageDialog(null,
+ "Bounding Box Outline Reloaded @VERSION@ has been successfully installed!\n" +
+ "\n" +
+ "Re-open the Minecraft Launcher to see it in the dropdown.",
+ "Bounding Box Outline Reloaded Installer", JOptionPane.INFORMATION_MESSAGE);
+ } catch (Throwable t) {
+ StringWriter w = new StringWriter();
+ t.printStackTrace(new PrintWriter(w));
+ JOptionPane.showMessageDialog(null,
+ "An error occured while installing Bounding Box Outline Reloaded, please report this to the issue\n" +
+ "tracker (https://github.com/irtimaled/BoundingBoxOutlineReloaded/issues):\n" +
+ "\n" +
+ w.toString().replace("\t", " "), "Bounding Box Outline Reloaded Installer", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ private static File getMinecraftFolder(String osName) {
+ File minecraftFolder;
+ if (osName.contains("win")) {
+ minecraftFolder = new File(System.getenv("APPDATA") + "/.minecraft");
+ } else if (osName.contains("mac")) {
+ minecraftFolder = new File(System.getProperty("user.home") + "/Library/Application Support/minecraft");
+ } else {
+ minecraftFolder = new File(System.getProperty("user.home") + "/.minecraft");
+ }
+ return minecraftFolder;
+ }
+
+ private static String getOsName() {
+ return System.getProperty("os.name").toLowerCase(Locale.ROOT);
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.launch;
+
+import java.io.File;
+import java.util.List;
+
+public class ClientTweaker extends Tweaker {
+ @Override
+ protected void addOptions(List<String> args, File gameDir, File assetsDir, String profile) {
+ addArg("--assetsDir", assetsDir.getPath());
+ }
+
+ @Override
+ public String getLaunchTarget() {
+ return "net.minecraft.client.main.Main";
+ }
+
+ @Override
+ protected boolean isClient() {
+ return true;
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.launch;
+
+public class ServerTweaker extends Tweaker {
+ @Override
+ protected boolean isClient() {
+ return false;
+ }
+
+ @Override
+ public String getLaunchTarget() {
+ return "net.minecraft.server.MinecraftServer";
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.launch;
+
+import net.minecraft.launchwrapper.ITweaker;
+import net.minecraft.launchwrapper.LaunchClassLoader;
+import org.spongepowered.asm.launch.MixinBootstrap;
+import org.spongepowered.asm.mixin.MixinEnvironment;
+import org.spongepowered.asm.mixin.Mixins;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class Tweaker implements ITweaker {
+ public List<String> args;
+
+ @Override
+ public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
+ this.args = new ArrayList<>(args);
+ addArg("--version", profile);
+ addOptions(args, gameDir, assetsDir, profile);
+ }
+
+ protected void addArg(String name, String value) {
+ args.add(name);
+ if (value != null) {
+ args.add(value);
+ }
+ }
+
+ protected void addOptions(List<String> args, File gameDir, File assetsDir, String profile) {
+ }
+
+ @Override
+ public void injectIntoClassLoader(LaunchClassLoader classLoader) {
+ MixinBootstrap.init();
+ Mixins.addConfiguration("mixins.bbor.json");
+ MixinEnvironment.getDefaultEnvironment().setSide(isClient() ? MixinEnvironment.Side.CLIENT : MixinEnvironment.Side.SERVER);
+
+ }
+
+ protected abstract boolean isClient();
+
+ @Override
+ public String[] getLaunchArguments() {
+ return args.toArray(new String[0]);
+ }
+}
+++ /dev/null
-package com.irtimaled.bbor.litemod;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import com.mumfrey.liteloader.Tickable;
-import net.minecraft.client.Minecraft;
-
-import java.io.File;
-
-public class LiteMod implements Tickable {
- public LiteMod() {
- }
-
- @Override
- public String getName() {
- return "BoundingBoxOutlineReloaded";
- }
-
- @Override
- public String getVersion() {
- return "1.0.1";
- }
-
- @Override
- public void init(File configPath) {
- BoundingBoxOutlineReloaded.init();
- }
-
- @Override
- public void upgradeSettings(String version, File configPath, File oldConfigPath) {
- }
-
- @Override
- public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
- BoundingBoxOutlineReloaded.keyPressed();
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import net.minecraft.world.chunk.Chunk;
-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(Chunk.class)
-public abstract class MixinChunk {
- @Inject(method = "onLoad",
- at = @At("RETURN"))
- private void onLoaded(CallbackInfo ci) {
- BoundingBoxOutlineReloaded.chunkLoaded((Chunk)(Object)this);
- }
-}
\ No newline at end of file
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import com.mumfrey.liteloader.client.overlays.IEntityRenderer;
-import net.minecraft.client.renderer.EntityRenderer;
-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 abstract class MixinEntityRenderer implements IEntityRenderer {
- @Inject(method = "renderWorldPass",
- at = @At(shift = At.Shift.BEFORE,
- value = "INVOKE_STRING",
- target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
- args = "ldc=hand"))
- private void onRenderHand(int pass, float partialTicks, long timeSlice, CallbackInfo ci) {
- BoundingBoxOutlineReloaded.render(partialTicks);
- }
-}
\ No newline at end of file
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.integrated.IntegratedServer;
-import net.minecraft.world.World;
-import net.minecraft.world.WorldType;
-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(IntegratedServer.class)
-public abstract class MixinIntegratedServer extends MinecraftServer {
- public MixinIntegratedServer() {
- super(null, null, null, null, null, null, null);
- }
-
- @Inject(method = "loadAllWorlds",
- at = @At("RETURN"),
- remap = false)
- private void onLoadAllWorlds(String saveName, String worldNameIn, long seed, WorldType type, String generatorOptions, CallbackInfo ci) {
- for (World world : this.worlds) {
- BoundingBoxOutlineReloaded.worldLoaded(world);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import net.minecraft.client.resources.I18n;
-import net.minecraft.client.settings.KeyBinding;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Overwrite;
-import org.spongepowered.asm.mixin.Shadow;
-
-import java.util.Map;
-
-@Mixin(KeyBinding.class)
-public abstract class MixinKeyBinding implements Comparable<KeyBinding> {
- @Shadow
- private static Map<String, Integer> CATEGORY_ORDER;
-
- @Shadow
- private String keyDescription;
-
- @Shadow
- private String keyCategory;
-
- @Overwrite()
- public int compareTo(KeyBinding p_compareTo_1_) {
- return this.keyCategory.equals(p_compareTo_1_.getKeyCategory()) ? I18n.format(this.keyDescription).compareTo(I18n.format(p_compareTo_1_.getKeyDescription())) : ((Integer) CATEGORY_ORDER.getOrDefault(this.keyCategory, 0)).compareTo(CATEGORY_ORDER.getOrDefault(p_compareTo_1_.getKeyCategory(), 0));
- }
-}
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.login.client.CPacketLoginStart;
-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(NetworkManager.class)
-public abstract class MixinNetworkManager {
- @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V",
- at = @At("RETURN"))
- private void onLoaded(Packet<?> packetIn, CallbackInfo ci) {
- if (packetIn instanceof CPacketLoginStart) {
- BoundingBoxOutlineReloaded.playerConnectedToServer((NetworkManager)(Object)this);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-package com.irtimaled.bbor.litemod.mixins;
-
-import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.world.World;
-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(WorldClient.class)
-public abstract class MixinWorldClient extends World {
- public MixinWorldClient() {
- super(null, null, null, null, true);
- }
-
- @Inject(method = "sendQuittingDisconnectingPacket",
- at = @At("RETURN"))
- private void onDisconnecting(CallbackInfo ci) {
- BoundingBoxOutlineReloaded.playerDisconnectedFromServer();
- }
-}
--- /dev/null
+package com.irtimaled.bbor.mixin.client;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.client.Minecraft;
+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(Minecraft.class)
+public class MixinMinecraft {
+ @Inject(method = "init", at = @At("RETURN"))
+ private void init(CallbackInfo ci) {
+ BoundingBoxOutlineReloaded.init();
+ }
+
+ @Inject(method = "processKeyBinds", at = @At("HEAD"))
+ public void processKeyBinds(CallbackInfo ci) {
+ BoundingBoxOutlineReloaded.keyPressed();
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.irtimaled.bbor.mixin.client.multiplayer;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.client.multiplayer.WorldClient;
+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(WorldClient.class)
+public class MixinWorldClient {
+ @Inject(method="sendQuittingDisconnectingPacket", at=@At("RETURN"))
+ private void sendQuittingDisconnectingPacket(CallbackInfo ci)
+ {
+ BoundingBoxOutlineReloaded.playerDisconnectedFromServer();
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.mixin.client.renderer;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.client.renderer.EntityRenderer;
+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 {
+ @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);
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.mixin.client.settings;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.client.GameSettings;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.KeyBinding;
+import org.apache.commons.lang3.ArrayUtils;
+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.io.File;
+
+@Mixin(GameSettings.class)
+public class MixinGameSettings {
+ @Shadow private KeyBinding[] keyBindings;
+
+ @Inject(method = "<init>()V", at = @At("RETURN"))
+ private void init(CallbackInfo ci) {
+ keyBindings = getKeysAll();
+ }
+
+ private KeyBinding[] getKeysAll() {
+ return ArrayUtils.addAll(keyBindings, BoundingBoxOutlineReloaded.ActiveHotKey, BoundingBoxOutlineReloaded.OuterBoxOnlyHotKey);
+ }
+
+ @Inject(method = "<init>(Lnet/minecraft/client/Minecraft;Ljava/io/File;)V", at = @At("RETURN"))
+ private void init(Minecraft minecraft, File file, CallbackInfo ci) {
+ keyBindings = getKeysAll();
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.irtimaled.bbor.mixin.client.settings;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.client.settings.KeyBinding;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+
+import java.util.Map;
+
+@Mixin(KeyBinding.class)
+public class MixinKeyBinding {
+ @Shadow private static Map<String, Integer> CATEGORY_ORDER;
+
+ static {
+ CATEGORY_ORDER.put(BoundingBoxOutlineReloaded.KeyCategory, 0);
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.irtimaled.bbor.mixin.network;
+
+import io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+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(NetworkManager.class)
+public class MixinNetworkManager {
+ @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", at= @At("RETURN"))
+ public void sendPacket(Packet<?> packetIn, GenericFutureListener<?> listener, CallbackInfo ci) {
+ if (packetIn instanceof net.minecraft.network.login.client.CPacketLoginStart) {
+ com.irtimaled.bbor.client.BoundingBoxOutlineReloaded.playerConnectedToServer((NetworkManager) (Object) this);
+ }
+ }
+
+}
--- /dev/null
+package com.irtimaled.bbor.mixin.server;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+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;
+
+@Mixin(MinecraftServer.class)
+public class MixinMinecraftServer {
+ @Shadow public WorldServer[] worlds;
+
+ @Inject(method = "initialWorldChunkLoad", at = @At("HEAD"))
+ private void initialWorldChunkLoad(CallbackInfo ci)
+ {
+ for(World world : worlds) {
+ BoundingBoxOutlineReloaded.worldLoaded(world);
+ }
+ }
+}
--- /dev/null
+package com.irtimaled.bbor.mixin.world.chunk;
+
+import com.irtimaled.bbor.client.BoundingBoxOutlineReloaded;
+import net.minecraft.world.chunk.Chunk;
+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(Chunk.class)
+public class MixinChunk {
+ @Inject(method = "onLoad", at = @At("RETURN"))
+ private void onLoad(CallbackInfo ci) {
+ BoundingBoxOutlineReloaded.chunkLoaded((Chunk) (Object) this);
+ }
+}
\ No newline at end of file
+++ /dev/null
-{
- "name": "bbor",
- "displayName": "BoundingBoxOutlineReloaded",
- "description": "Shows the bounding boxes of structures and features.",
- "version": "1.0.1",
- "author": "irtimaled",
- "mcversion": "1.12.1",
- "mixinConfigs": [
- "mixins.bbor.json"
- ]
-}
+++ /dev/null
-[
-{
- "modid": "bbor",
- "name": "Bounding Box Outline Reloaded",
- "description": "Shows the bounding boxes of structures and features.",
- "version": "${version}",
- "mcversion": "${mcversion}",
- "url": "http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2345401",
- "updateUrl": "",
- "authorList": ["irtimaled"],
- "credits": "Thanks to 4poc & KaboPC.",
- "logoFile": "",
- "screenshots": [],
- "dependencies": []
-}
-]
-
{
"required": true,
- "minVersion": "0.7.3",
+ "minVersion": "0.7.11",
"compatibilityLevel": "JAVA_8",
"target": "@env(DEFAULT)",
- "package": "com.irtimaled.bbor.litemod.mixins",
+ "package": "com.irtimaled.bbor.mixin",
"refmap": "mixins.bbor.refmap.json",
"mixins": [
- "MixinIntegratedServer",
- "MixinEntityRenderer",
- "MixinChunk",
- "MixinNetworkManager",
- "MixinWorldClient",
- "MixinKeyBinding"
+ "world.chunk.MixinChunk",
+ "network.MixinNetworkManager",
+ "server.MixinMinecraftServer"
],
- "injectors": {
- "defaultRequire": 1
- }
+ "client": [
+ "client.MixinMinecraft",
+ "client.renderer.MixinEntityRenderer",
+ "client.multiplayer.MixinWorldClient",
+ "client.settings.MixinKeyBinding",
+ "client.settings.MixinGameSettings"
+ ]
}
+++ /dev/null
-{
- "mappings": {
- "com/irtimaled/bbor/litemod/mixins/MixinIntegratedServer": {
- "loadAllWorlds": "Lchd;a(Ljava/lang/String;Ljava/lang/String;JLamz;Ljava/lang/String;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinNetworkManager": {
- "sendPacket(Lnet/minecraft/network/Packet;)V": "Lgw;a(Lht;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinEntityRenderer": {
- "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V": "Lrl;c(Ljava/lang/String;)V",
- "renderWorldPass": "Lbuq;a(IFJ)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinWorldClient": {
- "sendQuittingDisconnectingPacket": "Lbsb;O()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinChunk": {
- "onLoad": "Laxw;c()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinKeyBinding": {
- "compareTo": "Lbhy;a(Lbhy;)I"
- }
- },
- "data": {
- "notch": {
- "com/irtimaled/bbor/litemod/mixins/MixinIntegratedServer": {
- "loadAllWorlds": "Lchd;a(Ljava/lang/String;Ljava/lang/String;JLamz;Ljava/lang/String;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinNetworkManager": {
- "sendPacket(Lnet/minecraft/network/Packet;)V": "Lgw;a(Lht;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinEntityRenderer": {
- "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V": "Lrl;c(Ljava/lang/String;)V",
- "renderWorldPass": "Lbuq;a(IFJ)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinWorldClient": {
- "sendQuittingDisconnectingPacket": "Lbsb;O()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinChunk": {
- "onLoad": "Laxw;c()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinKeyBinding": {
- "compareTo": "Lbhy;a(Lbhy;)I"
- }
- },
- "searge": {
- "com/irtimaled/bbor/litemod/mixins/MixinIntegratedServer": {
- "loadAllWorlds": "Lnet/minecraft/server/integrated/IntegratedServer;func_71247_a(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Ljava/lang/String;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinNetworkManager": {
- "sendPacket(Lnet/minecraft/network/Packet;)V": "Lnet/minecraft/network/NetworkManager;func_179290_a(Lnet/minecraft/network/Packet;)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinEntityRenderer": {
- "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V": "Lnet/minecraft/profiler/Profiler;func_76318_c(Ljava/lang/String;)V",
- "renderWorldPass": "Lnet/minecraft/client/renderer/EntityRenderer;func_175068_a(IFJ)V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinWorldClient": {
- "sendQuittingDisconnectingPacket": "Lnet/minecraft/client/multiplayer/WorldClient;func_72882_A()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinChunk": {
- "onLoad": "Lnet/minecraft/world/chunk/Chunk;func_76631_c()V"
- },
- "com/irtimaled/bbor/litemod/mixins/MixinKeyBinding": {
- "compareTo": "Lnet/minecraft/client/settings/KeyBinding;compareTo(Lnet/minecraft/client/settings/KeyBinding;)I"
- }
- }
- }
-}
+++ /dev/null
-{
- "pack": {
- "description": "bbor resources",
- "pack_format": 3,
- "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)."
- }
-}
--- /dev/null
+{
+ "inheritsFrom": "${mcVersion}",
+ "id": "BBOR-${version}",
+ "jar": "${mcVersion}",
+ "time": "${formattedTime}",
+ "type": "release",
+ "arguments": {
+ "game": [
+ "--tweakClass",
+ "${tweakClass}"
+ ]
+ },
+ "mainClass": "net.minecraft.launchwrapper.Launch",
+ "libraries": [
+ {
+ "name": "com.irtimaled:bbor:${version}"
+ },
+ {
+ "name": "org.spongepowered:mixin:0.7.11-SNAPSHOT",
+ "url": "https://github.com/irtimaled/Mixin/releases/download/"
+ },
+ {
+ "name": "org.ow2.asm:asm:6.2",
+ "url": "http://repo1.maven.org/maven2/"
+ },
+ {
+ "name": "org.ow2.asm:asm-commons:6.2",
+ "url": "http://repo1.maven.org/maven2/"
+ },
+ {
+ "name": "net.minecraft:launchwrapper:1.12"
+ }
+ ]
+}
\ No newline at end of file