diff --git a/build.gradle b/build.gradle index 9ceb5abe..ca430aa3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1671313514 +//version: 1674409054 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -144,6 +144,7 @@ propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeRelations", "") +propertyDefaultIfUnset("minimizeShadowedDependencies", true) String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -319,9 +320,17 @@ if (file('addon.gradle').exists()) { apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored - implementation.extendsFrom(shadowCompile) - implementation.extendsFrom(shadeCompile) + // TODO: remove Compile after all uses are refactored to Implementation + for (config in [ + shadowImplementation, + shadowCompile, + shadeCompile + ]) { + compileClasspath.extendsFrom(config) + runtimeClasspath.extendsFrom(config) + testCompileClasspath.extendsFrom(config) + testRuntimeClasspath.extendsFrom(config) + } } repositories { @@ -350,7 +359,8 @@ dependencies { annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor') if (usesMixinDebug.toBoolean()) { - runtimeOnly('org.jetbrains:intellij-fernflower:1.2.1.16') + runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') + testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { @@ -406,7 +416,9 @@ shadowJar { attributes(getManifestAttributes()) } - minimize() // This will only allow shading for actually used classes + if (minimizeShadowedDependencies.toBoolean()) { + minimize() // This will only allow shading for actually used classes + } configurations = [ project.configurations.shadowImplementation, project.configurations.shadowCompile @@ -549,7 +561,9 @@ task shadowDevJar(type: ShadowJar) { attributes(getManifestAttributes()) } - minimize() // This will only allow shading for actually used classes + if (minimizeShadowedDependencies.toBoolean()) { + minimize() // This will only allow shading for actually used classes + } configurations = [ project.configurations.shadowImplementation, project.configurations.shadowCompile diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradlew b/gradlew index 83f2acfd..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ 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 @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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 @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $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" ;; + 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 @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9618d8d9..107acd32 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/java/crazypants/enderio/api/teleport/TravelSource.java b/src/main/java/crazypants/enderio/api/teleport/TravelSource.java index c6a59685..7cd6ec31 100644 --- a/src/main/java/crazypants/enderio/api/teleport/TravelSource.java +++ b/src/main/java/crazypants/enderio/api/teleport/TravelSource.java @@ -38,28 +38,28 @@ public enum TravelSource { } }, - TELEPORT_STAFF() { - @Override - public int getMaxDistanceTravelled() { - return Config.teleportStaffMaxDistance; - } + TELEPORT_STAFF() { + @Override + public int getMaxDistanceTravelled() { + return Config.teleportStaffMaxDistance; + } - @Override - public float getPowerCostPerBlockTraveledRF() { - return 0f; - } - }, - TELEPORT_STAFF_BLINK() { - @Override - public int getMaxDistanceTravelled() { - return Config.teleportStaffMaxBlinkDistance; - } + @Override + public float getPowerCostPerBlockTraveledRF() { + return 0f; + } + }, + TELEPORT_STAFF_BLINK() { + @Override + public int getMaxDistanceTravelled() { + return Config.teleportStaffMaxBlinkDistance; + } - @Override - public float getPowerCostPerBlockTraveledRF() { - return 0f; - } - }, + @Override + public float getPowerCostPerBlockTraveledRF() { + return 0f; + } + }, TELEPAD(EnderIO.DOMAIN + ":telepad.teleport"); public static int getMaxDistance() { @@ -76,9 +76,9 @@ public enum TravelSource { TravelSource source = TravelController.instance.getTravelItemTravelSource(player); if (source == null) { - return TravelSource.BLOCK.getMaxDistanceTravelledSq(); + return TravelSource.BLOCK.getMaxDistanceTravelledSq(); } else { - return source.getMaxDistanceTravelledSq(); + return source.getMaxDistanceTravelledSq(); } } diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 9a846a33..0d524344 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -157,7 +157,6 @@ public final class Config { public static float travelAnchorZoomScale = 0.2f; public static boolean travelStaffSearchOptimize = true; - /** The max distance for travelling to a Travel Anchor. */ public static int teleportStaffMaxDistance = 2048; /** The max distance for travelling to player look. */ diff --git a/src/main/java/crazypants/enderio/teleport/ItemTeleportStaff.java b/src/main/java/crazypants/enderio/teleport/ItemTeleportStaff.java index 5ea13e8c..3875cd0d 100644 --- a/src/main/java/crazypants/enderio/teleport/ItemTeleportStaff.java +++ b/src/main/java/crazypants/enderio/teleport/ItemTeleportStaff.java @@ -6,16 +6,11 @@ import cpw.mods.fml.relauncher.SideOnly; import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.api.teleport.TravelSource; -import crazypants.enderio.machine.power.PowerDisplayUtil; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - public class ItemTeleportStaff extends ItemInfiniteTravelStaff { protected ItemTeleportStaff() { @@ -52,7 +47,7 @@ public class ItemTeleportStaff extends ItemInfiniteTravelStaff { if (world.isRemote) { if (player.isSneaking()) { TravelController.instance.activateTravelAccessable( - equipped, world, player, TravelSource.TELEPORT_STAFF); + equipped, world, player, TravelSource.TELEPORT_STAFF); } else { TravelController.instance.doTeleport(player); } diff --git a/src/main/java/crazypants/enderio/teleport/TravelController.java b/src/main/java/crazypants/enderio/teleport/TravelController.java index 4d95ecf3..109cb185 100644 --- a/src/main/java/crazypants/enderio/teleport/TravelController.java +++ b/src/main/java/crazypants/enderio/teleport/TravelController.java @@ -36,7 +36,7 @@ import java.util.Optional; import java.util.Random; import java.util.Set; import java.util.TreeMap; - +import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; @@ -55,8 +55,6 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; -import javax.annotation.Nullable; - public class TravelController { public static final TravelController instance = new TravelController(); @@ -116,10 +114,10 @@ public class TravelController { public boolean activateTravelAccessable(ItemStack equipped, World world, EntityPlayer player, TravelSource source) { if (!hasTarget()) { - PacketLongDistanceTravelEvent p = new PacketLongDistanceTravelEvent(player, false, source); - PacketHandler.INSTANCE.sendToServer(p); - // We have no way of knowing if it will succeed, so just return false. - return false; + PacketLongDistanceTravelEvent p = new PacketLongDistanceTravelEvent(player, false, source); + PacketHandler.INSTANCE.sendToServer(p); + // We have no way of knowing if it will succeed, so just return false. + return false; } BlockCoord target = selectedCoord; TileEntity te = world.getTileEntity(target.x, target.y, target.z); @@ -232,113 +230,110 @@ public class TravelController { return false; } - /** This is the teleport staff super-teleport. */ - public boolean doTeleport(EntityPlayer player) { - TravelSource source = TravelSource.TELEPORT_STAFF_BLINK; + /** This is the teleport staff super-teleport. */ + public boolean doTeleport(EntityPlayer player) { + TravelSource source = TravelSource.TELEPORT_STAFF_BLINK; - Vector3d eye = Util.getEyePositionEio(player); - Vector3d look = Util.getLookVecEio(player); + Vector3d eye = Util.getEyePositionEio(player); + Vector3d look = Util.getLookVecEio(player); - double playerHeight = player.yOffset; - // +2 to compensate for the standard distance decrement of -2 - double teleDistance = Config.teleportStaffFailedBlinkDistance + 2; - Vec3 eye3 = Vec3.createVectorHelper(eye.x, eye.y, eye.z); + double playerHeight = player.yOffset; + // +2 to compensate for the standard distance decrement of -2 + double teleDistance = Config.teleportStaffFailedBlinkDistance + 2; + Vec3 eye3 = Vec3.createVectorHelper(eye.x, eye.y, eye.z); - // rayTraceBlocks has a limit of 200 distance. - double maxDistance = Config.teleportStaffMaxBlinkDistance; - double currDistance = 0; - Vec3 pos = eye3; - boolean loop = true; - while (loop) { - double distance = 200; - if (maxDistance - currDistance < 200) { - distance = maxDistance - currDistance; - loop = false; - } + // rayTraceBlocks has a limit of 200 distance. + double maxDistance = Config.teleportStaffMaxBlinkDistance; + double currDistance = 0; + Vec3 pos = eye3; + boolean loop = true; + while (loop) { + double distance = 200; + if (maxDistance - currDistance < 200) { + distance = maxDistance - currDistance; + loop = false; + } - Vector3d sample = new Vector3d(look); - sample.scale(distance); - sample.add(eye); - Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z); + Vector3d sample = new Vector3d(look); + sample.scale(distance); + sample.add(eye); + Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z); - MovingObjectPosition p = - player.worldObj.rayTraceBlocks(pos, end, !Config.travelStaffBlinkThroughClearBlocksEnabled); - if (p != null) { - teleDistance = - VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5)); - break; - } + MovingObjectPosition p = + player.worldObj.rayTraceBlocks(pos, end, !Config.travelStaffBlinkThroughClearBlocksEnabled); + if (p != null) { + teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5)); + break; + } - pos = end; - currDistance += distance; + pos = end; + currDistance += distance; + } + + Vector3d sample = new Vector3d(look); + sample.scale(Config.teleportStaffMaxBlinkDistance); + sample.add(eye); + Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z); + MovingObjectPosition p = + player.worldObj.rayTraceBlocks(eye3, end, !Config.travelStaffBlinkThroughClearBlocksEnabled); + if (p != null) { + teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5)); + } + + double distanceIncrement = -2; + // Special case: if the targeted block is too close, we'll try to teleport through it. + if (teleDistance < 3) { + distanceIncrement = 2; + } + + for (int i = 0; i < 8; i++) { + teleDistance += distanceIncrement; + + sample.set(look); + sample.scale(teleDistance); + sample.add(eye); + // we test against our feets location + sample.y -= playerHeight; + + if (doBlinkAround(player, source, sample, false)) { + return true; + } + } + return false; } - Vector3d sample = new Vector3d(look); - sample.scale(Config.teleportStaffMaxBlinkDistance); - sample.add(eye); - Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z); - MovingObjectPosition p = - player.worldObj.rayTraceBlocks(eye3, end, !Config.travelStaffBlinkThroughClearBlocksEnabled); - if (p != null) { - teleDistance = - VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5)); + /** Returns empty optional if no travel destination was found. */ + public Optional findTravelDestination(EntityPlayer player, TravelSource source) { + Vector3d eye = Util.getEyePositionEio(player); + Vector3d look = Util.getLookVecEio(player); + + // Map of distance to coordinate for eligible travel destinations (within angle). + Map distanceMap = new TreeMap<>(); + boolean outOfRange = false; + for (BlockCoord p : travelDestinations) { + Vector3d block = new Vector3d(p.x + 0.5, p.y + 0.5, p.z + 0.5); + block.sub(eye); + double distance = block.length(); + if (distance > source.getMaxDistanceTravelled()) { + outOfRange = true; + continue; + } + block.normalize(); + + double angle = Math.acos(look.dot(block)); + // Roughly 5 degrees + if (angle < 0.087) { + distanceMap.put(distance, p); + } + } + + if (outOfRange && distanceMap.isEmpty()) { + player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange")); + } + + return distanceMap.values().stream().findFirst(); } - double distanceIncrement = -2; - // Special case: if the targeted block is too close, we'll try to teleport through it. - if (teleDistance < 3) { - distanceIncrement = 2; - } - - for (int i = 0; i < 8; i++) { - teleDistance += distanceIncrement; - - sample.set(look); - sample.scale(teleDistance); - sample.add(eye); - // we test against our feets location - sample.y -= playerHeight; - - if (doBlinkAround(player, source, sample, false)) { - return true; - } - } - return false; - } - - /** Returns empty optional if no travel destination was found. */ - public Optional findTravelDestination(EntityPlayer player, TravelSource source) { - Vector3d eye = Util.getEyePositionEio(player); - Vector3d look = Util.getLookVecEio(player); - - // Map of distance to coordinate for eligible travel destinations (within angle). - Map distanceMap = new TreeMap<>(); - boolean outOfRange = false; - for (BlockCoord p : travelDestinations) { - Vector3d block = new Vector3d(p.x + 0.5, p.y + 0.5, p.z + 0.5); - block.sub(eye); - double distance = block.length(); - if (distance > source.getMaxDistanceTravelled()) { - outOfRange = true; - continue; - } - block.normalize(); - - double angle = Math.acos(look.dot(block)); - // Roughly 5 degrees - if (angle < 0.087) { - distanceMap.put(distance, p); - } - } - - if (outOfRange && distanceMap.isEmpty()) { - player.addChatComponentMessage( - new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange")); - } - - return distanceMap.values().stream().findFirst(); - } - private boolean isBlackListedBlock(EntityPlayer player, MovingObjectPosition pos, Block hitBlock) { UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor(hitBlock); if (ui == null) { @@ -349,8 +344,7 @@ public class TravelController { || !Config.travelStaffBlinkThroughUnbreakableBlocksEnabled); } - private boolean doBlinkAround( - EntityPlayer player, TravelSource source, Vector3d sample, boolean conserveMomentum) { + private boolean doBlinkAround(EntityPlayer player, TravelSource source, Vector3d sample, boolean conserveMomentum) { if (travelToLocation( player, source, @@ -542,24 +536,24 @@ public class TravelController { return getTravelItemTravelSource(ep) != null; } - /** Returns null if no travel item is equipped. */ - @Nullable - public TravelSource getTravelItemTravelSource(EntityPlayer ep) { - if (ep == null || ep.getCurrentEquippedItem() == null) { - return null; + /** Returns null if no travel item is equipped. */ + @Nullable + public TravelSource getTravelItemTravelSource(EntityPlayer ep) { + if (ep == null || ep.getCurrentEquippedItem() == null) { + return null; + } + ItemStack equipped = ep.getCurrentEquippedItem(); + if (equipped.getItem() instanceof ItemTravelStaff) { + if (((ItemTravelStaff) equipped.getItem()).isActive(ep, equipped)) { + return TravelSource.TELEPORT_STAFF; + } + } else if (equipped.getItem() instanceof IItemOfTravel) { + if (((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) { + return TravelSource.STAFF; + } + } + return null; } - ItemStack equipped = ep.getCurrentEquippedItem(); - if (equipped.getItem() instanceof ItemTravelStaff) { - if (((ItemTravelStaff) equipped.getItem()).isActive(ep, equipped)) { - return TravelSource.TELEPORT_STAFF; - } - } else if (equipped.getItem() instanceof IItemOfTravel) { - if (((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) { - return TravelSource.STAFF; - } - } - return null; - } public boolean travelToSelectedTarget(EntityPlayer player, TravelSource source, boolean conserveMomentum) { return travelToLocation(player, source, selectedCoord, conserveMomentum); @@ -900,7 +894,7 @@ public class TravelController { private int getMaxTravelDistanceSqForPlayer(EntityPlayer player) { TravelSource source = getTravelItemTravelSource(player); if (source == null) { - return TravelSource.BLOCK.getMaxDistanceTravelledSq(); + return TravelSource.BLOCK.getMaxDistanceTravelledSq(); } return source.getMaxDistanceTravelledSq(); } diff --git a/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java b/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java index 6df58642..e781240a 100644 --- a/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java +++ b/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java @@ -62,8 +62,10 @@ public class BlockTravelAnchor extends BlockEio PacketHandler.INSTANCE.registerMessage( PacketTravelEvent.class, PacketTravelEvent.class, PacketHandler.nextID(), Side.SERVER); PacketHandler.INSTANCE.registerMessage( - PacketLongDistanceTravelEvent.class, PacketLongDistanceTravelEvent.class, - PacketHandler.nextID(), Side.SERVER); + PacketLongDistanceTravelEvent.class, + PacketLongDistanceTravelEvent.class, + PacketHandler.nextID(), + Side.SERVER); PacketHandler.INSTANCE.registerMessage( PacketDrainStaff.class, PacketDrainStaff.class, PacketHandler.nextID(), Side.SERVER); PacketHandler.INSTANCE.registerMessage( diff --git a/src/main/java/crazypants/enderio/teleport/anchor/TileTravelAnchor.java b/src/main/java/crazypants/enderio/teleport/anchor/TileTravelAnchor.java index 71b706c5..726e4584 100644 --- a/src/main/java/crazypants/enderio/teleport/anchor/TileTravelAnchor.java +++ b/src/main/java/crazypants/enderio/teleport/anchor/TileTravelAnchor.java @@ -331,23 +331,23 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable this.visible = visible; } - @Override - public void validate() { - super.validate(); - if (isTravelSource()) { - TravelController.instance.travelDestinations.add(getLocation()); + @Override + public void validate() { + super.validate(); + if (isTravelSource()) { + TravelController.instance.travelDestinations.add(getLocation()); + } } - } - @Override - public void invalidate() { - super.invalidate(); - TravelController.instance.travelDestinations.remove(getLocation()); - } + @Override + public void invalidate() { + super.invalidate(); + TravelController.instance.travelDestinations.remove(getLocation()); + } - @Override - public void onChunkUnload() { - super.onChunkUnload(); - TravelController.instance.travelDestinations.remove(getLocation()); - } + @Override + public void onChunkUnload() { + super.onChunkUnload(); + TravelController.instance.travelDestinations.remove(getLocation()); + } } diff --git a/src/main/java/crazypants/enderio/teleport/anchor/TravelEntitySpecialRenderer.java b/src/main/java/crazypants/enderio/teleport/anchor/TravelEntitySpecialRenderer.java index e2d4501c..218dde4f 100644 --- a/src/main/java/crazypants/enderio/teleport/anchor/TravelEntitySpecialRenderer.java +++ b/src/main/java/crazypants/enderio/teleport/anchor/TravelEntitySpecialRenderer.java @@ -66,10 +66,9 @@ public class TravelEntitySpecialRenderer extends TileEntitySpecialRenderer { Vector3d eye = Util.getEyePositionEio(Minecraft.getMinecraft().thePlayer); Vector3d loc = new Vector3d(tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5); double maxDistance = TravelSource.BLOCK.getMaxDistanceTravelledSq(); - TravelSource source = - TravelController.instance.getTravelItemTravelSource(Minecraft.getMinecraft().thePlayer); + TravelSource source = TravelController.instance.getTravelItemTravelSource(Minecraft.getMinecraft().thePlayer); if (source != null) { - maxDistance = source.getMaxDistanceTravelledSq(); + maxDistance = source.getMaxDistanceTravelledSq(); } if (eye.distanceSquared(loc) > maxDistance) { return; diff --git a/src/main/java/crazypants/enderio/teleport/packet/PacketLongDistanceTravelEvent.java b/src/main/java/crazypants/enderio/teleport/packet/PacketLongDistanceTravelEvent.java index d0c30447..0bb1bdb8 100644 --- a/src/main/java/crazypants/enderio/teleport/packet/PacketLongDistanceTravelEvent.java +++ b/src/main/java/crazypants/enderio/teleport/packet/PacketLongDistanceTravelEvent.java @@ -11,6 +11,7 @@ import crazypants.enderio.api.teleport.TeleportEntityEvent; import crazypants.enderio.api.teleport.TravelSource; import crazypants.enderio.teleport.TravelController; import io.netty.buffer.ByteBuf; +import java.util.Optional; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -18,9 +19,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.play.server.S12PacketEntityVelocity; import net.minecraftforge.common.MinecraftForge; -import java.util.Optional; - -public class PacketLongDistanceTravelEvent implements IMessage, IMessageHandler { +public class PacketLongDistanceTravelEvent + implements IMessage, IMessageHandler { boolean conserveMotion; int entityId; @@ -28,8 +28,7 @@ public class PacketLongDistanceTravelEvent implements IMessage, IMessageHandler< public PacketLongDistanceTravelEvent() {} - public PacketLongDistanceTravelEvent( - Entity entity, boolean conserveMotion, TravelSource source) { + public PacketLongDistanceTravelEvent(Entity entity, boolean conserveMotion, TravelSource source) { this.conserveMotion = conserveMotion; this.entityId = entity instanceof EntityPlayer ? -1 : entity.getEntityId(); this.source = source.ordinal(); @@ -62,13 +61,11 @@ public class PacketLongDistanceTravelEvent implements IMessage, IMessageHandler< return null; } - public static boolean doServerTeleport( - Entity toTp, boolean conserveMotion, TravelSource source) { + public static boolean doServerTeleport(Entity toTp, boolean conserveMotion, TravelSource source) { EntityPlayer player = toTp instanceof EntityPlayer ? (EntityPlayer) toTp : null; - Optional travelDestination = - TravelController.instance.findTravelDestination(player, source); + Optional travelDestination = TravelController.instance.findTravelDestination(player, source); if (!travelDestination.isPresent()) { - return false; + return false; } BlockCoord destination = travelDestination.get(); int x = destination.x; @@ -76,7 +73,7 @@ public class PacketLongDistanceTravelEvent implements IMessage, IMessageHandler< int z = destination.z; int powerUse = TravelController.instance.getRequiredPower(player, source, destination); if (powerUse < 0) { - return false; + return false; } TeleportEntityEvent evt = new TeleportEntityEvent(toTp, source, x, y, z); diff --git a/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java b/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java index c5d76c22..f3a882ec 100644 --- a/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java +++ b/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java @@ -324,7 +324,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei // this.inNetwork = pkt.func_148857_g().getBoolean("inNetwork"); } - @Override + @Override public void invalidate() { super.invalidate(); if (worldObj.isRemote) {