mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-14 17:14:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
749ea96c62 | ||
|
|
f4dfa9e6cf | ||
|
|
30958c201a | ||
|
|
8ead31ff76 | ||
|
|
7bebb05573 | ||
|
|
87e5a32b89 | ||
|
|
c232ea8534 | ||
|
|
d27f30951a | ||
|
|
8dcda4e822 | ||
|
|
e337597a3c | ||
|
|
a8197e0026 | ||
|
|
9549d9385c | ||
|
|
d44c6bb7c7 | ||
|
|
a4a40ee726 | ||
|
|
caec163702 | ||
|
|
673f832c2d | ||
|
|
ce11a2dcf2 | ||
|
|
68e209203c | ||
|
|
0715f8b536 | ||
|
|
d356dddedb | ||
|
|
604b47a394 | ||
|
|
42dc1f43aa | ||
|
|
cbeec42e47 | ||
|
|
046ad7441d | ||
|
|
8750005be5 | ||
|
|
b46cfbb351 | ||
|
|
070ef99694 | ||
|
|
fec675ef48 | ||
|
|
503b90a5d0 | ||
|
|
84052a1c42 |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
+19
-19
@@ -1,35 +1,35 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.30:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.110-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.22:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.61:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.93-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.30:dev') {transitive = false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
|
||||
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.11:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-997-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.14:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.79-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.28:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.26-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.17.26-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.48-GTNH:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
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
|
||||
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.49:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.166:dev")
|
||||
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')
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.26'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
}
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockBuffer), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPoweredSpawner), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSliceAndSplice), machRen);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer());
|
||||
|
||||
@@ -256,7 +258,9 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer());
|
||||
|
||||
BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new SoulBinderRenderer());
|
||||
SoulBinderRenderer soulBinderRenderer = new SoulBinderRenderer();
|
||||
RenderingRegistry.registerBlockHandler(soulBinderRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSoulFuser), soulBinderRenderer);
|
||||
|
||||
ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer();
|
||||
BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -360,6 +364,7 @@ public class ClientProxy extends CommonProxy {
|
||||
TelePadRenderer telePadRenderer = new TelePadRenderer();
|
||||
RenderingRegistry.registerBlockHandler(telePadRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer));
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTelePad), telePadRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -771,7 +771,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[facadeType]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[facadeType]);
|
||||
if (!world.isRemote) {
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -41,6 +41,8 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
BASIC,
|
||||
HARDENED;
|
||||
|
||||
public static final FacadeType[] VALUES = values();
|
||||
|
||||
public String getUnlocName(Item me) {
|
||||
return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened";
|
||||
}
|
||||
@@ -69,14 +71,14 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List<ItemStack> list) {
|
||||
for (FacadeType t : FacadeType.values()) {
|
||||
for (FacadeType t : FacadeType.VALUES) {
|
||||
list.add(new ItemStack(item, 1, t.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return FacadeType.values()[stack.getItemDamage()].getUnlocName(this);
|
||||
return FacadeType.VALUES[stack.getItemDamage()].getUnlocName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +89,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
icons = new IIcon[FacadeType.values().length];
|
||||
icons = new IIcon[FacadeType.VALUES.length];
|
||||
icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade");
|
||||
icons[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened");
|
||||
overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay");
|
||||
@@ -131,7 +133,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side);
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[itemStack.getItemDamage()]);
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
itemStack.stackSize--;
|
||||
|
||||
@@ -184,8 +184,8 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
|
||||
String key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
|
||||
@@ -284,6 +284,8 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
rsB.onGuiInit();
|
||||
colorB.onGuiInit();
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
|
||||
if (!isEnder) {
|
||||
return;
|
||||
}
|
||||
@@ -295,7 +297,6 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
roundRobinB.onGuiInit();
|
||||
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
if (isFilterVisible()) {
|
||||
addFilterTooltips();
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]);
|
||||
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]);
|
||||
setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed"));
|
||||
@@ -837,8 +837,8 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
|
||||
@@ -8,10 +8,13 @@ import java.util.Map;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory.Target;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
@@ -176,8 +179,8 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
|
||||
List<String> result = new ArrayList<>();
|
||||
public List<IChatComponent> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
|
||||
List<IChatComponent> result = new ArrayList<>();
|
||||
|
||||
List<NetworkedInventory> invs = getOrCreate(extractFrom);
|
||||
for (NetworkedInventory source : invs) {
|
||||
@@ -187,12 +190,12 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
for (Target t : source.sendPriority) {
|
||||
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
|
||||
if (input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
|
||||
String s = t.inv.getLocalizedInventoryName() + " "
|
||||
+ t.inv.location.chatString()
|
||||
+ " Distance ["
|
||||
+ t.distance
|
||||
+ "] ";
|
||||
result.add(s);
|
||||
result.add(
|
||||
t.inv.getInventoryNameComponent()
|
||||
.appendText(" " + t.inv.location.chatString() + " ").appendSibling(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("gui.mjReader.distance"),
|
||||
t.distance)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,13 +205,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<String> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
|
||||
List<String> result = new ArrayList<>();
|
||||
public List<IChatComponent> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
|
||||
List<IChatComponent> result = new ArrayList<>();
|
||||
for (NetworkedInventory inv : inventories) {
|
||||
if (inv.hasTarget(con, dir)) {
|
||||
IItemFilter f = inv.con.getInputFilter(inv.conDir);
|
||||
if (input == null || f == null || f.doesItemPassFilter(inv, input)) {
|
||||
result.add(inv.getLocalizedInventoryName() + " " + inv.location.chatString());
|
||||
result.add(inv.getInventoryNameComponent().appendText(" " + inv.location.chatString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -425,7 +430,7 @@ public class NetworkedInventory {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public ISidedInventory getInventoryRecheck() {
|
||||
public @Nullable ISidedInventory getInventoryRecheck() {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
}
|
||||
@@ -440,6 +445,10 @@ public class NetworkedInventory {
|
||||
this.inventorySide = inventorySide;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Translates on the server. Use {@link #getInventoryNameComponent()} for chat.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getLocalizedInventoryName() {
|
||||
String inventoryName = getInventory().getInventoryName();
|
||||
if (inventoryName == null) {
|
||||
@@ -451,6 +460,22 @@ public class NetworkedInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public IChatComponent getInventoryNameComponent() {
|
||||
String inventoryName = getInventory().getInventoryName();
|
||||
if (inventoryName == null) {
|
||||
return new ChatComponentText("null");
|
||||
}
|
||||
// Ask the tile entity: InventoryWrapper always reports no custom name.
|
||||
// The client parses the translation as a format string and falls back to en_US if it fails, so a '%' in the
|
||||
// en_US text (or in the key when untranslated) could crash it. A dedicated server translates to en_US.
|
||||
boolean customName = connectedTileEntity instanceof IInventory
|
||||
&& ((IInventory) connectedTileEntity).hasCustomInventoryName();
|
||||
if (customName || StatCollector.translateToLocal(inventoryName).contains("%")) {
|
||||
return new ChatComponentText(inventoryName);
|
||||
}
|
||||
return new ChatComponentTranslation(inventoryName);
|
||||
}
|
||||
|
||||
static class Target implements Comparable<Target> {
|
||||
|
||||
NetworkedInventory inv;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
|
||||
ExistingItemFilter filter = (ExistingItemFilter) createFilterFromStack(item);
|
||||
String unloc = "item.itemExistingItemFilter."
|
||||
+ (filter.mergeSnapshot(inv) ? "filterUpdated" : "filterNotUpdated");
|
||||
ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, unloc);
|
||||
ChatUtil.sendNoSpam(player, new ChatComponentTranslation(EnderIO.lang.addPrefix(unloc)));
|
||||
FilterRegister.writeFilterToStack(filter, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,8 +239,8 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
String key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
|
||||
@@ -7,15 +7,16 @@ import java.util.Set;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.ChatUtil;
|
||||
import com.gtnewhorizon.gtnhlib.chat.customcomponents.ChatComponentFluidName;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
@@ -110,7 +111,9 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|
||||
if (network.fluidTypeLocked) {
|
||||
network.setFluidTypeLocked(false);
|
||||
numEmptyEvents = 0;
|
||||
ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, "itemLiquidConduit.unlockedType");
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.unlockedType")));
|
||||
}
|
||||
} else if (network != null) {
|
||||
network.setFluidType(null);
|
||||
@@ -128,11 +131,10 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|
||||
|| LiquidConduitNetwork.areFluidsCompatable(getFluidType(), fluid))) {
|
||||
network.setFluidType(fluid);
|
||||
network.setFluidTypeLocked(true);
|
||||
ChatUtil.sendNoSpamUnloc(
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
EnderIO.lang,
|
||||
"itemLiquidConduit.lockedType",
|
||||
" " + FluidRegistry.getFluidName(fluid));
|
||||
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.lockedType"))
|
||||
.appendText(" ").appendSibling(new ChatComponentFluidName(fluid)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -213,14 +215,20 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String prettyNode(Node o) {
|
||||
String at = "";
|
||||
private static IChatComponent prettyNode(Node o) {
|
||||
Environment host = o.host();
|
||||
String name = host.getClass().getName().replaceFirst("^.*\\.", "");
|
||||
if (host instanceof TileEntity) {
|
||||
BlockCoord bc = new BlockCoord((TileEntity) host);
|
||||
at = " at " + bc.x + "/" + bc.y + "/" + bc.z;
|
||||
return new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.nodeAt"),
|
||||
name,
|
||||
coords(new BlockCoord((TileEntity) host)));
|
||||
}
|
||||
return host.getClass().getName().replaceFirst("^.*\\.", "") + at;
|
||||
return new ChatComponentText(name);
|
||||
}
|
||||
|
||||
private static String coords(BlockCoord bc) {
|
||||
return bc.x + "/" + bc.y + "/" + bc.z;
|
||||
}
|
||||
|
||||
private static EnumChatFormatting dye2chat(DyeColor dyeColor) {
|
||||
@@ -277,23 +285,34 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
for (DyeColor color : DyeColor.VALUES) {
|
||||
if (node(color).neighbors().iterator().hasNext()) {
|
||||
noconnections = false;
|
||||
ChatComponentText coltxt = new ChatComponentText(color.getLocalisedName());
|
||||
ChatComponentTranslation coltxt = new ChatComponentTranslation(
|
||||
DyeColor.DYE_ORE_UNLOCAL_NAMES[color.ordinal()]);
|
||||
coltxt.getChatStyle().setColor(dye2chat(color));
|
||||
ChatComponentText chantxt = new ChatComponentText("Channel ");
|
||||
chantxt.appendSibling(coltxt);
|
||||
chantxt.appendText(" at " + bc.x + "/" + bc.y + "/" + bc.z);
|
||||
player.addChatMessage(chantxt);
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.channel"),
|
||||
coltxt,
|
||||
coords(bc)));
|
||||
for (Node other : node(color).neighbors()) {
|
||||
player.addChatMessage(new ChatComponentText(" Connected to: " + prettyNode(other)));
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(" ").appendSibling(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.connectedTo"),
|
||||
prettyNode(other))));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noconnections) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText("No connections at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.noConnections"),
|
||||
coords(bc)));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("No network at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.noNetwork"),
|
||||
coords(bc)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
mode = RedstoneControlMode.values()[buf.readShort()];
|
||||
mode = RedstoneControlMode.VALUES[buf.readShort()];
|
||||
color = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -253,8 +253,8 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
String key = "pRsMode." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
rsModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
rsModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "pRsCol." + dir.name();
|
||||
|
||||
@@ -145,6 +145,7 @@ public final class Config {
|
||||
public static int travelAnchorCooldown = 0;
|
||||
public static boolean travelAnchorSneak = true;
|
||||
public static boolean travelAnchorSkipWarning = true;
|
||||
public static double travelAnchorSnapAngle = 0.175;
|
||||
|
||||
public static int travelStaffMaxDistance = 128;
|
||||
public static float travelStaffPowerPerBlockRF = 250;
|
||||
@@ -597,6 +598,11 @@ public final class Config {
|
||||
|
||||
public static float fusedQuartzExplosionResistance = 2000.0f;
|
||||
|
||||
public static boolean enchanterOutputEnableBlockRestriction = false;
|
||||
public static boolean enchanterOutputAllowlistAsDenylist = false;
|
||||
public static String[] enchanterOutputFilterlist = new String[] { "minecraft:hopper",
|
||||
"EnderIO:blockConduitBundle" };
|
||||
|
||||
public static void load(FMLPreInitializationEvent event) {
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketConfigSync.class, PacketConfigSync.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
@@ -1162,6 +1168,14 @@ public final class Config {
|
||||
"Travel Anchors send a chat warning when skipping inaccessible anchors")
|
||||
.getBoolean(travelAnchorSkipWarning);
|
||||
|
||||
travelAnchorSnapAngle = Math.toRadians(
|
||||
config.get(
|
||||
sectionAnchor.name,
|
||||
"travelAnchorSnapAngle",
|
||||
Math.round(Math.toDegrees(travelAnchorSnapAngle)),
|
||||
"The maximum angle to snap to an anchor when selecting target")
|
||||
.getDouble(Math.toDegrees(travelAnchorSnapAngle)));
|
||||
|
||||
travelStaffMaxDistance = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
@@ -2978,6 +2992,22 @@ public final class Config {
|
||||
0.0f,
|
||||
Float.MAX_VALUE,
|
||||
"How blast resistant the three Fused Quartz blocks should be.");
|
||||
|
||||
enchanterOutputEnableBlockRestriction = config.getBoolean(
|
||||
"enchanterOutputEnableBlockRestriction",
|
||||
sectionMisc.name,
|
||||
enchanterOutputEnableBlockRestriction,
|
||||
"Enable restricting the valid blocks that are allowed to pull from the output slot of an Enchanter, to prevent dupes");
|
||||
enchanterOutputAllowlistAsDenylist = config.getBoolean(
|
||||
"enchanterOutputAllowlistAsDenylist",
|
||||
sectionMisc.name,
|
||||
enchanterOutputAllowlistAsDenylist,
|
||||
"Treat the list of blocks allowed to pull from an Enchanter's output slot as a denylist instead (if you know only some specific blocks bypass inventory APIs)");
|
||||
enchanterOutputFilterlist = config.getStringList(
|
||||
"enchanterOutputFilterlist",
|
||||
sectionMisc.name,
|
||||
enchanterOutputFilterlist,
|
||||
"These blocks are allowed/denied from pulling from the output slot of an Enchanter (default is allowlist)");
|
||||
}
|
||||
|
||||
public static void checkYetaAccess() {
|
||||
|
||||
@@ -46,7 +46,10 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
|
||||
EntityLivingBase entityPlayer = Minecraft.getMinecraft().thePlayer;
|
||||
Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, entityPlayer);
|
||||
EntityLivingBase viewEntity = Minecraft.getMinecraft().renderViewEntity != null
|
||||
? Minecraft.getMinecraft().renderViewEntity
|
||||
: entityPlayer;
|
||||
Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, viewEntity);
|
||||
|
||||
int brightness = RenderUtil.setTesselatorBrightness(entityPlayer.worldObj, te.xCoord, te.yCoord, te.zCoord);
|
||||
render(x, y, z, lookMat, brightness);
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.enderio.core.common.util.ChatUtil;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.api.tool.IHideFacades;
|
||||
@@ -76,7 +77,7 @@ public class ItemConduitProbe extends Item implements IResourceTooltipProvider,
|
||||
}
|
||||
|
||||
if (isCopy && performedAction && player.worldObj.isRemote) {
|
||||
ChatUtil.sendNoSpamClient("Copied conduit settings");
|
||||
ChatUtil.sendNoSpamClientUnloc(EnderIO.lang, "itemConduitProbe.chat.copied");
|
||||
}
|
||||
|
||||
return performedAction;
|
||||
|
||||
@@ -337,32 +337,18 @@ public class KeyTracker {
|
||||
}
|
||||
|
||||
private void handleNightVision() {
|
||||
if (nightVisionKey.isPressed()) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (!DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
|
||||
return;
|
||||
}
|
||||
boolean isActive = !DarkSteelController.instance.isNightVisionActive();
|
||||
if (isActive) {
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + ":ds.nightvision.on",
|
||||
0.1f,
|
||||
player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f,
|
||||
false);
|
||||
} else {
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + ":ds.nightvision.off",
|
||||
0.1f,
|
||||
1.0f,
|
||||
false);
|
||||
}
|
||||
DarkSteelController.instance.setNightVisionActive(isActive);
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (nightVisionKey.isPressed() && DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
|
||||
boolean turningOn = !DarkSteelController.instance.isActive(player, Type.NIGHT_VISION);
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + (turningOn ? ":ds.nightvision.on" : ":ds.nightvision.off"),
|
||||
0.1f,
|
||||
turningOn ? player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f : 1.0f,
|
||||
false);
|
||||
toggleDarkSteelController(Type.NIGHT_VISION, "darksteel.upgrade.nightVision");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package crazypants.enderio.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.ChatUtil;
|
||||
import com.gtnewhorizon.gtnhlib.chat.customcomponents.ChatComponentItemName;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -32,22 +38,23 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketConduitProbe implements IMessage, IMessageHandler<PacketConduitProbe, IMessage> {
|
||||
|
||||
private static final String OF = " " + EnderIO.lang.localize("gui.powerMonitor.of") + " ";
|
||||
private static final String CON_STORAGE = " " + EnderIO.lang.localize("gui.powerMonitor.monHeading1") + ": ";
|
||||
private static final String CAP_BANK_STOR = " " + EnderIO.lang.localize("gui.powerMonitor.monHeading2") + ": ";
|
||||
private static final String MACH_BUF_STOR = " " + EnderIO.lang.localize("gui.powerMonitor.monHeading3") + ": ";
|
||||
private static final String AVE_OUT = " " + EnderIO.lang.localize("gui.powerMonitor.monHeading4") + ": ";
|
||||
private static final String AVE_IN = " " + EnderIO.lang.localize("gui.powerMonitor.monHeading5") + ": ";
|
||||
private static final String OF = "gui.powerMonitor.of";
|
||||
private static final String CON_STORAGE = "gui.powerMonitor.monHeading1";
|
||||
private static final String CAP_BANK_STOR = "gui.powerMonitor.monHeading2";
|
||||
private static final String MACH_BUF_STOR = "gui.powerMonitor.monHeading3";
|
||||
private static final String AVE_OUT = "gui.powerMonitor.monHeading4";
|
||||
private static final String AVE_IN = "gui.powerMonitor.monHeading5";
|
||||
|
||||
private static final String NET_HEADING = EnderIO.lang.localize("gui.mjReader.networkHeading");
|
||||
private static final String CON_BUF = " " + EnderIO.lang.localize("gui.mjReader.conduitBuffer") + ": ";
|
||||
private static final String NET_HEADING = "gui.mjReader.networkHeading";
|
||||
private static final String CON_BUF = "gui.mjReader.conduitBuffer";
|
||||
|
||||
private static final String ITEM_HEADING = EnderIO.lang.localize("gui.mjReader.itemHeading");
|
||||
private static final String ITEM_NO_CONNECTIONS = EnderIO.lang.localize("gui.mjReader.itemNoConnections");
|
||||
private static final String ITEM_HEADING = "gui.mjReader.itemHeading";
|
||||
private static final String ITEM_NO_CONNECTIONS = "gui.mjReader.itemNoConnections";
|
||||
|
||||
private static final String ENERGY_CONDUIT = EnderIO.lang.localize("itemPowerConduit");
|
||||
private static final String REQUEST_RANGE = " " + EnderIO.lang.localize("gui.mjReader.requestRange") + ": ";;
|
||||
private static final String CUR_REQUEST = " " + EnderIO.lang.localize("gui.mjReader.currentRequest") + ": ";;
|
||||
private static final String ENERGY_CONDUIT = "itemPowerConduit.name";
|
||||
private static final String REQUEST_RANGE = "gui.mjReader.requestRange";
|
||||
private static final String CUR_REQUEST = "gui.mjReader.currentRequest";
|
||||
private static final String RF = "power.rf";
|
||||
|
||||
public static boolean canCreatePacket(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
@@ -154,191 +161,127 @@ public class PacketConduitProbe implements IMessage, IMessageHandler<PacketCondu
|
||||
}
|
||||
|
||||
public static void sendInfoMessage(EntityPlayer player, IItemConduit conduit, ItemStack input) {
|
||||
String color = "\u00A7a ";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(color);
|
||||
List<IChatComponent> lines = new ArrayList<>();
|
||||
|
||||
if (conduit.getExternalConnections().isEmpty()) {
|
||||
sb.append(ITEM_HEADING);
|
||||
sb.append(" ");
|
||||
sb.append(ITEM_NO_CONNECTIONS);
|
||||
sb.append("\n");
|
||||
lines.add(
|
||||
line(EnumChatFormatting.GREEN).appendSibling(tr(ITEM_HEADING)).appendText(" ")
|
||||
.appendSibling(tr(ITEM_NO_CONNECTIONS)));
|
||||
} else {
|
||||
for (ForgeDirection dir : conduit.getExternalConnections()) {
|
||||
ConnectionMode mode = conduit.getConnectionMode(dir);
|
||||
|
||||
sb.append(ITEM_HEADING);
|
||||
sb.append(" ");
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.connectionDir"));
|
||||
sb.append(" ");
|
||||
sb.append(dir);
|
||||
sb.append("\n");
|
||||
lines.add(
|
||||
line(EnumChatFormatting.GREEN).appendSibling(tr(ITEM_HEADING)).appendText(" ")
|
||||
.appendSibling(tr("gui.mjReader.connectionDir")).appendText(" " + dir));
|
||||
|
||||
ItemConduitNetwork icn = (ItemConduitNetwork) conduit.getNetwork();
|
||||
if (icn != null && mode.acceptsInput()) {
|
||||
color = "\u00A79 ";
|
||||
sb.append(color);
|
||||
|
||||
IChatComponent line = line(EnumChatFormatting.BLUE);
|
||||
if (input == null) {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.extractedItems"));
|
||||
line.appendSibling(tr("gui.mjReader.extractedItems"));
|
||||
} else {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.extractedItem"));
|
||||
sb.append(" ");
|
||||
sb.append(input.getDisplayName());
|
||||
line.appendSibling(tr("gui.mjReader.extractedItem")).appendText(" ")
|
||||
.appendSibling(new ChatComponentItemName(input));
|
||||
}
|
||||
sb.append(" ");
|
||||
List<String> targets = icn
|
||||
line.appendText(" ");
|
||||
List<IChatComponent> targets = icn
|
||||
.getTargetsForExtraction(conduit.getLocation().getLocation(dir), conduit, input);
|
||||
if (targets.isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.noOutputs"));
|
||||
sb.append(".\n");
|
||||
lines.add(line.appendSibling(tr("gui.mjReader.noOutputs")).appendText("."));
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.insertedInto"));
|
||||
sb.append("\n");
|
||||
for (String str : targets) {
|
||||
sb.append(" - ");
|
||||
sb.append(str);
|
||||
sb.append(" ");
|
||||
sb.append("\n");
|
||||
lines.add(line.appendSibling(tr("gui.mjReader.insertedInto")));
|
||||
for (IChatComponent target : targets) {
|
||||
lines.add(new ChatComponentText(" - ").appendSibling(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (icn != null && mode.acceptsOutput()) {
|
||||
color = "\u00A79 ";
|
||||
sb.append(color);
|
||||
|
||||
List<String> targets = icn.getInputSourcesFor(conduit, dir, input);
|
||||
IChatComponent line = line(EnumChatFormatting.BLUE);
|
||||
List<IChatComponent> targets = icn.getInputSourcesFor(conduit, dir, input);
|
||||
if (targets.isEmpty()) {
|
||||
if (input == null) {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.noItems"));
|
||||
line.appendSibling(tr("gui.mjReader.noItems"));
|
||||
} else {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.noItem"));
|
||||
sb.append(" ");
|
||||
sb.append(input.getDisplayName());
|
||||
line.appendSibling(tr("gui.mjReader.noItem")).appendText(" ")
|
||||
.appendSibling(new ChatComponentItemName(input));
|
||||
}
|
||||
lines.add(line);
|
||||
} else {
|
||||
if (input == null) {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.receiveItems"));
|
||||
line.appendSibling(tr("gui.mjReader.receiveItems"));
|
||||
} else {
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.receiveItem1"));
|
||||
sb.append(" ");
|
||||
sb.append(input.getDisplayName());
|
||||
sb.append(" ");
|
||||
sb.append(EnderIO.lang.localize("gui.mjReader.receiveItem2"));
|
||||
line.appendSibling(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("gui.mjReader.receiveItem"),
|
||||
new ChatComponentItemName(input)));
|
||||
}
|
||||
sb.append("\n");
|
||||
for (String str : targets) {
|
||||
sb.append(" - ");
|
||||
sb.append(str);
|
||||
sb.append("\n");
|
||||
lines.add(line);
|
||||
for (IChatComponent target : targets) {
|
||||
lines.add(new ChatComponentText(" - ").appendSibling(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] lines = sb.toString().split("\n");
|
||||
ChatUtil.sendNoSpam(player, lines);
|
||||
ChatUtil.sendNoSpam(player, lines.toArray(new IChatComponent[0]));
|
||||
}
|
||||
|
||||
private static IChatComponent tr(String key) {
|
||||
return new ChatComponentTranslation(EnderIO.lang.addPrefix(key));
|
||||
}
|
||||
|
||||
private static IChatComponent line(EnumChatFormatting color) {
|
||||
IChatComponent line = new ChatComponentText(" ");
|
||||
line.getChatStyle().setColor(color);
|
||||
return line;
|
||||
}
|
||||
|
||||
private static IChatComponent power(long amount, long max) {
|
||||
return new ChatComponentText(PowerDisplayUtil.formatPower(amount) + " ").appendSibling(tr(OF))
|
||||
.appendText(" " + PowerDisplayUtil.formatPower(max) + " ").appendSibling(tr(RF));
|
||||
}
|
||||
|
||||
private static IChatComponent label(String key) {
|
||||
return new ChatComponentText(" ").appendSibling(tr(key)).appendText(": ");
|
||||
}
|
||||
|
||||
public static void sendInfoMessage(EntityPlayer player, NetworkPowerManager pm) {
|
||||
PowerTracker tracker = pm.getNetworkPowerTracker();
|
||||
String color = "\u00A7a ";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(color);
|
||||
sb.append(NET_HEADING);
|
||||
sb.append("\n");
|
||||
|
||||
color = "\u00A79 ";
|
||||
sb.append(color);
|
||||
sb.append(CON_STORAGE);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getPowerInConduits()));
|
||||
sb.append(OF);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getMaxPowerInConduits()));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
sb.append(CAP_BANK_STOR);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getPowerInCapacitorBanks()));
|
||||
sb.append(OF);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getMaxPowerInCapacitorBanks()));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
sb.append(MACH_BUF_STOR);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getPowerInReceptors()));
|
||||
sb.append(OF);
|
||||
sb.append(PowerDisplayUtil.formatPower(pm.getMaxPowerInReceptors()));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
sb.append(AVE_OUT);
|
||||
sb.append(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickSent()));
|
||||
sb.append("\n");
|
||||
sb.append(AVE_IN);
|
||||
sb.append(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickRecieved()));
|
||||
|
||||
String[] lines = sb.toString().split("\n");
|
||||
ChatUtil.sendNoSpam(player, lines);
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
line(EnumChatFormatting.GREEN).appendSibling(tr(NET_HEADING)),
|
||||
line(EnumChatFormatting.BLUE).appendSibling(label(CON_STORAGE))
|
||||
.appendSibling(power(pm.getPowerInConduits(), pm.getMaxPowerInConduits())),
|
||||
label(CAP_BANK_STOR)
|
||||
.appendSibling(power(pm.getPowerInCapacitorBanks(), pm.getMaxPowerInCapacitorBanks())),
|
||||
label(MACH_BUF_STOR).appendSibling(power(pm.getPowerInReceptors(), pm.getMaxPowerInReceptors())),
|
||||
label(AVE_OUT).appendText(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickSent())),
|
||||
label(AVE_IN).appendText(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickRecieved())));
|
||||
}
|
||||
|
||||
public static void sendPowerConduitInfo(EntityPlayer player, IPowerConduit con, PowerTracker tracker) {
|
||||
String color = "\u00A7a ";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(color);
|
||||
sb.append(ENERGY_CONDUIT);
|
||||
|
||||
color = "\u00A79 ";
|
||||
sb.append(color);
|
||||
sb.append(CON_BUF);
|
||||
sb.append(PowerDisplayUtil.formatPower(con.getEnergyStored()));
|
||||
sb.append(OF);
|
||||
sb.append(PowerDisplayUtil.formatPower(con.getMaxEnergyStored()));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
sb.append(AVE_OUT);
|
||||
sb.append(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickSent()));
|
||||
sb.append("\n");
|
||||
sb.append(AVE_IN);
|
||||
sb.append(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickRecieved()));
|
||||
|
||||
String[] lines = sb.toString().split("\n");
|
||||
ChatUtil.sendNoSpam(player, lines);
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
line(EnumChatFormatting.GREEN).appendSibling(tr(ENERGY_CONDUIT)).appendSibling(
|
||||
line(EnumChatFormatting.BLUE).appendSibling(label(CON_BUF))
|
||||
.appendSibling(power(con.getEnergyStored(), con.getMaxEnergyStored()))),
|
||||
label(AVE_OUT).appendText(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickSent())),
|
||||
label(AVE_IN).appendText(PowerDisplayUtil.formatPowerFloat(tracker.getAverageRfTickRecieved())));
|
||||
}
|
||||
|
||||
private void sendPowerReciptorInfo(EntityPlayer player, Block block, int stored, int maxStored, int minRec,
|
||||
int maxRec, int request) {
|
||||
String color = "\u00A7a ";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(color);
|
||||
sb.append(block.getLocalizedName());
|
||||
|
||||
color = "\u00A79 ";
|
||||
sb.append(color);
|
||||
sb.append(CON_BUF);
|
||||
sb.append(PowerDisplayUtil.formatPower(stored));
|
||||
sb.append(OF);
|
||||
sb.append(PowerDisplayUtil.formatPower(maxStored));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
|
||||
sb.append(REQUEST_RANGE);
|
||||
sb.append(PowerDisplayUtil.formatPower(minRec));
|
||||
sb.append(" - ");
|
||||
sb.append(PowerDisplayUtil.formatPower(maxRec));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
sb.append("\n");
|
||||
|
||||
sb.append(CUR_REQUEST);
|
||||
sb.append(PowerDisplayUtil.formatPower(request));
|
||||
sb.append(" ");
|
||||
sb.append(PowerDisplayUtil.abrevation());
|
||||
|
||||
String[] lines = sb.toString().split("\n");
|
||||
ChatUtil.sendNoSpam(player, lines);
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
line(EnumChatFormatting.GREEN)
|
||||
.appendSibling(new ChatComponentTranslation(block.getUnlocalizedName() + ".name"))
|
||||
.appendSibling(
|
||||
line(EnumChatFormatting.BLUE).appendSibling(label(CON_BUF))
|
||||
.appendSibling(power(stored, maxStored))),
|
||||
label(REQUEST_RANGE).appendText(
|
||||
PowerDisplayUtil.formatPower(minRec) + " - " + PowerDisplayUtil.formatPower(maxRec) + " ")
|
||||
.appendSibling(tr(RF)),
|
||||
label(CUR_REQUEST).appendText(PowerDisplayUtil.formatPower(request) + " ").appendSibling(tr(RF)));
|
||||
}
|
||||
}
|
||||
@@ -107,9 +107,6 @@ public class DarkSteelController {
|
||||
|
||||
private final Map<UUID, EnumSet<Type>> allActive = new HashMap<>();
|
||||
|
||||
private boolean nightVisionActive = false;
|
||||
private boolean removeNightvision = false;
|
||||
|
||||
private DarkSteelController() {
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketDarkSteelPowerPacket.class,
|
||||
@@ -196,6 +193,8 @@ public class DarkSteelController {
|
||||
updateSwim(player);
|
||||
|
||||
updateSolar(player);
|
||||
|
||||
updateNightvision(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +446,6 @@ public class DarkSteelController {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
updateNightvision(player);
|
||||
if (player.capabilities.isFlying) {
|
||||
return;
|
||||
}
|
||||
@@ -569,16 +567,20 @@ public class DarkSteelController {
|
||||
}
|
||||
|
||||
private void updateNightvision(EntityPlayer player) {
|
||||
if (isNightVisionUpgradeOrEnchEquipped(player) && nightVisionActive) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 210, 0, true));
|
||||
if (player.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (!isNightVisionUpgradeOrEnchEquipped(player) && nightVisionActive) {
|
||||
nightVisionActive = false;
|
||||
removeNightvision = true;
|
||||
}
|
||||
if (removeNightvision) {
|
||||
PotionEffect effect = player.getActivePotionEffect(Potion.nightVision);
|
||||
boolean hasNVUpgrade = isNightVisionUpgradeOrEnchEquipped(player);
|
||||
boolean isNVUpgradeEnabled = isActive(player, Type.NIGHT_VISION);
|
||||
if (hasNVUpgrade && isNVUpgradeEnabled) {
|
||||
// only (re)apply effect if ours is missing or about to expire
|
||||
if (effect == null || (effect.getIsAmbient() && effect.getDuration() < 220)) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 400, 0, true));
|
||||
}
|
||||
} else if (effect != null && effect.getIsAmbient() && (hasNVUpgrade || isNVUpgradeEnabled)) {
|
||||
// if our effect exists and the player removed the upgrade item or toggled it off (both can't be true here)
|
||||
player.removePotionEffect(Potion.nightVision.getId());
|
||||
removeNightvision = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,21 +615,9 @@ public class DarkSteelController {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
public boolean isNightVisionUpgradeOrEnchEquipped(EntityPlayer player) {
|
||||
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||
return (NightVisionUpgrade.loadFromItem(helmet) != null || isNightVisionEnch(helmet));
|
||||
}
|
||||
|
||||
public void setNightVisionActive(boolean isNightVisionActive) {
|
||||
if (nightVisionActive && !isNightVisionActive) {
|
||||
removeNightvision = true;
|
||||
}
|
||||
this.nightVisionActive = isNightVisionActive;
|
||||
}
|
||||
|
||||
public boolean isNightVisionActive() {
|
||||
return nightVisionActive;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ public class PacketUpgradeState implements IMessage, IMessageHandler<PacketUpgra
|
||||
GLIDE,
|
||||
SPEED,
|
||||
STEP_ASSIST,
|
||||
JUMP
|
||||
JUMP,
|
||||
NIGHT_VISION
|
||||
}
|
||||
|
||||
public PacketUpgradeState() {}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class BlockEndermanSkull extends BlockEio implements IInfusionStabiliser
|
||||
TORMENTED("tormented", false),
|
||||
REANIMATED_TORMENTED("reanimatedTormented", true);
|
||||
|
||||
public static final SkullType[] VALUES = values();
|
||||
final String name;
|
||||
final boolean showEyes;
|
||||
|
||||
@@ -74,8 +75,8 @@ public class BlockEndermanSkull extends BlockEio implements IInfusionStabiliser
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
ForgeDirection orint = ForgeDirection.getOrientation(side);
|
||||
if (orint == ForgeDirection.NORTH) {
|
||||
meta = MathHelper.clamp_int(meta, 0, SkullType.values().length - 1);
|
||||
return SkullType.values()[meta].showEyes ? frontIconEyes : frontIcon;
|
||||
meta = MathHelper.clamp_int(meta, 0, SkullType.VALUES.length - 1);
|
||||
return SkullType.VALUES[meta].showEyes ? frontIconEyes : frontIcon;
|
||||
}
|
||||
if (orint == ForgeDirection.UP || orint == ForgeDirection.DOWN || orint == ForgeDirection.SOUTH) {
|
||||
return topIcon;
|
||||
|
||||
@@ -472,10 +472,10 @@ public abstract class AbstractMachineEntity extends TileEntityEio
|
||||
}
|
||||
|
||||
int rsContr = nbtRoot.getInteger("redstoneControlMode");
|
||||
if (rsContr < 0 || rsContr >= RedstoneControlMode.values().length) {
|
||||
if (rsContr < 0 || rsContr >= RedstoneControlMode.VALUES.length) {
|
||||
rsContr = 0;
|
||||
}
|
||||
redstoneControlMode = RedstoneControlMode.values()[rsContr];
|
||||
redstoneControlMode = RedstoneControlMode.VALUES[rsContr];
|
||||
|
||||
if (nbtRoot.hasKey("hasFaces")) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PacketRedstoneMode implements IMessage, IMessageHandler<PacketRedst
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
short ordinal = buf.readShort();
|
||||
mode = RedstoneControlMode.values()[ordinal];
|
||||
mode = RedstoneControlMode.VALUES[ordinal];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ public enum RedstoneControlMode implements ICycleEnum {
|
||||
OFF(IconEIO.REDSTONE_MODE_WITHOUT_SIGNAL),
|
||||
NEVER(IconEIO.REDSTONE_MODE_NEVER);
|
||||
|
||||
public static final RedstoneControlMode[] VALUES = values();
|
||||
|
||||
private final IWidgetIcon icon;
|
||||
|
||||
RedstoneControlMode(IWidgetIcon icon) {
|
||||
@@ -63,20 +65,20 @@ public enum RedstoneControlMode implements ICycleEnum {
|
||||
|
||||
public RedstoneControlMode next() {
|
||||
int ord = ordinal();
|
||||
if (ord == values().length - 1) {
|
||||
if (ord == VALUES.length - 1) {
|
||||
ord = 0;
|
||||
} else {
|
||||
ord++;
|
||||
}
|
||||
return values()[ord];
|
||||
return VALUES[ord];
|
||||
}
|
||||
|
||||
public RedstoneControlMode previous() {
|
||||
int ord = ordinal();
|
||||
ord--;
|
||||
if (ord < 0) {
|
||||
ord = values().length - 1;
|
||||
ord = VALUES.length - 1;
|
||||
}
|
||||
return values()[ord];
|
||||
return VALUES[ord];
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Alloy Smelter";
|
||||
return "tile.blockAlloySmelter.name";
|
||||
}
|
||||
|
||||
public Mode getMode() {
|
||||
|
||||
@@ -26,6 +26,7 @@ public class BlockItemBuffer extends ItemBlockWithMetadata {
|
||||
OMNI(true, true, false),
|
||||
CREATIVE(true, true, true);
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
final boolean hasInventory;
|
||||
final boolean hasPower;
|
||||
final boolean isCreative;
|
||||
@@ -60,14 +61,14 @@ public class BlockItemBuffer extends ItemBlockWithMetadata {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (Type type : Type.values()) {
|
||||
for (Type type : Type.VALUES) {
|
||||
list.add(new ItemStack(item, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return Type.values()[stack.getItemDamage()].getUnlocalizedName();
|
||||
return Type.VALUES[stack.getItemDamage()].getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +79,7 @@ public class BlockItemBuffer extends ItemBlockWithMetadata {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileBuffer) {
|
||||
TileBuffer buffer = ((TileBuffer) te);
|
||||
Type t = Type.values()[metadata];
|
||||
Type t = Type.VALUES[metadata];
|
||||
buffer.setHasInventory(t.hasInventory);
|
||||
buffer.setHasPower(t.hasPower);
|
||||
buffer.setCreative(t.isCreative);
|
||||
|
||||
@@ -33,6 +33,12 @@ public class TileBuffer extends AbstractPowerConsumerEntity implements IPaintabl
|
||||
super(new SlotDefinition(9, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
// getMachineName will return the key without the suffix ".name"
|
||||
return getMachineName() + ".name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return BlockItemBuffer.Type.get(this).getUnlocalizedName();
|
||||
|
||||
@@ -882,12 +882,12 @@ public class TileCapBank extends TileEntityEio
|
||||
}
|
||||
|
||||
if (nbtRoot.hasKey("inputControlMode")) {
|
||||
inputControlMode = RedstoneControlMode.values()[nbtRoot.getShort("inputControlMode")];
|
||||
inputControlMode = RedstoneControlMode.VALUES[nbtRoot.getShort("inputControlMode")];
|
||||
} else {
|
||||
inputControlMode = RedstoneControlMode.IGNORE;
|
||||
}
|
||||
if (nbtRoot.hasKey("outputControlMode")) {
|
||||
outputControlMode = RedstoneControlMode.values()[nbtRoot.getShort("outputControlMode")];
|
||||
outputControlMode = RedstoneControlMode.VALUES[nbtRoot.getShort("outputControlMode")];
|
||||
} else {
|
||||
outputControlMode = RedstoneControlMode.IGNORE;
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ public class NetworkState {
|
||||
buf.readInt(),
|
||||
buf.readInt(),
|
||||
buf.readInt(),
|
||||
RedstoneControlMode.values()[buf.readShort()],
|
||||
RedstoneControlMode.values()[buf.readShort()],
|
||||
RedstoneControlMode.VALUES[buf.readShort()],
|
||||
RedstoneControlMode.VALUES[buf.readShort()],
|
||||
buf.readBoolean() ? BlockCoord.readFromBuf(buf) : null,
|
||||
buf.readFloat(),
|
||||
buf.readFloat());
|
||||
|
||||
@@ -39,8 +39,8 @@ public class PacketGuiChange extends PacketCapBank<PacketGuiChange, IMessage> {
|
||||
super.fromBytes(buf);
|
||||
maxSend = buf.readInt();
|
||||
maxRec = buf.readInt();
|
||||
inputMode = RedstoneControlMode.values()[buf.readShort()];
|
||||
outputMode = RedstoneControlMode.values()[buf.readShort()];
|
||||
inputMode = RedstoneControlMode.VALUES[buf.readShort()];
|
||||
outputMode = RedstoneControlMode.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,6 +54,11 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
|
||||
setCapacitor(new BasicCapacitor(0, io * 4, refCap.getMaxEnergyStored(), io));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockCrafter.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockCrafter.unlocalisedName;
|
||||
|
||||
@@ -152,8 +152,9 @@ public class CrusherRecipeManager {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
MachineRecipeInput[] machineInputs = { new MachineRecipeInput(0, input) };
|
||||
for (Recipe recipe : recipes) {
|
||||
if (recipe.isInputForRecipe(new MachineRecipeInput(0, input))) {
|
||||
if (recipe.isInputForRecipe(machineInputs)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockSagMill.unlocalisedName;
|
||||
return "tile.blockSagMill.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,6 +68,11 @@ public class ContainerEnchanter extends ContainerEnderTileEntity<TileEnchanter>
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return te.getOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package crazypants.enderio.machine.enchanter;
|
||||
|
||||
import static crazypants.enderio.EnderIO.hasAutomagy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -11,16 +9,20 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.geometry.CubeIterator;
|
||||
|
||||
import crazypants.enderio.ModObject;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.obelisk.xp.TileExperienceObelisk;
|
||||
import crazypants.enderio.xp.ExperienceContainer;
|
||||
import crazypants.enderio.xp.XpUtil;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import tuhljin.automagy.tiles.TileEntityJarXP;
|
||||
|
||||
public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
@@ -28,6 +30,8 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
private final ItemStack[] inv = new ItemStack[3];
|
||||
private byte[] stacksizes = new byte[2];
|
||||
|
||||
private IntList cachedXPsources = new IntArrayList();
|
||||
|
||||
private short facing = (short) ForgeDirection.NORTH.ordinal();
|
||||
|
||||
public void setFacing(short s) {
|
||||
@@ -65,6 +69,9 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
root.setTag("Items", itemList);
|
||||
root.setByteArray("SizeCache", stacksizes);
|
||||
root.setShort("facing", facing);
|
||||
root.setIntArray(
|
||||
"XpCache",
|
||||
(cachedXPsources.size() <= 200 ? cachedXPsources : cachedXPsources.subList(0, 200)).toIntArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,6 +89,11 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
stacksizes = root.getByteArray("SizeCache");
|
||||
if (stacksizes == null || stacksizes.length < 2) stacksizes = new byte[2];
|
||||
facing = root.getShort("facing");
|
||||
cachedXPsources.clear();
|
||||
int[] xpcache = root.getIntArray("XpCache");
|
||||
if (xpcache != null) {
|
||||
cachedXPsources.addAll(IntList.of(xpcache));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,9 +108,10 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
if (slot < 0 || slot >= inv.length) {
|
||||
if (slot < 0 || slot > inv.length - 1) {
|
||||
return null;
|
||||
}
|
||||
if (slot == 2 && !doesCraftHaveXP()) return null;
|
||||
return inv[slot];
|
||||
}
|
||||
|
||||
@@ -130,69 +143,97 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
return result;
|
||||
}
|
||||
|
||||
// part of the next method
|
||||
public boolean absorbXP(int amt) {
|
||||
if (inv[2] == null || amt <= 0 || inv[2].stackSize < amt) return true;
|
||||
public boolean doesCraftHaveXP() {
|
||||
if (inv[2] == null) return false;
|
||||
int LV = getCurrentEnchantmentCost();
|
||||
if (LV == 0) return false;
|
||||
int xpCost = XpUtil.getExperienceForLevel(LV * amt);
|
||||
int xp;
|
||||
absorb: {
|
||||
ArrayList<ExperienceContainer> obelisksToEmpty = new ArrayList<>();
|
||||
if (true) {
|
||||
CubeIterator iter = new CubeIterator(8);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
if (worldObj.getTileEntity(
|
||||
iter.n + xCoord,
|
||||
iter.l + yCoord,
|
||||
iter.m + zCoord) instanceof TileExperienceObelisk obelisk) {
|
||||
ExperienceContainer cont = obelisk.getContainer();
|
||||
xp = cont.getExperienceTotal();
|
||||
if (xp >= xpCost) {
|
||||
if (!worldObj.isRemote) {
|
||||
obelisksToEmpty.forEach(o -> o.drain(null, Integer.MAX_VALUE, true));
|
||||
cont.drain(null, Integer.MAX_VALUE, true);
|
||||
cont.addExperience(Math.max(0, xp - xpCost));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
xpCost -= xp;
|
||||
obelisksToEmpty.add(cont);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAutomagy) {
|
||||
ArrayList<TileEntityJarXP> jarsToEmpty = new ArrayList<>();
|
||||
CubeIterator iter = new CubeIterator(8);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
if (worldObj.getTileEntity(
|
||||
iter.n + xCoord,
|
||||
iter.l + yCoord,
|
||||
iter.m + zCoord) instanceof TileEntityJarXP jar) {
|
||||
xp = jar.getXP();
|
||||
if (xp >= xpCost) {
|
||||
if (!worldObj.isRemote) {
|
||||
obelisksToEmpty.forEach(o -> o.drain(null, Integer.MAX_VALUE, true));
|
||||
jarsToEmpty.forEach(j -> j.setXP(0));
|
||||
jar.setXP(xp - xpCost);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
xpCost -= xp;
|
||||
jarsToEmpty.add(jar);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (LV == 0) return true;
|
||||
return checkAndCacheXPSources(XpUtil.getExperienceForLevel(LV));
|
||||
}
|
||||
|
||||
// checks AND drains XP; returns true if xp is NOT sufficient
|
||||
private boolean checkAndCacheXPSources(int xpCost) {
|
||||
if (drainFromCache(xpCost, false)) return true;
|
||||
cachedXPsources.clear();
|
||||
int xp;
|
||||
CubeIterator iter;
|
||||
iter = new CubeIterator(8);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
int x = iter.n + xCoord;
|
||||
int y = iter.l + yCoord;
|
||||
int z = iter.m + zCoord;
|
||||
if (!worldObj.blockExists(x, y, z)) continue;
|
||||
final TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
if (te instanceof TileExperienceObelisk obelisk) {
|
||||
ExperienceContainer cont = obelisk.getContainer();
|
||||
xp = cont.getExperienceTotal();
|
||||
if (xp != 0) cachedXPsources.add(((iter.n & 0xff) << 16) + ((iter.l & 0xff) << 8) + (iter.m & 0xff));
|
||||
if (xp >= xpCost) return true;
|
||||
xpCost -= xp;
|
||||
} else if (hasAutomagy && te instanceof TileEntityJarXP jar) {
|
||||
xp = jar.getXP();
|
||||
if (xp != 0) cachedXPsources.add(((iter.n & 0xff) << 16) + ((iter.l & 0xff) << 8) + (iter.m & 0xff));
|
||||
if (xp >= xpCost) return true;
|
||||
xpCost -= xp;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean drainFromCache(int xpCost, boolean actual) {
|
||||
ExperienceContainer cont;
|
||||
int len = cachedXPsources.size();
|
||||
if (len == 0) return false;
|
||||
for (int ind = 0; ind < len; ind++) {
|
||||
int nlm = cachedXPsources.getInt(ind);
|
||||
int z = (byte) nlm + zCoord;
|
||||
int y = (byte) (nlm >>= 8) + yCoord;
|
||||
int x = (byte) (nlm >>= 8) + xCoord;
|
||||
if (!worldObj.blockExists(x, y, z)) continue;
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
if (te instanceof TileExperienceObelisk obelisk) {
|
||||
cont = obelisk.getContainer();
|
||||
int xp = cont.getExperienceTotal();
|
||||
if (xp == 0) continue;
|
||||
if (actual) cont.drain(null, Integer.MAX_VALUE, true);
|
||||
int ebx = xp - xpCost;
|
||||
if (ebx < 0) {
|
||||
xpCost = -ebx;
|
||||
continue;
|
||||
}
|
||||
if (actual) cont.addExperience(ebx);
|
||||
return true;
|
||||
}
|
||||
if (hasAutomagy && te instanceof TileEntityJarXP jar) {
|
||||
int xp = jar.getXP();
|
||||
if (xp == 0) continue;
|
||||
int ebx = xp - xpCost; // 5head JIT optimization
|
||||
if (ebx < 0) {
|
||||
xpCost = -ebx;
|
||||
if (actual) jar.setXP(0);
|
||||
continue;
|
||||
}
|
||||
if (actual) jar.setXP(ebx);
|
||||
return true;
|
||||
}
|
||||
cachedXPsources.removeInt(ind);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// part of the next method
|
||||
private boolean absorbXP(int amt) {
|
||||
if (inv[2] == null) return false;
|
||||
int LV = getCurrentEnchantmentCost();
|
||||
if (LV == 0) return true;
|
||||
int xpCost = XpUtil.getExperienceForLevel(LV * amt);
|
||||
if (!checkAndCacheXPSources(xpCost)) return false;
|
||||
return drainFromCache(xpCost, !worldObj.isRemote);
|
||||
}
|
||||
|
||||
// checks AND drains XP; returns false if xp is not sufficient
|
||||
// also removes the items from the other two slots when automation does the recipe
|
||||
public boolean checkAndDrainXP(int amt) {
|
||||
if (absorbXP(amt)) return true;
|
||||
private boolean checkAndDrainXP(int amt) {
|
||||
if (!absorbXP(amt)) return false;
|
||||
EnchantmentData enchData = getCurrentEnchantmentData();
|
||||
EnchanterRecipe recipe = getCurrentEnchantmentRecipe();
|
||||
ItemStack curStack = inv[1];
|
||||
@@ -212,7 +253,7 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
if (!worldObj.isRemote) {
|
||||
worldObj.playSoundEffect(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d, "random.anvil_land", 0.2f, 1.0f);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,6 +263,15 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack contents) {
|
||||
if (slot == 2) {
|
||||
if (inv[2] == null || inv[2].stackSize <= 0
|
||||
|| contents != null && contents.stackSize > 0
|
||||
&& contents.getItem() == Items.enchanted_book
|
||||
&& contents.stackSize == inv[2].stackSize)
|
||||
return;
|
||||
if (checkAndDrainXP(1)) Log.warn("Potentially duped books at: " + xCoord + " " + yCoord + " " + zCoord);
|
||||
// return;
|
||||
} ;
|
||||
if (contents == null) {
|
||||
inv[slot] = contents;
|
||||
} else {
|
||||
@@ -240,15 +290,16 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
output = new ItemStack(Items.enchanted_book);
|
||||
Items.enchanted_book.addEnchantment(output, enchantment);
|
||||
}
|
||||
setOutput(output);
|
||||
|
||||
if (inv[0] != null) stacksizes[0] = (byte) inv[0].stackSize;
|
||||
if (inv[1] != null) stacksizes[1] = (byte) inv[1].stackSize;
|
||||
|
||||
setOutput(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockEnchanter.unlocalisedName;
|
||||
return "tile.blockEnchanter.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -388,18 +439,34 @@ public class TileEnchanter extends TileEntityEio implements ISidedInventory {
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return inv[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == 0 ? new int[] { 2 } : new int[] { 0, 1 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
return true;
|
||||
public boolean canInsertItem(int slot, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
return slot == 0 || slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
return true;
|
||||
public boolean canExtractItem(int slot, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
return slot == 2 ? isAllowedBlockBeneath() : true;
|
||||
}
|
||||
|
||||
public boolean isAllowedBlockBeneath() {
|
||||
if (!Config.enchanterOutputEnableBlockRestriction) return true;
|
||||
var blockBeneath = worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
for (String blocknam : Config.enchanterOutputFilterlist) {
|
||||
String[] splitname = blocknam.split(":", 1);
|
||||
if (GameRegistry.findBlock(splitname[0], splitname[1]) != blockBeneath) continue;
|
||||
return !Config.enchanterOutputAllowlistAsDenylist;
|
||||
}
|
||||
return Config.enchanterOutputAllowlistAsDenylist;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -822,7 +822,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return EnderIO.blockFarmStation.getLocalizedName();
|
||||
return "tile.blockFarmStation.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
@@ -90,6 +90,11 @@ public class TileCombustionGenerator extends AbstractGeneratorEntity implements
|
||||
return mode != IoMode.PUSH && mode != IoMode.PUSH_PULL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockCombustionGenerator.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockCombustionGenerator.unlocalisedName;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class TileEntityStirlingGenerator extends AbstractGeneratorEntity impleme
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Stirling Generator";
|
||||
return "tile.blockStirlingGenerator.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,6 +93,11 @@ public class TileZombieGenerator extends AbstractGeneratorEntity
|
||||
minimumTankLevel = (int) (fuelTank.getCapacity() * 0.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockZombieGenerator.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockZombieGenerator.unlocalisedName;
|
||||
|
||||
+7
-9
@@ -4,7 +4,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -33,7 +32,6 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick) {
|
||||
|
||||
World world = te.getWorldObj();
|
||||
TileZombieGenerator gen = (TileZombieGenerator) te;
|
||||
|
||||
@@ -104,26 +102,26 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
}
|
||||
|
||||
private void renderModel(GeneratorType gen, int facing) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef(0.5F, 0, 0.5F);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0.5f, 0, 0.5f);
|
||||
GL11.glRotatef(180f, 1f, 0f, 0f);
|
||||
GL11.glScalef(1.2f, 0.9f, 1.2f);
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(facing);
|
||||
if (dir == ForgeDirection.SOUTH) {
|
||||
facing = 0;
|
||||
|
||||
} else if (dir == ForgeDirection.WEST) {
|
||||
facing = -1;
|
||||
}
|
||||
GL11.glRotatef(facing * -90F, 0F, 1F, 0F);
|
||||
GL11.glRotatef(facing * -90f, 0f, 1f, 0f);
|
||||
|
||||
// Move the model in center of block
|
||||
GL11.glTranslatef(0.0f, 0.0f, -0.0625f);
|
||||
|
||||
RenderUtil.bindTexture(gen.getTexture());
|
||||
model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.0625f);
|
||||
|
||||
GL11.glTranslatef(-0.5F, 0, -0.5F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.InventoryWrapper;
|
||||
|
||||
import crazypants.enderio.ModObject;
|
||||
|
||||
public class CompositeInventory implements ISidedInventory {
|
||||
|
||||
private final List<InvEntry> inventories = new ArrayList<>();
|
||||
@@ -157,7 +155,7 @@ public class CompositeInventory implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockHyperCube.unlocalisedName;
|
||||
return "tile.blockHyperCube.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.enderio.core.common.util.PlayerUtil;
|
||||
import com.enderio.core.common.vecmath.VecmathUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
@@ -769,7 +768,7 @@ public class TileHyperCube extends TileEntityEio
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockHyperCube.unlocalisedName;
|
||||
return "tile.blockHyperCube.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -826,7 +825,7 @@ public class TileHyperCube extends TileEntityEio
|
||||
recieveBuffer.readFromNBT(nbtRoot);
|
||||
|
||||
if (nbtRoot.hasKey("rsMode")) {
|
||||
redstoneControlMode = RedstoneControlMode.values()[nbtRoot.getShort("rsMode")];
|
||||
redstoneControlMode = RedstoneControlMode.VALUES[nbtRoot.getShort("rsMode")];
|
||||
} else {
|
||||
redstoneControlMode = RedstoneControlMode.IGNORE;
|
||||
}
|
||||
|
||||
@@ -369,6 +369,11 @@ public class TileInventoryPanel extends AbstractMachineEntity implements IFluidH
|
||||
nbtRoot.setBoolean("active", active);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockInventoryPanel.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockInventoryPanel.unlocalisedName;
|
||||
|
||||
@@ -16,50 +16,53 @@ class NormalInventory extends AbstractInventory {
|
||||
@Override
|
||||
int scanInventory(InventoryDatabaseServer db) {
|
||||
ISidedInventory inv = ni.getInventoryRecheck();
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices == null || slotIndices.length == 0) {
|
||||
setEmpty(db);
|
||||
return 0;
|
||||
}
|
||||
int count = slotIndices.length;
|
||||
if (count != slotKeys.length) {
|
||||
reset(db, count);
|
||||
}
|
||||
for (int slot = 0; slot < count; slot++) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && !inv.canExtractItem(invSlot, stack, side)) {
|
||||
stack = null;
|
||||
if (inv != null) {
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices != null && slotIndices.length > 0) {
|
||||
int count = slotIndices.length;
|
||||
if (count != slotKeys.length) {
|
||||
reset(db, count);
|
||||
}
|
||||
for (int slot = 0; slot < count; slot++) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && !inv.canExtractItem(invSlot, stack, side)) {
|
||||
stack = null;
|
||||
}
|
||||
updateSlot(db, slot, stack);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
updateSlot(db, slot, stack);
|
||||
}
|
||||
return count;
|
||||
|
||||
setEmpty(db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) {
|
||||
ISidedInventory inv = ni.getInventoryRecheck();
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices == null || slot >= slotIndices.length) {
|
||||
return 0;
|
||||
if (inv != null) {
|
||||
int side = ni.getInventorySide();
|
||||
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
|
||||
if (slotIndices != null && slot < slotIndices.length) {
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack != null && inv.canExtractItem(invSlot, stack, side)
|
||||
&& db.lookupItem(stack, entry, false) == entry) {
|
||||
int remaining = stack.stackSize;
|
||||
if (count > remaining) {
|
||||
count = remaining;
|
||||
}
|
||||
ni.itemExtracted(invSlot, count);
|
||||
remaining -= count;
|
||||
updateCount(db, slot, entry, remaining);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
int invSlot = slotIndices[slot];
|
||||
ItemStack stack = inv.getStackInSlot(invSlot);
|
||||
if (stack == null || !inv.canExtractItem(invSlot, stack, side)) {
|
||||
return 0;
|
||||
}
|
||||
if (db.lookupItem(stack, entry, false) != entry) {
|
||||
return 0;
|
||||
}
|
||||
int remaining = stack.stackSize;
|
||||
if (count > remaining) {
|
||||
count = remaining;
|
||||
}
|
||||
ni.itemExtracted(invSlot, count);
|
||||
remaining -= count;
|
||||
updateCount(db, slot, entry, remaining);
|
||||
return count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -157,6 +157,11 @@ public class TileKillerJoe extends AbstractMachineEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockKillerJoe.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockKillerJoe.unlocalisedName;
|
||||
|
||||
@@ -31,6 +31,7 @@ public class BlockItemElectricLight extends ItemBlockWithMetadata implements IRe
|
||||
WIRELESS("item.itemWirelessLight", false, true, true),
|
||||
WIRELESS_INV("item.itemWirelessLightInverted", true, true, true);
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
final String unlocName;
|
||||
final boolean isInverted;
|
||||
final boolean isPowered;
|
||||
@@ -52,14 +53,14 @@ public class BlockItemElectricLight extends ItemBlockWithMetadata implements IRe
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int meta = par1ItemStack.getItemDamage();
|
||||
meta = MathHelper.clamp_int(meta, 0, Type.values().length - 1);
|
||||
return Type.values()[meta].unlocName;
|
||||
meta = MathHelper.clamp_int(meta, 0, Type.VALUES.length - 1);
|
||||
return Type.VALUES[meta].unlocName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (Type type : Type.values()) {
|
||||
for (Type type : Type.VALUES) {
|
||||
par3List.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
@@ -76,7 +77,7 @@ public class BlockItemElectricLight extends ItemBlockWithMetadata implements IRe
|
||||
if (te instanceof TileElectricLight) {
|
||||
TileElectricLight el = ((TileElectricLight) te);
|
||||
el.setFace(onFace);
|
||||
Type t = Type.values()[metadata];
|
||||
Type t = Type.VALUES[metadata];
|
||||
el.setInverted(t.isInverted);
|
||||
el.setRequiresPower(t.isPowered);
|
||||
el.setWireless(t.isWireless);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class TilePowerMonitor extends AbstractPowerConsumerEntity implements IIn
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return EnderIO.blockPowerMonitor.getUnlocalizedName();
|
||||
return "tile.blockPowerMonitor.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,13 +42,21 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
// Preserve GL state so this custom item renderer does not leak alpha/blend/color
|
||||
// state into subsequent item renders, such as Backhand offhand items.
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_CURRENT_BIT | GL11.GL_LIGHTING_BIT);
|
||||
|
||||
try {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tessellator.draw();
|
||||
} finally {
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -126,6 +126,11 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
|
||||
setCapacitor(new BasicCapacitor(powerPerTick * 8, getCapacitor().getMaxEnergyStored(), powerPerTick));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockAttractor.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockAttractor.unlocalisedName;
|
||||
|
||||
@@ -106,6 +106,11 @@ public class TileAversionObelisk extends AbstractPowerConsumerEntity implements
|
||||
bounds = AxisAlignedBB.getBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSpawnGuard.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSpawnGuard.unlocalisedName;
|
||||
|
||||
@@ -19,6 +19,11 @@ public class TileInhibitorObelisk extends AbstractPowerConsumerEntity implements
|
||||
super(new SlotDefinition(0, 0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockInhibitorObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockInhibitorObelisk.unlocalisedName;
|
||||
|
||||
@@ -121,6 +121,11 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity
|
||||
setCapacitor(Capacitors.ACTIVATED_CAPACITOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockWeatherObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockWeatherObelisk.unlocalisedName;
|
||||
|
||||
@@ -32,6 +32,11 @@ public class TileExperienceObelisk extends AbstractMachineEntity
|
||||
super(new SlotDefinition(0, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockExperienceObelisk.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockExperienceObelisk.unlocalisedName;
|
||||
|
||||
@@ -27,7 +27,6 @@ public class PaintedItemRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
|
||||
if (data != null && data.length > 0) {
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED) {
|
||||
renderEquipped(item, (RenderBlocks) data[0]);
|
||||
@@ -38,9 +37,12 @@ public class PaintedItemRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
public void renderEquipped(ItemStack item, RenderBlocks renderBlocks) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
if (item.getItem() != Item.getItemFromBlock(EnderIO.blockTravelPlatform)) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
renderToInventory(item, renderBlocks);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -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,57 +26,53 @@ 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
|
||||
public String getInventoryName() {
|
||||
return "Auto Painter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
return "tile.blockPainter.name";
|
||||
}
|
||||
|
||||
@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]);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -38,38 +38,46 @@ public class Recipe implements IRecipe {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<RecipeInput> requiredInputs = new ArrayList<>();
|
||||
for (RecipeInput input : inputs) {
|
||||
if (input.getFluidInput() != null || input.getInput() != null) {
|
||||
requiredInputs.add(input.copy());
|
||||
int[] remaining = new int[inputs.length];
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
RecipeInput input = inputs[i];
|
||||
if (input.isFluid()) {
|
||||
remaining[i] = input.getFluidInput().amount;
|
||||
} else if (input.getInput() != null) {
|
||||
remaining[i] = input.getInput().stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
for (MachineRecipeInput input : machineInputs) {
|
||||
if (input != null && (input.fluid != null || input.item != null)) {
|
||||
RecipeInput required = null;
|
||||
for (int i = 0; i < requiredInputs.size() && required == null; i++) {
|
||||
RecipeInput tst = requiredInputs.get(i);
|
||||
if ((tst.isInput(input.item) && tst.getInput().stackSize > 0) || tst.isInput(input.fluid)) {
|
||||
required = tst;
|
||||
}
|
||||
for (MachineRecipeInput machineInput : machineInputs) {
|
||||
if (machineInput == null || (machineInput.item == null && machineInput.fluid == null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int matchedInput = -1;
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
if (remaining[i] <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (required == null) {
|
||||
return false;
|
||||
}
|
||||
// reduce the required input quantity by the available amount
|
||||
if (input.isFluid()) {
|
||||
required.getFluidInput().amount -= input.fluid.amount;
|
||||
} else {
|
||||
required.getInput().stackSize -= input.item.stackSize;
|
||||
|
||||
RecipeInput required = inputs[i];
|
||||
boolean matches = machineInput.isFluid() ? required.isInput(machineInput.fluid)
|
||||
: required.isInput(machineInput.item);
|
||||
|
||||
if (matches) {
|
||||
matchedInput = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RecipeInput required : requiredInputs) {
|
||||
if (required.isFluid() && required.getFluidInput().amount > 0) {
|
||||
if (matchedInput < 0) {
|
||||
return false;
|
||||
} else if (!required.isFluid() && required.getInput().stackSize > 0) {
|
||||
}
|
||||
|
||||
remaining[matchedInput] -= machineInput.isFluid() ? machineInput.fluid.amount : machineInput.item.stackSize;
|
||||
}
|
||||
|
||||
for (int amount : remaining) {
|
||||
if (amount > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,11 @@ public class TileSliceAndSplice extends AbstractPoweredTaskEntity {
|
||||
super(new SlotDefinition(8, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSliceAndSplice.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSliceAndSplice.unlocalisedName;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,8 +4,10 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -22,7 +24,7 @@ import crazypants.enderio.EnderIO;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
public class SoulBinderRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
private static final float skullScale = 0.5f;
|
||||
private final BoundingBox scaledBB = BoundingBox.UNIT_CUBE.scale(skullScale, skullScale, skullScale);
|
||||
@@ -31,13 +33,23 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT | GL11.GL_CURRENT_BIT | GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
try {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
// Move the inventory render slightly down in the slot.
|
||||
GL11.glTranslatef(0.0f, -0.1f, 0.0f);
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tessellator.draw();
|
||||
} finally {
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +109,47 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BlockSoulBinder.renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT | GL11.GL_CURRENT_BIT | GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
try {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
final RenderBlocks renderer = (RenderBlocks) data[0];
|
||||
final Block block = Block.getBlockFromItem(item.getItem());
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
tessellator.draw();
|
||||
} finally {
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private ForgeDirection forFacing(ForgeDirection side, int facing) {
|
||||
return ForgeDirections.DIRECTIONS[ClientProxy.sideAndFacingToSpriteOffset[side.ordinal()][facing]];
|
||||
}
|
||||
@@ -113,14 +166,4 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
icons[dir.ordinal()] = override != null ? override : dir == faceSide ? faceIcon : defaultIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BlockSoulBinder.renderId;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -113,6 +113,11 @@ public class TileSoulBinder extends AbstractPoweredTaskEntity implements IHaveEx
|
||||
return xpCont;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockSoulBinder.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSoulBinder.unlocalisedName;
|
||||
|
||||
@@ -31,6 +31,10 @@ public class BrokenSpawnerRenderer implements IItemRenderer {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
RenderBlocks rb = (RenderBlocks) data[0];
|
||||
rb.setOverrideBlockTexture(EnderIO.itemBrokenSpawner.getIconFromDamage(0));
|
||||
rb.renderBlockAsItem(Blocks.stone, 0, 1);
|
||||
|
||||
@@ -197,6 +197,11 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity implements IRa
|
||||
forceClientUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockPoweredSpawner.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockPoweredSpawner.unlocalisedName;
|
||||
|
||||
@@ -225,6 +225,11 @@ public class TileTank extends AbstractMachineEntity implements IFluidHandler, IT
|
||||
this.voidMode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockTank.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return "tank";
|
||||
|
||||
@@ -157,6 +157,11 @@ public class TileTransceiver extends AbstractPoweredTaskEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "tile.blockTransceiver.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockTransceiver.unlocalisedName;
|
||||
|
||||
+13
-45
@@ -121,24 +121,20 @@ public class TransceiverRenderer extends TileEntitySpecialRenderer implements II
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if (adjustForItem) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderItem(0f, 0f, 0f);
|
||||
return;
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderItem(0f, 1f, 1f);
|
||||
return;
|
||||
case INVENTORY:
|
||||
renderItem(0f, 0f, 0f);
|
||||
return;
|
||||
default:
|
||||
renderItem(0f, 0f, 0f);
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
try {
|
||||
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
if (adjustForItem) {
|
||||
GL11.glTranslatef(0f, 1f, 1f);
|
||||
} else {
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
renderItem(0, 0, 0);
|
||||
|
||||
model.render();
|
||||
} finally {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,32 +164,4 @@ public class TransceiverRenderer extends TileEntitySpecialRenderer implements II
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private void renderItem(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
model.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
// private class OverlayRenderer implements IRenderFace {
|
||||
//
|
||||
// @Override
|
||||
// public void renderFace(CustomRenderBlocks rb, ForgeDirection face, Block par1Block, double x, double y, double
|
||||
// z, IIcon texture, List<Vertex> refVertices,
|
||||
// boolean translateToXyz) {
|
||||
//
|
||||
// ccr.getCustomRenderBlocks().doDefaultRenderFace(face,par1Block,x,y,z,texture);
|
||||
// if(curEnt != null && par1Block instanceof AbstractMachineBlock) {
|
||||
// IoMode mode = curEnt.getIoMode(face);
|
||||
// IIcon tex = ((AbstractMachineBlock)par1Block).getOverlayIconForMode(mode);
|
||||
// if(tex != null) {
|
||||
// ccr.getCustomRenderBlocks().doDefaultRenderFace(face,par1Block,x,y,z, tex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.enderio.core.common.vecmath.Vector3d;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
@@ -212,7 +211,7 @@ public class TileVacuumChest extends TileEntityEio
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockVacuumChest.unlocalisedName;
|
||||
return "tile.blockVacuumChest.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,10 +377,10 @@ public class TileVacuumChest extends TileEntityEio
|
||||
}
|
||||
|
||||
int rsContr = nbtRoot.getInteger("redstoneControlMode");
|
||||
if (rsContr < 0 || rsContr >= RedstoneControlMode.values().length) {
|
||||
if (rsContr < 0 || rsContr >= RedstoneControlMode.VALUES.length) {
|
||||
rsContr = 0;
|
||||
}
|
||||
redstoneControlMode = RedstoneControlMode.values()[rsContr];
|
||||
redstoneControlMode = RedstoneControlMode.VALUES[rsContr];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,9 +23,17 @@ public class VacuumChestRenderer implements ISimpleBlockRenderingHandler, IItemR
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.6, 0.6, 0.6), EnderIO.blockHyperCube.getIcon(0, 0));
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.90, 0.90, 0.90), EnderIO.blockVacuumChest.getIcon(0, 0));
|
||||
|
||||
cr.render(
|
||||
BoundingBox.UNIT_CUBE.scale(0.7f, 0.7f, 0.7f).translate(0f, -0.1f, 0f),
|
||||
EnderIO.blockHyperCube.getIcon(0, 0));
|
||||
|
||||
cr.render(
|
||||
BoundingBox.UNIT_CUBE.scale(1f, 1f, 1f).translate(0f, -0.1f, 0f),
|
||||
EnderIO.blockVacuumChest.getIcon(0, 0));
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler,
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ModObject.blockVat.unlocalisedName;
|
||||
return "tile.blockVat.name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,10 @@ public class WirelessChargedLocation {
|
||||
* use (unless ~4B changes happen in between). Do this instead directly updating so that WirelessChargedLocation
|
||||
* can be used while the TileEntity is still in construction (or loading).
|
||||
*/
|
||||
this.lastChangeCount = EnderIO.proxy.wirelessChargerController.getChangeCount() - 1;
|
||||
// The controller only exists on the server (created in FMLServerAboutToStartEvent), so it is null on
|
||||
// clients connected to a dedicated server. Chargers are only queried server-side, so stay inert there.
|
||||
WirelessChargerController wcc = EnderIO.proxy.wirelessChargerController;
|
||||
this.lastChangeCount = wcc == null ? 0 : wcc.getChangeCount() - 1;
|
||||
}
|
||||
|
||||
private void updateChargers() {
|
||||
@@ -41,7 +44,8 @@ public class WirelessChargedLocation {
|
||||
}
|
||||
|
||||
private void checkChangeCount() {
|
||||
if (lastChangeCount != EnderIO.proxy.wirelessChargerController.getChangeCount()) {
|
||||
WirelessChargerController wcc = EnderIO.proxy.wirelessChargerController;
|
||||
if (wcc != null && lastChangeCount != wcc.getChangeCount()) {
|
||||
updateChargers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public enum FrankenSkull {
|
||||
SKELETAL_CONTRACTOR("skullSkeletalContractor", "enderio:skullSkeletalContractor", false),
|
||||
GUARDIAN_DIODE("skullGuardianDiode", "enderio:skullGuardianDiode", false);
|
||||
|
||||
public static final FrankenSkull[] VALUES = values();
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
public final boolean isAnimated;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ItemFrankenSkull extends Item {
|
||||
setMaxDamage(0);
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemFrankenSkull.unlocalisedName);
|
||||
icons = new IIcon[FrankenSkull.values().length];
|
||||
icons = new IIcon[FrankenSkull.VALUES.length];
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -48,20 +48,20 @@ public class ItemFrankenSkull extends Item {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(FrankenSkull.values()[i].iconKey);
|
||||
icons[i] = IIconRegister.registerIcon(FrankenSkull.VALUES[i].iconKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, FrankenSkull.values().length - 1);
|
||||
return FrankenSkull.values()[i].unlocalisedName;
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, FrankenSkull.VALUES.length - 1);
|
||||
return FrankenSkull.VALUES[i].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (int j = 0; j < FrankenSkull.values().length; ++j) {
|
||||
for (int j = 0; j < FrankenSkull.VALUES.length; ++j) {
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class ItemFrankenSkull extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
|
||||
int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, FrankenSkull.values().length - 1);
|
||||
return FrankenSkull.values()[meta].isAnimated;
|
||||
int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, FrankenSkull.VALUES.length - 1);
|
||||
return FrankenSkull.VALUES[meta].isAnimated;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class ItemMachinePart extends Item {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemMachinePart.unlocalisedName);
|
||||
|
||||
icons = new IIcon[MachinePart.values().length];
|
||||
icons = new IIcon[MachinePart.VALUES.length];
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -41,29 +41,29 @@ public class ItemMachinePart extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, MachinePart.values().length - 1);
|
||||
damage = MathHelper.clamp_int(damage, 0, MachinePart.VALUES.length - 1);
|
||||
return icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numParts = MachinePart.values().length;
|
||||
int numParts = MachinePart.VALUES.length;
|
||||
for (int i = 0; i < numParts; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(MachinePart.values()[i].iconKey);
|
||||
icons[i] = IIconRegister.registerIcon(MachinePart.VALUES[i].iconKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, MachinePart.values().length - 1);
|
||||
return MachinePart.values()[i].unlocalisedName;
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, MachinePart.VALUES.length - 1);
|
||||
return MachinePart.VALUES[i].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (int j = 0; j < MachinePart.values().length; ++j) {
|
||||
for (int j = 0; j < MachinePart.VALUES.length; ++j) {
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public enum MachinePart {
|
||||
SOUL_MACHINE_CHASSIS("soulMachineChassi"),
|
||||
END_STEEL_MACHINE_CHASSIS("endSteelMachineChassi");
|
||||
|
||||
public static final MachinePart[] VALUES = values();
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
public final String oreDict;
|
||||
@@ -24,7 +25,7 @@ public enum MachinePart {
|
||||
}
|
||||
|
||||
public static void registerOres(Item item) {
|
||||
for (MachinePart m : values()) {
|
||||
for (MachinePart m : VALUES) {
|
||||
OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +69,18 @@ public class MachinePartRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
renderBlocks.setOverrideBlockTexture(EnderIO.itemMachinePart.getIconFromDamage(item.getItemDamage()));
|
||||
renderBlocks.renderBlockAsItem(Blocks.stone, 0, 1.0F);
|
||||
renderBlocks.clearOverrideBlockTexture();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
// Preserve GL state so this custom item renderer does not leak alpha/blend/color
|
||||
// state into subsequent item renders, such as Backhand offhand items.
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_CURRENT_BIT | GL11.GL_LIGHTING_BIT);
|
||||
|
||||
try {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
renderBlocks.setOverrideBlockTexture(EnderIO.itemMachinePart.getIconFromDamage(item.getItemDamage()));
|
||||
renderBlocks.renderBlockAsItem(Blocks.stone, 0, 1.0F);
|
||||
} finally {
|
||||
renderBlocks.clearOverrideBlockTexture();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.machine.alloy.GuiAlloySmelter;
|
||||
import crazypants.enderio.machine.recipe.IRecipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -114,7 +115,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
drawProgressBar(99, 31, 166, 0, 22, 13, 48, 3);
|
||||
AlloySmelterRecipe recipe = (AlloySmelterRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 52, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 100, 52, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.machine.enchanter.EnchanterRecipeManager;
|
||||
import crazypants.enderio.machine.enchanter.GuiEnchanter;
|
||||
import crazypants.enderio.machine.enchanter.TileEnchanter;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -113,7 +114,7 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
public void drawExtras(int recipeIndex) {
|
||||
EnchanterRecipeNEI recipe = (EnchanterRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 0x808080, false);
|
||||
GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, ColorUtils.neiEnchantString.getColor(), false);
|
||||
|
||||
int level = 1;
|
||||
List<PositionedStack> ingredients = recipe.getIngredients();
|
||||
|
||||
@@ -25,6 +25,7 @@ import crazypants.enderio.machine.recipe.Recipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.recipe.RecipeOutput;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -123,7 +124,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
MillRecipe recipe = (MillRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 96, 33, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 96, 33, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.machine.slicensplice.ContainerSliceAndSplice;
|
||||
import crazypants.enderio.machine.slicensplice.GuiSliceAndSplice;
|
||||
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -109,7 +110,7 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
SliceAndSpliceRecipe recipe = (SliceAndSpliceRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 57, 0x808080, false);
|
||||
GuiDraw.drawString(energyString, 100, 57, ColorUtils.neiEnergyString.getColor(), false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.soul.GuiSoulBinder;
|
||||
import crazypants.enderio.machine.soul.ISoulBinderRecipe;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -132,7 +133,7 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
SoulBinderRecipeNEI recipe = (SoulBinderRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawStringC(energyString, 83, 45, 0x808080, false);
|
||||
GuiDraw.drawStringC(energyString, 83, 45, ColorUtils.neiEnergyString.getColor(), false);
|
||||
|
||||
int cost = recipe.getExperience();
|
||||
if (cost > 0) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.vat.GuiVat;
|
||||
import crazypants.enderio.machine.vat.VatRecipeManager;
|
||||
import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -183,7 +184,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawStringC(energyString, 86, 54, 0x808080, false);
|
||||
GuiDraw.drawStringC(energyString, 86, 54, ColorUtils.neiEnergyString.getColor(), false);
|
||||
|
||||
Fluid outputFluid = rec.result.getFluid();
|
||||
List<PositionedStack> stacks = rec.getIngredients();
|
||||
@@ -191,7 +192,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
float mult = VatRecipeManager.getInstance()
|
||||
.getMultiplierForInput(rec.inFluid.getFluid(), ps.item, outputFluid);
|
||||
String str = "x" + mult;
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false);
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, ColorUtils.neiMultiplierString.getColor(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,27 +26,33 @@ public class PacketUtil {
|
||||
if (!(container instanceof IContainerWithTileEntity)) {
|
||||
Log.LOGGER.warn(
|
||||
Log.securityMarker,
|
||||
"Player {} tried to send {} while not opening correct GUI. Target TileEntity at {}, {}, {}",
|
||||
"Player {} tried to send {} while not opening correct GUI. Target TileEntity {} at {}, {}, {} in {}. Current container {}",
|
||||
player.getGameProfile(),
|
||||
messageClass.getSimpleName(),
|
||||
receivedTile,
|
||||
receivedTile.xCoord,
|
||||
receivedTile.yCoord,
|
||||
receivedTile.zCoord);
|
||||
receivedTile.zCoord,
|
||||
receivedTile.getWorldObj().provider.dimensionId,
|
||||
container);
|
||||
return true;
|
||||
}
|
||||
TileEntity expectedTile = ((IContainerWithTileEntity) container).getTileEntity();
|
||||
if (receivedTile != expectedTile) {
|
||||
Log.LOGGER.warn(
|
||||
Log.securityMarker,
|
||||
"Player {} tried to send {} which attempts to modify setting of TileEntity at {}, {}, {}. Expected: {}, {}, {}",
|
||||
"Player {} tried to send {} which attempts to modify setting of TileEntity at {}, {}, {} in {}. Expected: {}, {}, {} in {}. Current container {}",
|
||||
player.getGameProfile(),
|
||||
messageClass.getSimpleName(),
|
||||
receivedTile.xCoord,
|
||||
receivedTile.yCoord,
|
||||
receivedTile.zCoord,
|
||||
receivedTile.getWorldObj().provider.dimensionId,
|
||||
expectedTile.xCoord,
|
||||
expectedTile.yCoord,
|
||||
expectedTile.zCoord);
|
||||
expectedTile.zCoord,
|
||||
expectedTile.getWorldObj().provider.dimensionId,
|
||||
container);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -741,7 +741,10 @@ public class TravelController {
|
||||
|
||||
for (Table.Cell<Double, Double, BlockCoord> cell : possibleDestinations.cellSet()) {
|
||||
if (cell.getColumnKey() <= maxDistance) {
|
||||
return Optional.of(cell.getValue());
|
||||
// If the client hasn't selected a target, the server shouldn't try to force one,
|
||||
// but checking if there is one just outside of range (below message) might still
|
||||
// be useful.
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1066,9 +1069,12 @@ public class TravelController {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the nearest travel anchor within roughly 10 degrees.
|
||||
Optional<BlockCoord> selectedBlock = findBlocksWithinAngle(player, candidates.keySet(), 0.175, Double.MAX_VALUE)
|
||||
.values().stream().findFirst();
|
||||
// Find the nearest travel anchor within the configured angle (default ~10 degrees).
|
||||
Optional<BlockCoord> selectedBlock = findBlocksWithinAngle(
|
||||
player,
|
||||
candidates.keySet(),
|
||||
Config.travelAnchorSnapAngle,
|
||||
Double.MAX_VALUE).values().stream().findFirst();
|
||||
selectedCoord = selectedBlock.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -163,14 +166,13 @@ public class BlockTravelAnchor extends BlockEio
|
||||
|
||||
public static void sendPrivateChatMessage(EntityPlayer player, UserIdent owner) {
|
||||
if (!player.isSneaking()) {
|
||||
IChatComponent ownerName = new ChatComponentText(owner.getPlayerName());
|
||||
ownerName.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
EnderIO.lang.localize("gui.travelAccessable.privateBlock1") + " "
|
||||
+ EnumChatFormatting.RED
|
||||
+ owner.getPlayerName()
|
||||
+ EnumChatFormatting.WHITE
|
||||
+ " "
|
||||
+ EnderIO.lang.localize("gui.travelAccessable.privateBlock2"));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("gui.travelAccessable.privateBlock"),
|
||||
ownerName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@@ -103,8 +105,9 @@ public class ItemCoordSelector extends Item implements IResourceTooltipProvider
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnderIO.lang.localize("itemCoordSelector.chat.setCoords", bc.chatString())));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemCoordSelector.chat.setCoords"),
|
||||
bc.chatString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,11 +119,9 @@ public class ItemCoordSelector extends Item implements IResourceTooltipProvider
|
||||
}
|
||||
if (!world.isRemote) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnderIO.lang.localize(
|
||||
"itemCoordSelector.chat.setDimension",
|
||||
EnumChatFormatting.GREEN.toString(),
|
||||
Integer.toString(dim))));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemCoordSelector.chat.setDimension"),
|
||||
dimensionComponent(dim)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,21 +195,29 @@ public class ItemCoordSelector extends Item implements IResourceTooltipProvider
|
||||
private void onCoordsChanged(EntityPlayer player, BlockCoord bc) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(EnderIO.lang.localize("itemCoordSelector.chat.newCoords", bc.chatString())));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemCoordSelector.chat.newCoords"),
|
||||
bc.chatString()));
|
||||
}
|
||||
}
|
||||
|
||||
private void onDimensionChanged(EntityPlayer player, int dim) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(
|
||||
EnderIO.lang.localize(
|
||||
"itemCoordSelector.chat.newDimension",
|
||||
EnumChatFormatting.GREEN.toString(),
|
||||
Integer.toString(dim))));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemCoordSelector.chat.newDimension"),
|
||||
dimensionComponent(dim)));
|
||||
}
|
||||
}
|
||||
|
||||
private static IChatComponent dimensionComponent(int dim) {
|
||||
// Color the argument itself: chat resets formatting after each component, so a code in the lang string
|
||||
// doesn't carry over to it.
|
||||
IChatComponent component = new ChatComponentText(Integer.toString(dim));
|
||||
component.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setCoords(ItemStack stack, BlockCoord bc) {
|
||||
stack.stackTagCompound.setBoolean("default", false);
|
||||
bc.writeToNBT(stack.stackTagCompound);
|
||||
|
||||
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user