mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-10-26 14:24:40 +00:00
Add staff of teleportation (#89)
* Add teleport staff * Add support for long-range travel anchor teleportation * Update buildscript + apply spotless * Replace creative staff of travelling * Add missing mapping handler and fix extract energy
This commit is contained in:
1 parent
d9b99f6888
commit
0902a8956b
20 files changed
+467
-98
No files matched your search
+21
-7
@@ -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
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -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" "$@"
|
||||
Vendored
+7
-18
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
@@ -24,6 +25,7 @@ import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import crazypants.enderio.api.IMC;
|
||||
import crazypants.enderio.block.BlockDarkSteelAnvil;
|
||||
@@ -150,7 +152,7 @@ import crazypants.enderio.material.endergy.ItemAlloyEndergy;
|
||||
import crazypants.enderio.material.endergy.ItemGrindingBallEndergy;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.rail.BlockEnderRail;
|
||||
import crazypants.enderio.teleport.ItemInfiniteTravelStaff;
|
||||
import crazypants.enderio.teleport.ItemTeleportStaff;
|
||||
import crazypants.enderio.teleport.ItemTravelStaff;
|
||||
import crazypants.enderio.teleport.TeleportRecipes;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
@@ -229,7 +231,7 @@ public class EnderIO {
|
||||
public static BlockTelePad blockTelePad;
|
||||
public static ItemCoordSelector itemCoordSelector;
|
||||
public static ItemTravelStaff itemTravelStaff;
|
||||
public static ItemInfiniteTravelStaff itemInfiniteTravelStaff;
|
||||
public static ItemTeleportStaff itemTeleportStaff;
|
||||
|
||||
// Painter
|
||||
public static BlockPainter blockPainter;
|
||||
@@ -481,7 +483,7 @@ public class EnderIO {
|
||||
itemYetaWench = ItemYetaWrench.create();
|
||||
itemEnderface = ItemEnderface.create();
|
||||
itemTravelStaff = ItemTravelStaff.create();
|
||||
itemInfiniteTravelStaff = ItemInfiniteTravelStaff.create();
|
||||
itemTeleportStaff = ItemTeleportStaff.create();
|
||||
itemConduitProbe = ItemConduitProbe.create();
|
||||
|
||||
itemXpTransfer = ItemXpTransfer.create();
|
||||
@@ -883,4 +885,14 @@ public class EnderIO {
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
HyperCubeRegister.unload();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void remap(FMLMissingMappingsEvent event) {
|
||||
for (FMLMissingMappingsEvent.MissingMapping missingMapping : event.getAll()) {
|
||||
if (missingMapping.type == GameRegistry.Type.ITEM
|
||||
&& missingMapping.name.equals("EnderIO:itemInfiniteTravelStaff")) {
|
||||
missingMapping.remap(itemTeleportStaff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public enum ModObject {
|
||||
|
||||
itemEnderFood,
|
||||
|
||||
itemInfiniteTravelStaff;
|
||||
itemTeleportStaff;
|
||||
|
||||
public final String unlocalisedName;
|
||||
|
||||
|
||||
@@ -37,6 +37,29 @@ public enum TravelSource {
|
||||
return Config.travelStaffPowerPerBlockRF;
|
||||
}
|
||||
},
|
||||
|
||||
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;
|
||||
}
|
||||
},
|
||||
TELEPAD(EnderIO.DOMAIN + ":telepad.teleport");
|
||||
|
||||
public static int getMaxDistance() {
|
||||
@@ -51,9 +74,12 @@ public enum TravelSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return TravelController.instance.isTravelItemActive(player)
|
||||
? TravelSource.STAFF.getMaxDistanceTravelledSq()
|
||||
: TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
} else {
|
||||
return source.getMaxDistanceTravelledSq();
|
||||
}
|
||||
}
|
||||
|
||||
public final String sound;
|
||||
|
||||
@@ -157,6 +157,15 @@ 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. */
|
||||
public static int teleportStaffMaxBlinkDistance = 512;
|
||||
/**
|
||||
* The distance travelled when no block is found within {@link #teleportStaffMaxBlinkDistance}.
|
||||
*/
|
||||
public static int teleportStaffFailedBlinkDistance = 64;
|
||||
|
||||
public static int enderIoRange = 8;
|
||||
public static boolean enderIoMeAccessEnabled = true;
|
||||
|
||||
@@ -1181,6 +1190,27 @@ public final class Config {
|
||||
+ "This config is experimental, so if you encounter any strange behavior, please report to GTNH developer.")
|
||||
.getBoolean(travelStaffSearchOptimize);
|
||||
|
||||
teleportStaffMaxDistance = config.get(
|
||||
sectionStaff.name,
|
||||
"teleportStaffMaxDistance",
|
||||
teleportStaffMaxDistance,
|
||||
"Max number of blocks teleported when travelling to a Travel Anchor.")
|
||||
.getInt(teleportStaffMaxDistance);
|
||||
|
||||
teleportStaffMaxBlinkDistance = config.get(
|
||||
sectionStaff.name,
|
||||
"teleportStaffMaxBlinkDistance",
|
||||
teleportStaffMaxBlinkDistance,
|
||||
"Max number of blocks teleported when travelling to player look.")
|
||||
.getInt(teleportStaffMaxBlinkDistance);
|
||||
|
||||
teleportStaffFailedBlinkDistance = config.get(
|
||||
sectionStaff.name,
|
||||
"teleportStaffFailedBlinkDistance",
|
||||
teleportStaffFailedBlinkDistance,
|
||||
"Number of blocks teleported when no block is being looked at.")
|
||||
.getInt(teleportStaffFailedBlinkDistance);
|
||||
|
||||
enderIoRange = config.get(
|
||||
sectionEfficiency.name,
|
||||
"enderIoRange",
|
||||
|
||||
@@ -52,7 +52,7 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
}
|
||||
if (!Config.travelAnchorEnabled) {
|
||||
API.hideItem(new ItemStack(EnderIO.itemTravelStaff));
|
||||
API.hideItem(new ItemStack(EnderIO.itemInfiniteTravelStaff));
|
||||
API.hideItem(new ItemStack(EnderIO.itemTeleportStaff));
|
||||
}
|
||||
if (!Config.reinforcedObsidianEnabled) {
|
||||
API.hideItem(new ItemStack(EnderIO.blockReinforcedObsidian));
|
||||
|
||||
+30
-15
@@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
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 java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -14,15 +15,15 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemInfiniteTravelStaff extends ItemTravelStaff {
|
||||
public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
|
||||
protected ItemInfiniteTravelStaff() {
|
||||
protected ItemTeleportStaff() {
|
||||
super();
|
||||
setUnlocalizedName(ModObject.itemInfiniteTravelStaff.name());
|
||||
setUnlocalizedName(ModObject.itemTeleportStaff.name());
|
||||
}
|
||||
|
||||
public static ItemInfiniteTravelStaff create() {
|
||||
ItemInfiniteTravelStaff result = new ItemInfiniteTravelStaff();
|
||||
public static ItemTeleportStaff create() {
|
||||
ItemTeleportStaff result = new ItemTeleportStaff();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
@@ -31,12 +32,12 @@ public class ItemInfiniteTravelStaff extends ItemTravelStaff {
|
||||
if (ep == null || ep.getCurrentEquippedItem() == null) {
|
||||
return false;
|
||||
}
|
||||
return ep.getCurrentEquippedItem().getItem() == EnderIO.itemInfiniteTravelStaff;
|
||||
return ep.getCurrentEquippedItem().getItem() == EnderIO.itemTeleportStaff;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
GameRegistry.registerItem(this, ModObject.itemInfiniteTravelStaff.unlocalisedName);
|
||||
GameRegistry.registerItem(this, ModObject.itemTeleportStaff.unlocalisedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,12 +48,32 @@ public class ItemInfiniteTravelStaff extends ItemTravelStaff {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:itemInfiniteTravelStaff");
|
||||
itemIcon = IIconRegister.registerIcon("enderio:itemTeleportStaff");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack equipped, World world, EntityPlayer player) {
|
||||
if (world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
TravelController.instance.activateTravelAccessable(
|
||||
equipped, world, player, TravelSource.TELEPORT_STAFF);
|
||||
} else {
|
||||
TravelController.instance.doTeleport(player);
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
return equipped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
// Don't allow extracting energy.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extractInternal(ItemStack item, int powerUse) {
|
||||
return;
|
||||
// Do nothing, as we have infinite energy.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,10 +101,4 @@ public class ItemInfiniteTravelStaff extends ItemTravelStaff {
|
||||
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isEquipped(ep);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,19 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.enderface.TileEnderIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketLongDistanceTravelEvent;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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;
|
||||
@@ -52,6 +59,14 @@ public class TravelController {
|
||||
|
||||
public static final TravelController instance = new TravelController();
|
||||
|
||||
/**
|
||||
* Server-side only list of valid travel destinations (travel anchors and active telepads).
|
||||
*
|
||||
* <p>This is used by {@code PacketLongDistanceTravelEvent} to try to find travel destinations that
|
||||
* are out of client render range.
|
||||
*/
|
||||
public Set<BlockCoord> travelDestinations = new HashSet<>();
|
||||
|
||||
private Random rand = new Random();
|
||||
|
||||
private boolean wasJumping = false;
|
||||
@@ -99,6 +114,9 @@ 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;
|
||||
}
|
||||
BlockCoord target = selectedCoord;
|
||||
@@ -120,6 +138,8 @@ public class TravelController {
|
||||
}
|
||||
|
||||
public boolean doBlink(ItemStack equipped, EntityPlayer player) {
|
||||
TravelSource source = TravelSource.STAFF_BLINK;
|
||||
|
||||
Vector3d eye = Util.getEyePositionEio(player);
|
||||
Vector3d look = Util.getLookVecEio(player);
|
||||
|
||||
@@ -146,7 +166,7 @@ public class TravelController {
|
||||
sample.add(eye);
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
if (doBlinkAround(player, sample, true)) {
|
||||
if (doBlinkAround(player, source, sample, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +204,7 @@ public class TravelController {
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
if (doBlinkAround(player, sample, false)) {
|
||||
if (doBlinkAround(player, source, sample, false)) {
|
||||
return true;
|
||||
}
|
||||
teleDistance++;
|
||||
@@ -200,7 +220,7 @@ public class TravelController {
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
if (doBlinkAround(player, sample, false)) {
|
||||
if (doBlinkAround(player, source, sample, false)) {
|
||||
return true;
|
||||
}
|
||||
sampleDistance--;
|
||||
@@ -210,6 +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;
|
||||
|
||||
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);
|
||||
|
||||
// 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/** Returns empty optional if no travel destination was found. */
|
||||
public Optional<BlockCoord> 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<Double, BlockCoord> 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) {
|
||||
@@ -220,22 +344,25 @@ public class TravelController {
|
||||
|| !Config.travelStaffBlinkThroughUnbreakableBlocksEnabled);
|
||||
}
|
||||
|
||||
private boolean doBlinkAround(EntityPlayer player, Vector3d sample, boolean conserveMomentum) {
|
||||
if (doBlink(
|
||||
private boolean doBlinkAround(EntityPlayer player, TravelSource source, Vector3d sample, boolean conserveMomentum) {
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y), (int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
return true;
|
||||
}
|
||||
if (doBlink(
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y) + 1, (int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
return true;
|
||||
}
|
||||
if (!Config.travelStaffSearchOptimize) {
|
||||
if (doBlink(
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord(
|
||||
(int) Math.floor(sample.x), (int) Math.floor(sample.y) - 1, (int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
@@ -245,10 +372,6 @@ public class TravelController {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean doBlink(EntityPlayer player, BlockCoord coord, boolean conserveMomentum) {
|
||||
return travelToLocation(player, TravelSource.STAFF_BLINK, coord, conserveMomentum);
|
||||
}
|
||||
|
||||
public boolean showTargets() {
|
||||
return showTargets && selectionEnabled;
|
||||
}
|
||||
@@ -410,14 +533,26 @@ public class TravelController {
|
||||
}
|
||||
|
||||
public boolean isTravelItemActive(EntityPlayer ep) {
|
||||
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 false;
|
||||
return null;
|
||||
}
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
if (equipped.getItem() instanceof IItemOfTravel) {
|
||||
return ((IItemOfTravel) equipped.getItem()).isActive(ep, equipped);
|
||||
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 false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean travelToSelectedTarget(EntityPlayer player, TravelSource source, boolean conserveMomentum) {
|
||||
@@ -427,7 +562,7 @@ public class TravelController {
|
||||
public boolean travelToLocation(
|
||||
EntityPlayer player, TravelSource source, BlockCoord coord, boolean conserveMomentum) {
|
||||
|
||||
if (source != TravelSource.STAFF_BLINK) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
TileEntity te = player.worldObj.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
@@ -446,13 +581,13 @@ public class TravelController {
|
||||
}
|
||||
|
||||
if (!isInRangeTarget(player, coord, source.getMaxDistanceTravelledSq())) {
|
||||
if (source != TravelSource.STAFF_BLINK) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!isValidTarget(player, coord, source)) {
|
||||
if (source != TravelSource.STAFF_BLINK) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
player.addChatComponentMessage(
|
||||
new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
}
|
||||
@@ -515,7 +650,7 @@ public class TravelController {
|
||||
}
|
||||
World w = player.worldObj;
|
||||
BlockCoord baseLoc = bc;
|
||||
if (source != TravelSource.STAFF_BLINK) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
// targeting a block so go one up
|
||||
baseLoc = bc.getLocation(ForgeDirection.UP);
|
||||
}
|
||||
@@ -757,10 +892,11 @@ public class TravelController {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private int getMaxTravelDistanceSqForPlayer(EntityPlayer player) {
|
||||
if (isTravelItemActive(player)) {
|
||||
return TravelSource.STAFF.getMaxDistanceTravelledSq();
|
||||
TravelSource source = getTravelItemTravelSource(player);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
}
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
return source.getMaxDistanceTravelledSq();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -26,6 +26,7 @@ import crazypants.enderio.teleport.GuiTravelAuth;
|
||||
import crazypants.enderio.teleport.packet.PacketAccessMode;
|
||||
import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketLabel;
|
||||
import crazypants.enderio.teleport.packet.PacketLongDistanceTravelEvent;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketPassword;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
@@ -60,6 +61,11 @@ public class BlockTravelAnchor extends BlockEio
|
||||
PacketLabel.class, PacketLabel.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketTravelEvent.class, PacketTravelEvent.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketLongDistanceTravelEvent.class,
|
||||
PacketLongDistanceTravelEvent.class,
|
||||
PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketDrainStaff.class, PacketDrainStaff.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
|
||||
@@ -6,6 +6,7 @@ import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.api.teleport.ITravelAccessable;
|
||||
import crazypants.enderio.api.teleport.TravelSource;
|
||||
import crazypants.enderio.machine.painter.IPaintableTileEntity;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.util.UserIdent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -329,4 +330,24 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
@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 onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
TravelController.instance.travelDestinations.remove(getLocation());
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,11 @@ 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 = TravelController.instance.isTravelItemActive(Minecraft.getMinecraft().thePlayer)
|
||||
? TravelSource.STAFF.getMaxDistanceTravelledSq()
|
||||
: TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
double maxDistance = TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(Minecraft.getMinecraft().thePlayer);
|
||||
if (source != null) {
|
||||
maxDistance = source.getMaxDistanceTravelledSq();
|
||||
}
|
||||
if (eye.distanceSquared(loc) > maxDistance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package crazypants.enderio.teleport.packet;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.api.teleport.IItemOfTravel;
|
||||
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;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.server.S12PacketEntityVelocity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class PacketLongDistanceTravelEvent
|
||||
implements IMessage, IMessageHandler<PacketLongDistanceTravelEvent, IMessage> {
|
||||
|
||||
boolean conserveMotion;
|
||||
int entityId;
|
||||
int source;
|
||||
|
||||
public PacketLongDistanceTravelEvent() {}
|
||||
|
||||
public PacketLongDistanceTravelEvent(Entity entity, boolean conserveMotion, TravelSource source) {
|
||||
this.conserveMotion = conserveMotion;
|
||||
this.entityId = entity instanceof EntityPlayer ? -1 : entity.getEntityId();
|
||||
this.source = source.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeBoolean(conserveMotion);
|
||||
buf.writeInt(entityId);
|
||||
buf.writeInt(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
conserveMotion = buf.readBoolean();
|
||||
entityId = buf.readInt();
|
||||
source = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketLongDistanceTravelEvent message, MessageContext ctx) {
|
||||
Entity toTp = message.entityId == -1
|
||||
? ctx.getServerHandler().playerEntity
|
||||
: ctx.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityId);
|
||||
|
||||
TravelSource source = TravelSource.values()[message.source];
|
||||
|
||||
doServerTeleport(toTp, message.conserveMotion, source);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean doServerTeleport(Entity toTp, boolean conserveMotion, TravelSource source) {
|
||||
EntityPlayer player = toTp instanceof EntityPlayer ? (EntityPlayer) toTp : null;
|
||||
Optional<BlockCoord> travelDestination = TravelController.instance.findTravelDestination(player, source);
|
||||
if (!travelDestination.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
BlockCoord destination = travelDestination.get();
|
||||
int x = destination.x;
|
||||
int y = destination.y;
|
||||
int z = destination.z;
|
||||
int powerUse = TravelController.instance.getRequiredPower(player, source, destination);
|
||||
if (powerUse < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TeleportEntityEvent evt = new TeleportEntityEvent(toTp, source, x, y, z);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt)) {
|
||||
return false;
|
||||
}
|
||||
x = evt.targetX;
|
||||
y = evt.targetY;
|
||||
z = evt.targetZ;
|
||||
|
||||
toTp.worldObj.playSoundEffect(toTp.posX, toTp.posY, toTp.posZ, source.sound, 1.0F, 1.0F);
|
||||
|
||||
toTp.playSound(source.sound, 1.0F, 1.0F);
|
||||
|
||||
if (player != null) {
|
||||
player.setPositionAndUpdate(x + 0.5, y + 1.1, z + 0.5);
|
||||
} else {
|
||||
toTp.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
toTp.worldObj.playSoundEffect(x, y, z, source.sound, 1.0F, 1.0F);
|
||||
toTp.fallDistance = 0;
|
||||
|
||||
if (player != null) {
|
||||
if (conserveMotion) {
|
||||
Vector3d velocityVex = Util.getLookVecEio(player);
|
||||
S12PacketEntityVelocity p =
|
||||
new S12PacketEntityVelocity(toTp.getEntityId(), velocityVex.x, velocityVex.y, velocityVex.z);
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(p);
|
||||
}
|
||||
|
||||
if (powerUse > 0
|
||||
&& player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof IItemOfTravel) {
|
||||
ItemStack item = player.getCurrentEquippedItem().copy();
|
||||
((IItemOfTravel) item.getItem()).extractInternal(item, powerUse);
|
||||
toTp.setCurrentItemOrArmor(0, item);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class TelePadSpecialRenderer extends TravelEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float p_147500_8_) {
|
||||
TileTelePad tp = (TileTelePad) te;
|
||||
if (tp.isMaster() && tp.inNetwork()) {
|
||||
if (tp.isTravelSource()) {
|
||||
TravelController.instance.addCandidate(tp.getLocation());
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -243,6 +243,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
|
||||
}
|
||||
this.master = this;
|
||||
this.isMaster = true;
|
||||
TravelController.instance.travelDestinations.add(getLocation());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -260,6 +261,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
|
||||
telepad.updateNeighborTEs();
|
||||
}
|
||||
}
|
||||
TravelController.instance.travelDestinations.remove(getLocation());
|
||||
}
|
||||
|
||||
private List<BlockCoord> getSurroundingCoords() {
|
||||
@@ -693,7 +695,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
|
||||
|
||||
@Override
|
||||
public boolean canSeeBlock(EntityPlayer playerName) {
|
||||
return isMaster() && inNetwork();
|
||||
return isTravelSource();
|
||||
}
|
||||
|
||||
/* IInternalPowerReceiver */
|
||||
|
||||
@@ -726,12 +726,12 @@ item.itemTravelStaff.tooltip.detailed.line4=Shift-R-Click will teleport the
|
||||
item.itemTravelStaff.tooltip.detailed.line5=player a short distance
|
||||
enderio.itemTravelStaff.notEnoughPower=Not enough power
|
||||
|
||||
item.itemInfiniteTravelStaff.name=Creative Staff of Traveling
|
||||
item.itemInfiniteTravelStaff.tooltip.detailed.line1=When held Travel Anchors and EnderIO
|
||||
item.itemInfiniteTravelStaff.tooltip.detailed.line2=blocks become visible and can be
|
||||
item.itemInfiniteTravelStaff.tooltip.detailed.line3=activated by R-Click
|
||||
item.itemInfiniteTravelStaff.tooltip.detailed.line4=Shift-R-Click will teleport the
|
||||
item.itemInfiniteTravelStaff.tooltip.detailed.line5=player a short distance
|
||||
item.itemTeleportStaff.name=Staff of Teleportation
|
||||
item.itemTeleportStaff.tooltip.detailed.line1=R-Click to teleport wherever you are looking
|
||||
item.itemTeleportStaff.tooltip.detailed.line2=Shift-R-Click to teleport to Travel Anchors
|
||||
item.itemTeleportStaff.tooltip.detailed.line3=R-Click on a nearby block to try to teleport
|
||||
item.itemTeleportStaff.tooltip.detailed.line4=to the other side
|
||||
|
||||
item.itemCoordSelector.name=Coordinate Selector
|
||||
item.itemCoordSelector.tooltip.detailed.line1=Stores coordinates of a block.
|
||||
item.itemCoordSelector.tooltip.detailed.line2=Right click at block to select
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 384 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Reference in new issue
Block a user