Compare commits

..
Author SHA1 Message Date
D-Cysteine 9063a7b1af Add distance limit for out-of-range message
Also fix the check so that we only display the message for travel anchors within the angle limit.
2023-01-28 00:16:53 -07:00
D-Cysteine 0902a8956b 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
2023-01-27 20:22:06 +01:00
Alexdoru d9b99f6888 unbind keys by default (#90)
* unbind all keys by default

* show "EnderIO - Tools" instead of "Tools" in the controls menu

* check if keybind is pressed first
2023-01-27 20:21:27 +01:00
16 changed files with 68 additions and 49 deletions

No files matched your search

@@ -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;
@@ -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);
}
}
}
}
@@ -55,22 +55,22 @@ public class KeyTracker {
public KeyTracker() {
glideKey = new KeyBinding(
EnderIO.lang.localize("keybind.glidertoggle"),
Keyboard.KEY_G,
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.darksteelarmor"));
ClientRegistry.registerKeyBinding(glideKey);
soundDetectorKey = new KeyBinding(
EnderIO.lang.localize("keybind.soundlocator"),
Keyboard.KEY_L,
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.darksteelarmor"));
ClientRegistry.registerKeyBinding(soundDetectorKey);
nightVisionKey = new KeyBinding(
EnderIO.lang.localize("keybind.nightvision"),
Keyboard.KEY_P,
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.darksteelarmor"));
ClientRegistry.registerKeyBinding(nightVisionKey);
gogglesKey = new KeyBinding(
EnderIO.lang.localize("keybind.gogglesofrevealing"),
Keyboard.KEY_R,
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.darksteelarmor"));
ClientRegistry.registerKeyBinding(gogglesKey);
@@ -94,12 +94,12 @@ public class KeyTracker {
yetaWrenchMode = new KeyBinding(
EnderIO.lang.localize("keybind.yetawrenchmode"),
Keyboard.KEY_Y,
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.tools"));
ClientRegistry.registerKeyBinding(yetaWrenchMode);
magnetKey = new KeyBinding(
EnderIO.lang.localize("keybind.magnet"), Keyboard.CHAR_NONE, EnderIO.lang.localize("category.tools"));
EnderIO.lang.localize("keybind.magnet"), Keyboard.KEY_NONE, EnderIO.lang.localize("category.tools"));
ClientRegistry.registerKeyBinding(magnetKey);
}
@@ -155,38 +155,38 @@ public class KeyTracker {
}
private void handleJump() {
if (!JumpUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
if (jumpKey.isPressed()) {
if (!JumpUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
toggleDarkSteelController(Type.JUMP, "darksteel.upgrade.jump");
}
}
private void handleSpeed() {
if (!SpeedUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
if (speedKey.isPressed()) {
if (!SpeedUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
toggleDarkSteelController(Type.SPEED, "darksteel.upgrade.speed");
}
}
private void handleStepAssist() {
if (!JumpUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
if (stepAssistKey.isPressed()) {
if (!JumpUpgrade.isEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
toggleDarkSteelController(Type.STEP_ASSIST, "darksteel.upgrade.stepAssist");
}
}
private void handleGoggles() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!GogglesOfRevealingUpgrade.isUpgradeEquipped(player)) {
return;
}
if (gogglesKey.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!GogglesOfRevealingUpgrade.isUpgradeEquipped(player)) {
return;
}
boolean isActive = !DarkSteelItems.itemDarkSteelHelmet.isGogglesUgradeActive();
sendEnabledChatMessage("darksteel.upgrade.gogglesOfRevealing", isActive);
DarkSteelItems.itemDarkSteelHelmet.setGogglesUgradeActive(isActive);
@@ -235,20 +235,18 @@ public class KeyTracker {
}
private void handleGlide() {
if (!DarkSteelController.instance.isGliderUpgradeEquipped(Minecraft.getMinecraft().thePlayer)) {
return;
}
if (glideKey.isPressed()) {
if (glideKey.isPressed()
&& DarkSteelController.instance.isGliderUpgradeEquipped(Minecraft.getMinecraft().thePlayer)) {
toggleDarkSteelController(Type.GLIDE, "darksteel.upgrade.glider");
}
}
private void handleNightVision() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
return;
}
if (nightVisionKey.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
return;
}
boolean isActive = !DarkSteelController.instance.isNightVisionActive();
if (isActive) {
player.worldObj.playSound(
@@ -276,10 +274,7 @@ public class KeyTracker {
public boolean isSoundDetectorUpgradeEquipped(EntityClientPlayerMP player) {
ItemStack helmet = player.getEquipmentInSlot(4);
SoundDetectorUpgrade upgrade = SoundDetectorUpgrade.loadFromItem(helmet);
if (upgrade == null) {
return false;
}
return true;
return upgrade != null;
}
public KeyBinding getYetaWrenchMode() {
@@ -65,6 +65,12 @@ public class ItemTeleportStaff extends ItemTravelStaff {
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) {
// Do nothing, as we have infinite energy.
@@ -309,13 +309,15 @@ public class TravelController {
// Map of distance to coordinate for eligible travel destinations (within angle).
Map<Double, BlockCoord> distanceMap = new TreeMap<>();
boolean outOfRange = false;
// Limit the max distance at which we'll display an out of range message.
// Otherwise, you could trigger the message for any travel anchor on the entire server.
double maxMessageDistance = 1.25 * source.getMaxDistanceTravelled();
boolean displayOutOfRangeMessage = 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;
if (distance > maxMessageDistance) {
continue;
}
block.normalize();
@@ -323,11 +325,15 @@ public class TravelController {
double angle = Math.acos(look.dot(block));
// Roughly 5 degrees
if (angle < 0.087) {
distanceMap.put(distance, p);
if (distance > source.getMaxDistanceTravelled()) {
displayOutOfRangeMessage = true;
} else {
distanceMap.put(distance, p);
}
}
}
if (outOfRange && distanceMap.isEmpty()) {
if (displayOutOfRangeMessage && distanceMap.isEmpty()) {
player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
}
@@ -1216,7 +1216,7 @@ enderio.weatherObelisk.fuelTank=Barometric Flux Tank
enchantment.enderio.soulBound=Soulbound
description.enchantment.enderio.soulBound=Prevents item from being lost on death
enderio.category.darksteelarmor=Dark Steel Armor
enderio.category.tools=Tools
enderio.category.tools=EnderIO - Tools
enderio.keybind.glidertoggle=Glider Toggle
enderio.keybind.gogglesofrevealing=Goggles of Revealing
enderio.keybind.nightvision=Night Vision
@@ -1107,7 +1107,7 @@ enderio.config.spawner.tooltip=Mir sind die geistreichen Tooltips ausgegangen
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Dunkelstahlrüstung
enderio.category.tools=Werkzeuge
enderio.category.tools=EnderIO - Werkzeuge
enderio.keybind.glidertoggle=Gleiterschaltung
enderio.keybind.gogglesofrevealing=Brille der Enthüllung
enderio.keybind.nightvision=Nachtsicht
@@ -1375,7 +1375,7 @@ enderio.config.spawner.tooltip=I ran out of witty tooltips.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Dark Steel Armor
enderio.category.tools=Tools
enderio.category.tools=EnderIO - Tools
enderio.keybind.glidertoggle=Glider Toggle
enderio.keybind.gogglesofrevealing=Goggles of Revealing
enderio.keybind.nightvision=Night Vision
@@ -976,7 +976,7 @@ enderio.config.spawner.tooltip=Me he quedado sin descripciones ingeniosas.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armadura de Acero Oscuro
enderio.category.tools=Herramientas
enderio.category.tools=EnderIO - Herramientas
enderio.keybind.glidertoggle=Activar/Desactivar Planeador
enderio.keybind.gogglesofrevealing=Gafas de Revelación
enderio.keybind.nightvision=Visión Nocturna
@@ -978,7 +978,7 @@ enderio.config.spawner.tooltip=Me he quedado sin descripciones ingeniosas.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armadura de Acero Oscuro
enderio.category.tools=Herramientas
enderio.category.tools=EnderIO - Herramientas
enderio.keybind.glidertoggle=Activar/Desactivar Planeador
enderio.keybind.gogglesofrevealing=Gafas de Revelación
enderio.keybind.nightvision=Visión Nocturna
@@ -976,7 +976,7 @@ enderio.config.spawner.tooltip=Me he quedado sin descripciones ingeniosas.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armadura de Acero Oscuro
enderio.category.tools=Herramientas
enderio.category.tools=EnderIO - Herramientas
enderio.keybind.glidertoggle=Activar/Desactivar Planeador
enderio.keybind.gogglesofrevealing=Gafas de Revelación
enderio.keybind.nightvision=Visión Nocturna
@@ -976,7 +976,7 @@ enderio.config.spawner.tooltip=Me he quedado sin descripciones ingeniosas.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armadura de Acero Oscuro
enderio.category.tools=Herramientas
enderio.category.tools=EnderIO - Herramientas
enderio.keybind.glidertoggle=Activar/Desactivar Planeador
enderio.keybind.gogglesofrevealing=Gafas de Revelación
enderio.keybind.nightvision=Visión Nocturna
@@ -976,7 +976,7 @@ enderio.config.spawner.tooltip=Me he quedado sin descripciones ingeniosas.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armadura de Acero Oscuro
enderio.category.tools=Herramientas
enderio.category.tools=EnderIO - Herramientas
enderio.keybind.glidertoggle=Activar/Desactivar Planeador
enderio.keybind.gogglesofrevealing=Gafas de Revelación
enderio.keybind.nightvision=Visión Nocturna
@@ -993,7 +993,7 @@ enderio.config.spawner.tooltip=Je suis a cours d'infobulles marrantes.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Armure d'Acier Sombre
enderio.category.tools=Outils
enderio.category.tools=EnderIO - Outils
enderio.keybind.glidertoggle=Mode Planeur
enderio.keybind.gogglesofrevealing=Lunettes de Révélation
enderio.keybind.nightvision=Vision Nocturne
@@ -1289,7 +1289,7 @@ enderio.config.spawner.tooltip=У меня закончились остроум
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=Броня из тёмной стали
enderio.category.tools=Инструменты
enderio.category.tools=EnderIO - Инструменты
enderio.keybind.glidertoggle=Переключить планер
enderio.keybind.gogglesofrevealing=Очки откровения
enderio.keybind.nightvision=Ночное зрение
@@ -1369,7 +1369,7 @@ enderio.config.spawner.tooltip=我已经想不出什么有趣的提示文本了.
#Keybinds/Waila/NEI/Tooltips
enderio.category.darksteelarmor=玄铁护甲
enderio.category.tools=工具
enderio.category.tools=EnderIO - 工具
enderio.keybind.glidertoggle=滑翔开关
enderio.keybind.gogglesofrevealing=揭示护目镜
enderio.keybind.nightvision=夜视
@@ -1391,4 +1391,4 @@ enderio.tooltip.oredict=矿物辞典:
enderio.tooltip.meta=Meta:
enderio.tooltip.uid=UID:
enderio.tooltip.anvilupgrades=铁砧升级:
enderio.waila.config.hiddenfacades=隐形栅栏
enderio.waila.config.hiddenfacades=隐形栅栏
@@ -1225,7 +1225,7 @@ enderio.gui.weather.requiredfluid=Required Fluid: %s L
enderio.weatherObelisk.fuelTank=Barometric Flux Tank
description.enchantment.enderio.soulBound=Prevents item from being lost on death
enderio.category.darksteelarmor=Dark Steel Armor
enderio.category.tools=Tools
enderio.category.tools=EnderIO - Tools
enderio.keybind.glidertoggle=Glider Toggle
enderio.keybind.gogglesofrevealing=Goggles of Revealing
enderio.keybind.nightvision=Night Vision