mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-16 18:54:47 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e01292c71 |
No files matched your search
@@ -32,5 +32,4 @@ dependencies {
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
||||
compileOnly('curse.maven:automagy-222153:2285272')
|
||||
compileOnly('com.ruling_0:MaterialLib:0.24.0-mu:dev')
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
@@ -133,7 +133,6 @@ import crazypants.enderio.machine.painter.BlockPaintedWall;
|
||||
import crazypants.enderio.machine.painter.BlockPainter;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.ranged.RangeEntity;
|
||||
import crazypants.enderio.machine.recipe.RecipeConfigParser;
|
||||
import crazypants.enderio.machine.reservoir.BlockReservoir;
|
||||
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
|
||||
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
|
||||
@@ -767,7 +766,6 @@ public class EnderIO {
|
||||
FarmersRegistry.addFarmers();
|
||||
SoulBinderRecipeManager.getInstance().addDefaultRecipes();
|
||||
PaintSourceValidator.instance.loadConfig();
|
||||
RecipeConfigParser.logMaterialLibSummary();
|
||||
|
||||
if (fluidXpJuice == null) { // should have been registered by open blocks
|
||||
fluidXpJuice = FluidRegistry.getFluid(getXPJuiceName());
|
||||
|
||||
@@ -173,6 +173,7 @@ public final class Config {
|
||||
* The distance travelled when no block is found within {@link #teleportStaffMaxBlinkDistance}.
|
||||
*/
|
||||
public static int teleportStaffFailedBlinkDistance = 64;
|
||||
public static boolean teleportStaffUseBlink = false;
|
||||
|
||||
/**
|
||||
* Sets the teleport staff right-click action.
|
||||
@@ -1323,6 +1324,13 @@ public final class Config {
|
||||
+ " 3: Teleport to anchor, or look if no anchor")
|
||||
.getInt(teleportStaffSneakAction);
|
||||
|
||||
teleportStaffUseBlink = config.get(
|
||||
sectionPersonal.name,
|
||||
"teleportStaffUseBlink",
|
||||
teleportStaffUseBlink,
|
||||
"Use the Staff of Traveling blink instead of long-range teleportation with the Staff of Teleportation.")
|
||||
.getBoolean(teleportStaffUseBlink);
|
||||
|
||||
enderIoRange = config.get(
|
||||
sectionEfficiency.name,
|
||||
"enderIoRange",
|
||||
|
||||
@@ -36,6 +36,7 @@ import crazypants.enderio.item.darksteel.upgrade.SoundDetectorUpgrade;
|
||||
import crazypants.enderio.item.darksteel.upgrade.SpeedUpgrade;
|
||||
import crazypants.enderio.item.darksteel.upgrade.TrackmanGogglesUpgrade;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.ItemTeleportStaff;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.enderio.thaumcraft.GogglesOfRevealingUpgrade;
|
||||
import crazypants.util.BaublesUtil;
|
||||
@@ -67,6 +68,8 @@ public class KeyTracker {
|
||||
|
||||
private final KeyBinding staffOfTravelingTPKey;
|
||||
|
||||
private final KeyBinding teleportStaffModeKey;
|
||||
|
||||
private static long lastBlinkTick = -1;
|
||||
|
||||
public KeyTracker() {
|
||||
@@ -132,6 +135,12 @@ public class KeyTracker {
|
||||
Keyboard.KEY_NONE,
|
||||
EnderIO.lang.localize("category.tools"));
|
||||
ClientRegistry.registerKeyBinding(staffOfTravelingTPKey);
|
||||
|
||||
teleportStaffModeKey = new KeyBinding(
|
||||
EnderIO.lang.localize("keybind.teleportstaffmode"),
|
||||
Keyboard.KEY_NONE,
|
||||
EnderIO.lang.localize("category.tools"));
|
||||
ClientRegistry.registerKeyBinding(teleportStaffModeKey);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -158,6 +167,7 @@ public class KeyTracker {
|
||||
handleSpeed();
|
||||
handleJump();
|
||||
handleMagnet();
|
||||
handleTeleportStaffMode();
|
||||
handleStaffOfTravelingTP();
|
||||
}
|
||||
|
||||
@@ -173,6 +183,16 @@ public class KeyTracker {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketUpgradeState(type, isActive));
|
||||
}
|
||||
|
||||
private void handleTeleportStaffMode() {
|
||||
if (teleportStaffModeKey.isPressed() && Minecraft.getMinecraft().thePlayer != null) {
|
||||
Config.teleportStaffUseBlink = !Config.teleportStaffUseBlink;
|
||||
Config.config.get(Config.sectionPersonal.name, "teleportStaffUseBlink", false)
|
||||
.set(Config.teleportStaffUseBlink);
|
||||
Config.config.save();
|
||||
sendEnabledChatMessage("teleportStaff.blinkMode", Config.teleportStaffUseBlink);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleStaffOfTravelingTP() {
|
||||
if (staffOfTravelingTPKey.isPressed()) {
|
||||
if (Config.travelStaffKeybindEnabled) {
|
||||
@@ -191,7 +211,10 @@ public class KeyTracker {
|
||||
lastBlinkTick = -1;
|
||||
}
|
||||
if (ticksSinceBlink >= Config.travelStaffBlinkPauseTicks) {
|
||||
if (TravelController.instance.doBlink(travelItem, player)) {
|
||||
boolean teleported = travelItem.getItem() instanceof ItemTeleportStaff
|
||||
? TravelController.instance.doTeleport(player)
|
||||
: TravelController.instance.doBlink(travelItem, player);
|
||||
if (teleported) {
|
||||
lastBlinkTick = EnderIO.proxy.getTickCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package crazypants.enderio.machine.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.ruling_0.materiallib.api.StackResolver;
|
||||
|
||||
/// Resolves the stack a `modID="ml"` config entry names. The only EnderIO class referencing MaterialLib types, so
|
||||
/// the soft dependency classloads only behind a `Loader.isModLoaded` check.
|
||||
final class MaterialLibStacks {
|
||||
|
||||
private MaterialLibStacks() {}
|
||||
|
||||
/// The stack of the named material in the named shape, or null when the pair resolves to nothing.
|
||||
static ItemStack getStack(String materialName, String shapeToken, int stackSize) {
|
||||
return StackResolver.getStack(materialName, shapeToken, stackSize);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import com.enderio.core.common.util.OreDictionaryHelper;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
@@ -64,14 +63,6 @@ public class RecipeConfigParser extends DefaultHandler {
|
||||
public static final String AT_EXP = "exp";
|
||||
public static final String AT_ALLOW_MISSING = "allowMissing";
|
||||
|
||||
/// The `modID` under which an `itemName` of the form `<material>:<shape>` names a MaterialLib stack.
|
||||
private static final String MOD_ID_ML = "ml";
|
||||
|
||||
private static final String MATERIAL_LIB_MODID = "materiallib";
|
||||
|
||||
private static int materialLibResolved = 0;
|
||||
private static int materialLibInvalid = 0;
|
||||
|
||||
// Log prefix
|
||||
private static final String LP = "RecipeParser: ";
|
||||
|
||||
@@ -432,11 +423,7 @@ public class RecipeConfigParser extends DefaultHandler {
|
||||
String modId = getStringValue(AT_MOD_ID, attributes, null);
|
||||
String name = getStringValue(AT_ITEM_NAME, attributes, null);
|
||||
|
||||
if (MOD_ID_ML.equals(modId)) {
|
||||
res = getMaterialLibStack(name, stackSize);
|
||||
// A MaterialLib stack carries its material in the metadata, so itemMeta="*" cannot apply.
|
||||
useMeta = true;
|
||||
} else if (modId != null && name != null) {
|
||||
if (modId != null && name != null) {
|
||||
|
||||
Item i = GameRegistry.findItem(modId, name);
|
||||
if (i != null) {
|
||||
@@ -460,39 +447,6 @@ public class RecipeConfigParser extends DefaultHandler {
|
||||
getIntValue(AT_SLOT, attributes, -1));
|
||||
}
|
||||
|
||||
/// The stack `itemName` names, or null when MaterialLib is absent, the name is malformed, or the pair resolves
|
||||
/// to nothing.
|
||||
private static ItemStack getMaterialLibStack(String itemName, int stackSize) {
|
||||
if (itemName == null || !Loader.isModLoaded(MATERIAL_LIB_MODID)) {
|
||||
return null;
|
||||
}
|
||||
String[] parts = itemName.split(":", -1);
|
||||
if (parts.length != 2 || parts[0].isEmpty() || parts[1].isEmpty()) {
|
||||
Log.warn(LP + "Malformed MaterialLib reference \"" + itemName + "\", expected <material>:<shape>");
|
||||
materialLibInvalid++;
|
||||
return null;
|
||||
}
|
||||
ItemStack res = MaterialLibStacks.getStack(parts[0], parts[1], stackSize);
|
||||
if (res == null) {
|
||||
materialLibInvalid++;
|
||||
} else {
|
||||
materialLibResolved++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Logs how many MaterialLib references the recipe configs named. Call once config loading has finished.
|
||||
public static void logMaterialLibSummary() {
|
||||
if (materialLibResolved + materialLibInvalid > 0) {
|
||||
Log.info(
|
||||
LP + "Resolved "
|
||||
+ materialLibResolved
|
||||
+ " MaterialLib entries ("
|
||||
+ materialLibInvalid
|
||||
+ " invalid)");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getBooleanValue(String qName, Attributes attributes, boolean def) {
|
||||
String val = attributes.getValue(qName);
|
||||
if (val == null) {
|
||||
|
||||
@@ -172,6 +172,10 @@ public class TravelController {
|
||||
return null;
|
||||
case TELEPORT_STAFF_BLINK:
|
||||
case TELEPORT_STAFF:
|
||||
if (source == TravelSource.TELEPORT_STAFF_BLINK && Config.travelStaffKeybindEnabled
|
||||
&& (equippedItem == null || !(equippedItem.getItem() instanceof ItemTeleportStaff))) {
|
||||
equippedItem = findTravelItemInInventoryOrBaubles(toTp);
|
||||
}
|
||||
// tp staff is creative version of traveling staff
|
||||
// no energy check or anything else needed
|
||||
// but the player must actually be equipped with one of these
|
||||
@@ -196,6 +200,9 @@ public class TravelController {
|
||||
boolean alsoDoTeleport) {
|
||||
if (!hasTarget()) {
|
||||
if (alsoDoTeleport) {
|
||||
if (source == TravelSource.TELEPORT_STAFF && Config.teleportStaffUseBlink) {
|
||||
return doBlink(equipped, player);
|
||||
}
|
||||
Optional<BlockCoord> destinationOptional = findTeleportDestination(player);
|
||||
if (destinationOptional.isPresent()) {
|
||||
BlockCoord destination = destinationOptional.get();
|
||||
@@ -338,6 +345,9 @@ public class TravelController {
|
||||
|
||||
/** This is the teleport staff super-teleport. */
|
||||
public boolean doTeleport(EntityPlayer player) {
|
||||
if (Config.teleportStaffUseBlink) {
|
||||
return doBlink(player.getHeldItem(), player);
|
||||
}
|
||||
Optional<BlockCoord> destinationOptional = findTeleportDestination(player);
|
||||
if (destinationOptional.isPresent()) {
|
||||
return travelToLocation(player, TravelSource.TELEPORT_STAFF_BLINK, destinationOptional.get(), false);
|
||||
|
||||
@@ -763,6 +763,8 @@ 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
|
||||
enderio.travelStaffKeybind.isDisabled=Travel Staff Blink Keybind Disabled!
|
||||
enderio.teleportStaff.blinkMode.enabled=Staff of Teleportation: Travel Staff Blink
|
||||
enderio.teleportStaff.blinkMode.disabled=Staff of Teleportation: Long-Range Teleport
|
||||
|
||||
item.itemTeleportStaff.name=Staff of Teleportation
|
||||
item.itemTeleportStaff.tooltip.detailed.line1=R-Click to teleport wherever you are looking
|
||||
@@ -1442,6 +1444,7 @@ enderio.keybind.stepassist=Step Assist
|
||||
enderio.keybind.yetawrenchmode=Yeta Wrench Mode
|
||||
enderio.keybind.magnet=Toggle Electromagnet
|
||||
enderio.keybind.staffoftravelingtp=Travel Staff Blink
|
||||
enderio.keybind.teleportstaffmode=Switch Staff of Teleportation Mode
|
||||
enderio.nei.alloysmelter=Alloy Smelter
|
||||
enderio.nei.enchanter=Enchanter
|
||||
enderio.nei.sagmill=SAG Mill
|
||||
|
||||
@@ -1374,6 +1374,9 @@ enderio.keybind.jump=跳跃
|
||||
enderio.keybind.stepassist=步行辅助
|
||||
enderio.keybind.yetawrenchmode=以太扳手模式
|
||||
enderio.keybind.magnet=电磁铁
|
||||
enderio.keybind.teleportstaffmode=切换高级传送权杖模式
|
||||
enderio.teleportStaff.blinkMode.enabled=高级传送权杖:普通闪现模式
|
||||
enderio.teleportStaff.blinkMode.disabled=高级传送权杖:高级传送模式
|
||||
enderio.nei.alloysmelter=合金炉
|
||||
enderio.nei.enchanter=附魔器
|
||||
enderio.nei.sagmill=SAG磨粉机
|
||||
|
||||
Reference in new issue
Block a user