mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 23:13:21 +00:00
Tweak teleport staff controls
This commit is contained in:
1 parent
8ecec5b096
commit
d90c7dae1b
3 files changed
+28
-5
No files matched your search
@@ -174,6 +174,8 @@ public final class Config {
|
||||
* The distance travelled when no block is found within {@link #teleportStaffMaxBlinkDistance}.
|
||||
*/
|
||||
public static int teleportStaffFailedBlinkDistance = 64;
|
||||
/** If true, don't invert the staff of teleportation controls. */
|
||||
public static boolean teleportStaffOriginalControls = false;
|
||||
|
||||
public static int enderIoRange = 8;
|
||||
public static boolean enderIoMeAccessEnabled = true;
|
||||
@@ -1269,6 +1271,14 @@ public final class Config {
|
||||
"Number of blocks teleported when no block is being looked at.")
|
||||
.getInt(teleportStaffFailedBlinkDistance);
|
||||
|
||||
teleportStaffOriginalControls = config
|
||||
.get(
|
||||
sectionPersonal.name,
|
||||
"teleportStaffOriginalControls",
|
||||
teleportStaffOriginalControls,
|
||||
"If true, the staff of teleportation will use its original controls: R-Click for teleport to look, Shift R-Click for teleport to anchor.")
|
||||
.getBoolean(teleportStaffOriginalControls);
|
||||
|
||||
enderIoRange = config.get(
|
||||
sectionEfficiency.name,
|
||||
"enderIoRange",
|
||||
|
||||
@@ -2,6 +2,7 @@ package crazypants.enderio.teleport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import crazypants.enderio.config.Config;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -56,10 +57,17 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack equipped, World world, EntityPlayer player) {
|
||||
if (world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
TravelController.instance
|
||||
if (Config.teleportStaffOriginalControls) {
|
||||
if (player.isSneaking()) {
|
||||
TravelController.instance
|
||||
.activateTravelAccessable(equipped, world, player, TravelSource.TELEPORT_STAFF);
|
||||
} else {
|
||||
} else {
|
||||
TravelController.instance.doTeleport(player);
|
||||
}
|
||||
} else if (
|
||||
player.isSneaking()
|
||||
|| !TravelController.instance
|
||||
.activateTravelAccessable(equipped, world, player, TravelSource.TELEPORT_STAFF)) {
|
||||
TravelController.instance.doTeleport(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ public class TravelController {
|
||||
|
||||
double distanceIncrement = -2;
|
||||
// Special case: if the targeted block is too close, we'll try to teleport through it.
|
||||
if (teleDistance < 3) {
|
||||
if (teleDistance < 4) {
|
||||
distanceIncrement = 2;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ public class TravelController {
|
||||
}
|
||||
onBlockCoord = getActiveTravelBlock(player);
|
||||
boolean onBlock = onBlockCoord != null;
|
||||
showTargets = onBlock || isTravelItemActive(player, false);
|
||||
showTargets = onBlock || (isTravelItemActive(player, false) && !shouldHideTargets(player));
|
||||
if (showTargets) {
|
||||
updateSelectedTarget(player);
|
||||
} else {
|
||||
@@ -619,6 +619,11 @@ public class TravelController {
|
||||
return getTravelItemTravelSource(ep, checkInventoryAndBaubles) != null;
|
||||
}
|
||||
|
||||
public boolean shouldHideTargets(EntityPlayer ep) {
|
||||
return getTravelItemTravelSource(ep, false) != TravelSource.TELEPORT_STAFF
|
||||
|| (!Config.teleportStaffOriginalControls && ep.isSneaking());
|
||||
}
|
||||
|
||||
/** Returns null if no travel item is in inventory/baubles. */
|
||||
@Nullable
|
||||
public TravelSource getTravelItemTravelSource(EntityPlayer ep, boolean checkInventoryAndBaubles) {
|
||||
|
||||
Reference in new issue
Block a user