Compare commits

...
14 changed files with 112 additions and 59 deletions

No files matched your search

@@ -320,7 +320,7 @@ public class ConduitUtil {
}
int signalStrength = getInternalSignalForColor(bundle, col);
if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) {
TileEntity te = bundle.getEntity();
signalStrength = Math
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
@@ -175,6 +175,7 @@ public class ItemSettings extends BaseSettingsPanel {
private void updateButtons() {
rsB.onGuiInit();
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
colorB.onGuiInit();
loopB.onGuiInit();
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
@@ -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();
}
}
@@ -52,7 +52,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
@Override
public boolean isActive() {
return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
return currentTask != null && currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
}
@Override
@@ -224,7 +224,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
ItemStack copy = item.copy();
// try to add it to existing stacks first
for (ItemStack outStack : outputStacks) {
if (outStack != null && copy != null) {
if (outStack != null) {
int num = getNumCanMerge(outStack, copy);
outStack.stackSize += num;
copy.stackSize -= num;
@@ -322,7 +322,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
}
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
if (!itemStack.isItemEqual(result)) {
if (!itemStack.isItemEqual(result) || !ItemStack.areItemStackTagsEqual(itemStack, result)) {
return 0;
}
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
@@ -15,7 +15,9 @@ import crazypants.enderio.machine.SlotDefinition;
public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISidedInventory {
// private static final short MAX_POWER_USE_PER_TICK = 6;
private static final int SLOT_INPUT = 0;
private static final int SLOT_PAINT_SOURCE = 1;
private static final int SLOT_OUTPUT = 2;
public TileEntityPainter() {
// 0 = input slot, 1 = paint source, 2 = output slot
@@ -24,7 +26,8 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
return super.canExtractItem(i, itemstack, j) && PainterUtil.isMetadataEquivelent(itemstack, inventory[2]);
return super.canExtractItem(i, itemstack, j)
&& PainterUtil.isMetadataEquivelent(itemstack, inventory[SLOT_OUTPUT]);
}
@Override
@@ -32,49 +35,44 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
return "Auto Painter";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) {
if (i > 1) {
return false;
}
if (i == 0) {
if (i == SLOT_INPUT) {
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance
.getRecipesForInput(getMachineName(), MachineRecipeInput.create(i, itemStack));
if (inventory[1] == null) {
if (inventory[SLOT_PAINT_SOURCE] == null) {
return !recipes.isEmpty();
} else {
for (IMachineRecipe rec : recipes) {
if (rec instanceof BasicPainterTemplate) {
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
if (temp.isValidPaintSource(inventory[1])) {
if (rec instanceof BasicPainterTemplate temp) {
if (temp.isValidPaintSource(inventory[SLOT_PAINT_SOURCE])) {
return true;
}
}
}
return false;
}
return false;
}
if (inventory[0] == null) {
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForMachine(getMachineName());
for (IMachineRecipe rec : recipes.values()) {
if (rec instanceof BasicPainterTemplate) {
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
if (temp.isValidPaintSource(itemStack)) {
return true;
} else if (i == SLOT_PAINT_SOURCE) {
if (inventory[SLOT_INPUT] == null) {
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance
.getRecipesForMachine(getMachineName());
for (IMachineRecipe rec : recipes.values()) {
if (rec instanceof BasicPainterTemplate temp) {
if (temp.isValidPaintSource(itemStack)) {
return true;
}
}
}
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
} else {
return MachineRecipeRegistry.instance.getRecipeForInputs(
getMachineName(),
targetInput(),
MachineRecipeInput.create(SLOT_PAINT_SOURCE, itemStack)) != null;
}
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
} else {
return false;
}
return MachineRecipeRegistry.instance.getRecipeForInputs(
getMachineName(),
i == 0 ? MachineRecipeInput.create(0, itemStack) : targetInput(),
i == 1 ? MachineRecipeInput.create(1, itemStack) : paintSource()) != null;
}
@Override
@@ -83,27 +81,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
}
private MachineRecipeInput targetInput() {
return MachineRecipeInput.create(0, inventory[0]);
return MachineRecipeInput.create(SLOT_INPUT, inventory[SLOT_INPUT]);
}
private MachineRecipeInput paintSource() {
return MachineRecipeInput.create(1, inventory[1]);
}
@Override
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
if (result == null || !result.isItemEqual(inventory[2])) {
// next result is a different item type
return 0;
} else if (result.hasTagCompound() && inventory[2].hasTagCompound()) {
if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items
String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
if (!cookedId.equals(invId)) {
// next result has a different source item than the current one
return 0;
}
}
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
return MachineRecipeInput.create(SLOT_PAINT_SOURCE, inventory[SLOT_PAINT_SOURCE]);
}
}
@@ -15,8 +15,14 @@ public class SoulBinderEnderCystalRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderEnderCystalRF,
Config.soulBinderEnderCystalLevels,
"SoulBinderEnderCystalRecipe",
"SpecialMobs.SpecialEnderman",
"Enderman");
"Enderman",
"SpecialMobs.BlindingEnderman",
"SpecialMobs.CursedEnderman",
"SpecialMobs.IcyEnderman",
"SpecialMobs.LightningEnderman",
"SpecialMobs.MiniEnderman",
"SpecialMobs.MirageEnderman",
"SpecialMobs.ThiefEnderman");
}
@Override
@@ -15,8 +15,14 @@ public class SoulBinderPrecientCystalRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderPrecientCystalRF,
Config.soulBinderPrecientCystalLevels,
"SoulBinderPrecientCystalRecipe",
"SpecialMobs.SpecialEnderman",
"Enderman");
"Enderman",
"SpecialMobs.BlindingEnderman",
"SpecialMobs.CursedEnderman",
"SpecialMobs.IcyEnderman",
"SpecialMobs.LightningEnderman",
"SpecialMobs.MiniEnderman",
"SpecialMobs.MirageEnderman",
"SpecialMobs.ThiefEnderman");
}
@Override
@@ -16,7 +16,12 @@ public class SoulBinderReanimationRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderReanimationLevels,
"SoulBinderReanimationRecipe",
"Zombie",
"SpecialMobs.SpecialZombie");
"SpecialMobs.BrutishZombie",
"SpecialMobs.FireZombie",
"SpecialMobs.FishingZombie",
"SpecialMobs.GiantZombie",
"SpecialMobs.HungryZombie",
"SpecialMobs.PlagueZombie");
}
@Override
@@ -16,7 +16,13 @@ public class SoulBinderSentientRecipe extends AbstractSoulBinderRecipe {
Config.soulBinderReanimationLevels,
"SoulBinderSentientRecipe",
"Witch",
"enderzoo.WitherWitch");
"enderzoo.WitherWitch",
"SpecialMobs.DominationWitch",
"SpecialMobs.RageWitch",
"SpecialMobs.ShadowsWitch",
"SpecialMobs.UndeadWitch",
"SpecialMobs.WildsWitch",
"SpecialMobs.WindWitch");
}
@Override
@@ -148,6 +148,7 @@ public class GuiVacuumChest extends GuiContainerBaseEIO {
break;
case RANGE_ID:
te.setShowRange(showRangeB.isSelected());
break;
case ID_WHITELIST:
itemFilter = te.getItemFilter();
if (itemFilter != 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磨粉机