Compare commits

..
10 changed files with 119 additions and 57 deletions

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ dependencies {
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
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')
@@ -47,6 +47,7 @@ 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.betterbuilderswands.PaintedCustomMapping;
import crazypants.enderio.block.BlockDarkSteelAnvil;
import crazypants.enderio.block.BlockDarkSteelLadder;
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
@@ -190,7 +191,8 @@ import crazypants.util.EE3Util;
after:Waila@[1.5.8,);\
after:Thaumcraft;\
after:appliedenergistics2@[rv2-beta-8,);\
after:Railcraft@[9.16.7,)\
after:Railcraft@[9.16.7,);\
after:betterbuilderswands@[0.13.12,)\
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
public class EnderIO {
@@ -839,6 +841,9 @@ public class EnderIO {
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
}
}
if (Loader.isModLoaded("betterbuilderswands")) {
PaintedCustomMapping.registerMappings();
}
ThaumcraftCompat.load();
}
@@ -0,0 +1,101 @@
package crazypants.enderio.betterbuilderswands;
import java.util.function.BiFunction;
import java.util.function.IntFunction;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import com.github.bsideup.jabel.Desugar;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.painter.BlockPaintedCarpet;
import crazypants.enderio.machine.painter.BlockPaintedFence;
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.BlockPaintedSlab;
import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import portablejim.bbw.BetterBuildersWandsMod;
import portablejim.bbw.basics.Point3d;
import portablejim.bbw.core.conversion.ICustomMapping;
import portablejim.bbw.shims.IPlayerShim;
import portablejim.bbw.shims.IWorldShim;
@Desugar
public record PaintedCustomMapping(Block lookBlock, BiFunction<Block, Integer, ItemStack> itemStackGetter, int meta)
implements ICustomMapping {
@Override
public Block getLookBlock() {
return lookBlock;
}
@Override
public int getMeta() {
return meta;
}
@Override
public ItemStack getItems(IWorldShim world, IPlayerShim player, Point3d point) {
if (world.getTile(point) instanceof TileEntityPaintedBlock painted) {
return itemStackGetter.apply(painted.getSourceBlock(), painted.getSourceBlockMetadata());
}
return null;
}
@Override
public boolean shouldCopyTileNBT() {
return true;
}
public static void registerMappings() {
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedGlowstone,
BlockPaintedGlowstone::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedStair,
BlockPaintedStair::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFence,
BlockPaintedFence::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFenceGate,
BlockPaintedFenceGate::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedCarpet,
BlockPaintedCarpet::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedWall,
BlockPaintedWall::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedDoubleSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
}
private static void register(IntFunction<ICustomMapping> mapping) {
for (int i = 0; i < 16; i++) {
BetterBuildersWandsMod.instance.mappingManager.setMapping(mapping.apply(i));
}
}
}
@@ -47,8 +47,8 @@ public class ExistingItemFilter implements IItemFilter {
private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) {
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stackEqual(item, stack)) {
return true;
}
@@ -116,8 +116,8 @@ public class ExistingItemFilter implements IItemFilter {
snapshot = new ArrayList<>();
}
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stack != null && !isStackInSnapshot(stack)) {
snapshot.add(stack);
}
@@ -173,7 +173,6 @@ 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.
@@ -1324,13 +1323,6 @@ 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,7 +36,6 @@ 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;
@@ -68,8 +67,6 @@ public class KeyTracker {
private final KeyBinding staffOfTravelingTPKey;
private final KeyBinding teleportStaffModeKey;
private static long lastBlinkTick = -1;
public KeyTracker() {
@@ -135,12 +132,6 @@ 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
@@ -167,7 +158,6 @@ public class KeyTracker {
handleSpeed();
handleJump();
handleMagnet();
handleTeleportStaffMode();
handleStaffOfTravelingTP();
}
@@ -183,16 +173,6 @@ 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) {
@@ -211,10 +191,7 @@ public class KeyTracker {
lastBlinkTick = -1;
}
if (ticksSinceBlink >= Config.travelStaffBlinkPauseTicks) {
boolean teleported = travelItem.getItem() instanceof ItemTeleportStaff
? TravelController.instance.doTeleport(player)
: TravelController.instance.doBlink(travelItem, player);
if (teleported) {
if (TravelController.instance.doBlink(travelItem, player)) {
lastBlinkTick = EnderIO.proxy.getTickCount();
}
}
@@ -31,12 +31,15 @@ public class BasicManyToOneRecipe implements IManyToOneRecipe {
@Override
public boolean isValidRecipeComponents(ItemStack... items) {
List<RecipeInput> inputs = new ArrayList<>(Arrays.asList(recipe.getInputs()));
for (ItemStack is : items) {
List<RecipeInput> inputs = new ArrayList<RecipeInput>(Arrays.asList(recipe.getInputs()));
for (int slot = 0; slot < items.length; slot++) {
ItemStack is = items[slot];
if (is != null) {
RecipeInput remove = null;
for (RecipeInput ri : inputs) {
if (ri.isInput(is)) {
int riSlot = ri.getSlotNumber();
// Match by item type and, if the recipe specifies a slot, also by slot index
if (ri.isInput(is) && (riSlot == -1 || riSlot == slot)) {
remove = ri;
break;
}
@@ -172,10 +172,6 @@ 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
@@ -200,9 +196,6 @@ 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();
@@ -345,9 +338,6 @@ 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,8 +763,6 @@ 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
@@ -1444,7 +1442,6 @@ 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,9 +1374,6 @@ 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磨粉机