mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 20:52:42 +00:00
Merge branch 'master' of https://github.com/CrazyPants/EnderIO.git
This commit is contained in:
commit
8632fbe3da
5 files changed
+79
-27
No files matched your search
@@ -53,6 +53,7 @@ import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
|
||||
import crazypants.enderio.conduit.me.ItemMEConduit;
|
||||
import crazypants.enderio.conduit.power.ItemPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.ConduitBundledRedstoneProvider;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.ItemRedstoneConduit;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.enchantment.Enchantments;
|
||||
@@ -675,6 +676,8 @@ public class EnderIO {
|
||||
FluidFuelRegister.instance.addFuel(msg.getNBTValue());
|
||||
} else if(IMC.FLUID_COOLANT_ADD.equals(key)) {
|
||||
FluidFuelRegister.instance.addCoolant(msg.getNBTValue());
|
||||
} else if(IMC.REDSTONE_CONNECTABLE_ADD.equals(key)) {
|
||||
InsulatedRedstoneConduit.addConnectableBlock(msg.getNBTValue());
|
||||
}
|
||||
} else if(msg.isItemStackMessage()) {
|
||||
if(IMC.PAINTER_WHITELIST_ADD.equals(key)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.enderio.api;
|
||||
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.item.ItemSoulVessel;
|
||||
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
|
||||
@@ -121,6 +122,14 @@ public final class IMC {
|
||||
*/
|
||||
public static final String TELEPORT_BLACKLIST_ADD = "teleport:blacklist:add";
|
||||
|
||||
/**
|
||||
* Key for an NBT message to register a block or tile entity as connectable to
|
||||
* insulated redstone conduits. Calls
|
||||
* {@link InsulatedRedstoneConduit#addConnectableBlock(net.minecraft.nbt.NBTTagCompound)}
|
||||
* with the NBT value of the message.
|
||||
*/
|
||||
public static final String REDSTONE_CONNECTABLE_ADD = "redstone:connectable:add";
|
||||
|
||||
|
||||
private IMC() {
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import cofh.api.tileentity.IRedstoneControl;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.api.redstone.IRedstoneConnectable;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
@@ -32,8 +33,6 @@ import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.IconUtil;
|
||||
@@ -63,13 +62,71 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
});
|
||||
}
|
||||
|
||||
private static List<Block> VANILLA_CONECTABLES = Arrays.asList(Blocks.redstone_lamp, Blocks.redstone_torch, Blocks.redstone_wire, Blocks.redstone_block,
|
||||
private static final List<Block> CONECTABLE_BLOCKS = Arrays.asList(Blocks.redstone_lamp, Blocks.redstone_torch, Blocks.redstone_wire, Blocks.redstone_block,
|
||||
Blocks.dispenser, Blocks.lever, Blocks.wooden_button, Blocks.stone_button, Blocks.wooden_pressure_plate, Blocks.stone_pressure_plate,
|
||||
Blocks.dropper, Blocks.daylight_detector, Blocks.command_block, Blocks.golden_rail, Blocks.trapped_chest);
|
||||
|
||||
|
||||
private static Map<Class<?>, Boolean> CONNECTABLE_CLASSES = null;
|
||||
|
||||
public static void addConnectableBlock(NBTTagCompound nbt) {
|
||||
if(nbt == null) {
|
||||
Log.warn("InsulatedRedstoneConduit: An attempt was made to register a redstone connectable using a null NBT");
|
||||
return;
|
||||
}
|
||||
boolean connectable = true;
|
||||
if(nbt.hasKey("isConnectable")) {
|
||||
connectable = nbt.getBoolean("isConnectable");
|
||||
}
|
||||
String className = nbt.getString("className");
|
||||
addConnectableInterface(className, connectable);
|
||||
}
|
||||
|
||||
public static void addConnectableBlock(Block block) {
|
||||
if(block == null) {
|
||||
Log.warn("InsulatedRedstoneConduit: An attempt was made to register a redstone connectable using a null Block");
|
||||
return;
|
||||
}
|
||||
CONECTABLE_BLOCKS.add(block);
|
||||
}
|
||||
|
||||
public static void addConnectableInterface(String className, boolean connectable) {
|
||||
try {
|
||||
Class<?> clz = Class.forName(className);
|
||||
addConnectableInterface(clz, connectable);
|
||||
} catch (Exception e) {
|
||||
Log.warn("InsulatedRedstoneConduit: An attempt was made to register " + className + " as connectable but it could not be loaded");
|
||||
}
|
||||
}
|
||||
|
||||
public static void addConnectableInterface(Class<?> clazz, boolean connectable) {
|
||||
if(clazz == null) {
|
||||
Log.warn("InsulatedRedstoneConduit: An attempt was made to register a null class as a connectable");
|
||||
return;
|
||||
}
|
||||
getConnectableInterfaces().put(clazz, connectable);
|
||||
}
|
||||
|
||||
private static Map<Class<?>, Boolean> getConnectableInterfaces() {
|
||||
if(CONNECTABLE_CLASSES == null) {
|
||||
CONNECTABLE_CLASSES = new HashMap<Class<?>, Boolean>();
|
||||
CONNECTABLE_CLASSES.put(IRedstoneControl.class, false);
|
||||
try {
|
||||
Class<?> conInterface = Class.forName("powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection");
|
||||
CONNECTABLE_CLASSES.put(conInterface, false);
|
||||
} catch (Throwable e) {
|
||||
//NO-OP
|
||||
}
|
||||
try {
|
||||
Class<?> ccInterface = Class.forName("dan200.computercraft.shared.computer.blocks.IComputerTile");
|
||||
CONNECTABLE_CLASSES.put(ccInterface, true);
|
||||
} catch (Throwable e) {
|
||||
//NO-OP
|
||||
}
|
||||
}
|
||||
return CONNECTABLE_CLASSES;
|
||||
}
|
||||
|
||||
private Map<ForgeDirection, ConnectionMode> forcedConnections = new HashMap<ForgeDirection, ConnectionMode>();
|
||||
|
||||
private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
|
||||
@@ -290,7 +347,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return false;
|
||||
}
|
||||
|
||||
if(VANILLA_CONECTABLES.contains(block)) {
|
||||
if(CONECTABLE_BLOCKS.contains(block)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -312,26 +369,6 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Map<Class<?>, Boolean> getConnectableInterfaces() {
|
||||
if(CONNECTABLE_CLASSES == null) {
|
||||
CONNECTABLE_CLASSES = new HashMap<Class<?>, Boolean>();
|
||||
CONNECTABLE_CLASSES.put(IRedstoneControl.class, false);
|
||||
try{
|
||||
Class<?> conInterface = Class.forName("powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection");
|
||||
CONNECTABLE_CLASSES.put(conInterface, false);
|
||||
} catch(Throwable e) {
|
||||
//NO-OP
|
||||
}
|
||||
try{
|
||||
Class<?> ccInterface = Class.forName("dan200.computercraft.shared.computer.blocks.IComputerTile");
|
||||
CONNECTABLE_CLASSES.put(ccInterface, true);
|
||||
} catch(Throwable e) {
|
||||
//NO-OP
|
||||
}
|
||||
}
|
||||
return CONNECTABLE_CLASSES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpecialConnection(ForgeDirection dir){
|
||||
BlockCoord loc = getLocation().getLocation(dir);
|
||||
|
||||
Reference in new issue
Block a user