New: OpenComputers Conduits
No files matched your search
@@ -52,6 +52,7 @@ repositories {
|
||||
maven { url = "http://dl.tsr.me/artifactory/libs-release-local" }
|
||||
maven { url = "http://maven.tterrag.com" }
|
||||
maven { url = "http://maven.ic2.player.to" }
|
||||
maven { url = "http://maven.cil.li/" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -70,7 +71,9 @@ dependencies {
|
||||
|
||||
// WAILA ships really old CCC/CCL versions, so we force the new versions
|
||||
compile "codechicken:CodeChickenLib:${minecraft_version}-${ccl_version}:dev"
|
||||
compile "codechicken:CodeChickenCore:${minecraft_version}-${ccc_version}:dev"
|
||||
compile "codechicken:CodeChickenCore:${minecraft_version}-${ccc_version}:dev"
|
||||
|
||||
compile "li.cil.oc:OpenComputers:${opencomputers_version}:api"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -15,6 +15,7 @@ ae2_version=rv1-stable-1
|
||||
endercore_version=1.7.10-0.2.0.31_beta
|
||||
ee3_version=1.7.10-0.3.507
|
||||
forestry_version=forestry_1.7.10:3.6.2.19
|
||||
opencomputers_version=MC1.7.10-1.5.+
|
||||
|
||||
toReplace=after:endercore;after:MineFactoryReloaded;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,)
|
||||
|
||||
|
||||
@@ -115,6 +115,8 @@ enderio.itemMEConduit.name=ME Conduit
|
||||
enderio.itemMEConduitDense.name=Dense ME Conduit
|
||||
enderio.itemMEConduit.channelsUsed={0,number} of {1,number} Channels
|
||||
|
||||
enderio.itemOCConduit.name=Network Conduit (OC)
|
||||
|
||||
//Entity
|
||||
entity.witherSkeleton.name=Wither Skeleton
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 284 B |
|
After Width: | Height: | Size: 721 B |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 284 B |
@@ -43,6 +43,9 @@ import crazypants.enderio.conduit.liquid.LiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.me.MEConduit;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCConduit;
|
||||
import crazypants.enderio.conduit.oc.OCConduitRenderer;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitRenderer;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
@@ -213,6 +216,9 @@ public class ClientProxy extends CommonProxy {
|
||||
if(MEUtil.isMEEnabled()) {
|
||||
MEConduit.initIcons();
|
||||
}
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
OCConduit.initIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,6 +336,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemItemConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemGasConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMEConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemOCConduit, itemConRenderer);
|
||||
|
||||
BlockPaintedFenceGateRenderer bcfgr = new BlockPaintedFenceGateRenderer();
|
||||
BlockPaintedFenceGate.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -382,6 +389,9 @@ public class ClientProxy extends CommonProxy {
|
||||
if(GasUtil.isGasConduitEnabled()) {
|
||||
conduitRenderers.add(new GasConduitRenderer());
|
||||
}
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
conduitRenderers.add(new OCConduitRenderer());
|
||||
}
|
||||
|
||||
EnderIoRenderer eior = new EnderIoRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
|
||||
|
||||
@@ -58,6 +58,7 @@ import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
|
||||
import crazypants.enderio.conduit.me.ItemMEConduit;
|
||||
import crazypants.enderio.conduit.oc.ItemOCConduit;
|
||||
import crazypants.enderio.conduit.power.ItemPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.ConduitBundledRedstoneProvider;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
@@ -226,6 +227,7 @@ public class EnderIO {
|
||||
public static ItemItemConduit itemItemConduit;
|
||||
public static ItemGasConduit itemGasConduit;
|
||||
public static ItemMEConduit itemMEConduit;
|
||||
public static ItemOCConduit itemOCConduit;
|
||||
public static ItemBasicItemFilter itemBasicFilterUpgrade;
|
||||
public static ItemExistingItemFilter itemExistingItemFilter;
|
||||
public static ItemModItemFilter itemModItemFilter;
|
||||
@@ -403,6 +405,7 @@ public class EnderIO {
|
||||
itemItemConduit = ItemItemConduit.create();
|
||||
itemGasConduit = ItemGasConduit.create();
|
||||
itemMEConduit = ItemMEConduit.create();
|
||||
itemOCConduit = ItemOCConduit.create();
|
||||
|
||||
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
|
||||
itemExistingItemFilter = ItemExistingItemFilter.create();
|
||||
|
||||
@@ -13,6 +13,7 @@ public enum ModObject {
|
||||
itemItemConduit,
|
||||
itemGasConduit,
|
||||
itemMEConduit,
|
||||
itemOCConduit,
|
||||
itemBasicFilterUpgrade,
|
||||
itemExistingItemFilter,
|
||||
itemModItemFilter,
|
||||
|
||||
@@ -41,6 +41,8 @@ import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduitNetwork;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.me.MEConduitNetwork;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.oc.OCConduitNetwork;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
@@ -66,7 +68,8 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected List<CollidableComponent> collidables;
|
||||
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<ForgeDirection, ConnectionMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<ForgeDirection, ConnectionMode>(
|
||||
ForgeDirection.class);
|
||||
|
||||
protected boolean collidablesDirty = true;
|
||||
|
||||
@@ -81,57 +84,56 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public boolean writeConnectionSettingsToNBT(ForgeDirection dir, NBTTagCompound nbt) {
|
||||
if(!getExternalConnections().contains(dir)) {
|
||||
if (!getExternalConnections().contains(dir)) {
|
||||
return false;
|
||||
}
|
||||
NBTTagCompound dataRoot = getNbtRootForType(nbt, true);
|
||||
dataRoot.setShort("connectionMode", (short)getConnectionMode(dir).ordinal());
|
||||
writeTypeSettingsToNbt(dir, dataRoot);
|
||||
NBTTagCompound dataRoot = getNbtRootForType(nbt, true);
|
||||
dataRoot.setShort("connectionMode", (short) getConnectionMode(dir).ordinal());
|
||||
writeTypeSettingsToNbt(dir, dataRoot);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readConduitSettingsFromNBT(ForgeDirection dir, NBTTagCompound nbt) {
|
||||
if(!getExternalConnections().contains(dir)) {
|
||||
if (!getExternalConnections().contains(dir)) {
|
||||
return false;
|
||||
}
|
||||
NBTTagCompound dataRoot = getNbtRootForType(nbt, false);
|
||||
if(dataRoot == null) {
|
||||
if (dataRoot == null) {
|
||||
return false;
|
||||
}
|
||||
if(dataRoot.hasKey("connectionMode")) {
|
||||
}
|
||||
if (dataRoot.hasKey("connectionMode")) {
|
||||
ConnectionMode mode = ConnectionMode.values()[dataRoot.getShort("connectionMode")];
|
||||
setConnectionMode(dir, mode);
|
||||
}
|
||||
}
|
||||
readTypeSettings(dir, dataRoot);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
}
|
||||
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
}
|
||||
|
||||
protected NBTTagCompound getNbtRootForType(NBTTagCompound nbt, boolean createIfNull) {
|
||||
Class<? extends IConduit> bt = getBaseConduitType();
|
||||
String dataRootName = bt.getSimpleName();
|
||||
NBTTagCompound dataRoot = null;
|
||||
if(nbt.hasKey(dataRootName)) {
|
||||
if (nbt.hasKey(dataRootName)) {
|
||||
dataRoot = nbt.getCompoundTag(dataRootName);
|
||||
}
|
||||
if(dataRoot == null && createIfNull) {
|
||||
}
|
||||
if (dataRoot == null && createIfNull) {
|
||||
dataRoot = new NBTTagCompound();
|
||||
nbt.setTag(dataRootName, dataRoot);
|
||||
}
|
||||
return dataRoot;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ConnectionMode getConnectionMode(ForgeDirection dir) {
|
||||
ConnectionMode res = conectionModes.get(dir);
|
||||
if(res == null) {
|
||||
if (res == null) {
|
||||
return getDefaultConnectionMode();
|
||||
}
|
||||
return res;
|
||||
@@ -149,31 +151,31 @@ public abstract class AbstractConduit implements IConduit {
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
ConnectionMode oldVal = conectionModes.get(dir);
|
||||
if(oldVal == mode) {
|
||||
if (oldVal == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(mode == null) {
|
||||
|
||||
if (mode == null) {
|
||||
conectionModes.remove(dir);
|
||||
} else {
|
||||
conectionModes.put(dir, mode);
|
||||
}
|
||||
clientStateDirty = true;
|
||||
collidablesDirty = true;
|
||||
|
||||
|
||||
connectionsChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectionMode(ConnectionMode mode) {
|
||||
if(mode == null) {
|
||||
if (mode == null) {
|
||||
return false;
|
||||
}
|
||||
if(mode == getDefaultConnectionMode() && conectionModes.size() != 6) {
|
||||
if (mode == getDefaultConnectionMode() && conectionModes.size() != 6) {
|
||||
return true;
|
||||
}
|
||||
for (ConnectionMode cm : conectionModes.values()) {
|
||||
if(cm == mode) {
|
||||
if (cm == mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +186,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
public ConnectionMode getNextConnectionMode(ForgeDirection dir) {
|
||||
ConnectionMode curMode = getConnectionMode(dir);
|
||||
ConnectionMode next = ConnectionMode.getNext(curMode);
|
||||
if(next == ConnectionMode.NOT_SET) {
|
||||
if (next == ConnectionMode.NOT_SET) {
|
||||
next = ConnectionMode.IN_OUT;
|
||||
}
|
||||
return next;
|
||||
@@ -194,7 +196,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
public ConnectionMode getPreviousConnectionMode(ForgeDirection dir) {
|
||||
ConnectionMode curMode = getConnectionMode(dir);
|
||||
ConnectionMode prev = ConnectionMode.getPrevious(curMode);
|
||||
if(prev == ConnectionMode.NOT_SET) {
|
||||
if (prev == ConnectionMode.NOT_SET) {
|
||||
prev = ConnectionMode.DISABLED;
|
||||
}
|
||||
return prev;
|
||||
@@ -202,7 +204,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public boolean haveCollidablesChangedSinceLastCall() {
|
||||
if(dodgyChangeSinceLastCallFlagForBundle) {
|
||||
if (dodgyChangeSinceLastCallFlagForBundle) {
|
||||
dodgyChangeSinceLastCallFlagForBundle = false;
|
||||
return true;
|
||||
}
|
||||
@@ -211,7 +213,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public BlockCoord getLocation() {
|
||||
if(bundle == null) {
|
||||
if (bundle == null) {
|
||||
return null;
|
||||
}
|
||||
return bundle.getLocation();
|
||||
@@ -250,13 +252,14 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public boolean canConnectToConduit(ForgeDirection direction, IConduit conduit) {
|
||||
if(conduit == null) {
|
||||
if (conduit == null) {
|
||||
return false;
|
||||
}
|
||||
if (MicroblocksUtil.supportMicroblocks() && isBlockedByMicroblocks(direction, conduit)) {
|
||||
return false;
|
||||
}
|
||||
return getConnectionMode(direction) != ConnectionMode.DISABLED && conduit.getConnectionMode(direction.getOpposite()) != ConnectionMode.DISABLED;
|
||||
return getConnectionMode(direction) != ConnectionMode.DISABLED
|
||||
&& conduit.getConnectionMode(direction.getOpposite()) != ConnectionMode.DISABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,7 +330,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active) {
|
||||
if(active != this.active) {
|
||||
if (active != this.active) {
|
||||
clientStateDirty = true;
|
||||
}
|
||||
this.active = active;
|
||||
@@ -350,7 +353,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
nbtRoot.setIntArray("externalConnections", dirs);
|
||||
nbtRoot.setBoolean("signalActive", active);
|
||||
|
||||
if(conectionModes.size() > 0) {
|
||||
if (conectionModes.size() > 0) {
|
||||
byte[] modes = new byte[6];
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
@@ -378,7 +381,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
conectionModes.clear();
|
||||
byte[] modes = nbtRoot.getByteArray("conModes");
|
||||
if(modes != null && modes.length == 6) {
|
||||
if (modes != null && modes.length == 6) {
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
conectionModes.put(dir, ConnectionMode.values()[modes[i]]);
|
||||
@@ -410,26 +413,26 @@ public abstract class AbstractConduit implements IConduit {
|
||||
@Override
|
||||
public void onChunkUnload(World worldObj) {
|
||||
AbstractConduitNetwork<?, ?> network = getNetwork();
|
||||
if(network != null) {
|
||||
if (network != null) {
|
||||
network.destroyNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(World world) {
|
||||
if(world.isRemote) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
updateNetwork(world);
|
||||
updateConnections();
|
||||
if(clientStateDirty && getBundle() != null) {
|
||||
if (clientStateDirty && getBundle() != null) {
|
||||
getBundle().dirty();
|
||||
clientStateDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
if(!connectionsDirty) {
|
||||
if (!connectionsDirty) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -437,7 +440,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
|
||||
// remove any no longer valid connections
|
||||
for (ForgeDirection dir : copy) {
|
||||
if(!canConnectToExternal(dir, false)) {
|
||||
if (!canConnectToExternal(dir, false)) {
|
||||
externalConnectionRemoved(dir);
|
||||
externalConnectionsChanged = true;
|
||||
}
|
||||
@@ -445,14 +448,14 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
// then check for new ones
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(!conduitConnections.contains(dir) && !externalConnections.contains(dir)) {
|
||||
if(canConnectToExternal(dir, false)) {
|
||||
if (!conduitConnections.contains(dir) && !externalConnections.contains(dir)) {
|
||||
if (canConnectToExternal(dir, false)) {
|
||||
externalConnectionAdded(dir);
|
||||
externalConnectionsChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(externalConnectionsChanged) {
|
||||
if (externalConnectionsChanged) {
|
||||
connectionsChanged();
|
||||
}
|
||||
|
||||
@@ -472,13 +475,15 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected void updateNetwork(World world) {
|
||||
BlockCoord pos = getLocation();
|
||||
if(getNetwork() == null && world.blockExists(pos.x, pos.y, pos.z)) {
|
||||
if (getNetwork() == null && world.blockExists(pos.x, pos.y, pos.z)) {
|
||||
ConduitUtil.ensureValidNetwork(this);
|
||||
// TODO figure out if removing this causes anything horrible to happen. Initial testing shows no difference.
|
||||
// if(getNetwork() != null && !world.isRemote && bundle != null) {
|
||||
// world.notifyBlocksOfNeighborChange(bundle.getEntity().xCoord, bundle.getEntity().yCoord, bundle.getEntity().zCoord,
|
||||
// bundle.getEntity().getBlockType());
|
||||
// }
|
||||
// TODO figure out if removing this causes anything horrible to happen.
|
||||
// Initial testing shows no difference.
|
||||
// if(getNetwork() != null && !world.isRemote && bundle != null) {
|
||||
// world.notifyBlocksOfNeighborChange(bundle.getEntity().xCoord,
|
||||
// bundle.getEntity().yCoord, bundle.getEntity().zCoord,
|
||||
// bundle.getEntity().getBlockType());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +496,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
conduitConnections.clear();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
|
||||
if(neighbour != null && neighbour.canConnectToConduit(dir.getOpposite(), this)) {
|
||||
if (neighbour != null && neighbour.canConnectToConduit(dir.getOpposite(), this)) {
|
||||
conduitConnections.add(dir);
|
||||
neighbour.conduitConnectionAdded(dir.getOpposite());
|
||||
neighbour.connectionsChanged();
|
||||
@@ -500,7 +505,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
externalConnections.clear();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
|
||||
if (!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
|
||||
externalConnectionAdded(dir);
|
||||
}
|
||||
}
|
||||
@@ -515,20 +520,20 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
for (ForgeDirection dir : conduitConnections) {
|
||||
IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
|
||||
if(neighbour != null) {
|
||||
if (neighbour != null) {
|
||||
neighbour.conduitConnectionRemoved(dir.getOpposite());
|
||||
neighbour.connectionsChanged();
|
||||
}
|
||||
}
|
||||
conduitConnections.clear();
|
||||
|
||||
if(!externalConnections.isEmpty()) {
|
||||
if (!externalConnections.isEmpty()) {
|
||||
world.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
|
||||
}
|
||||
externalConnections.clear();
|
||||
|
||||
AbstractConduitNetwork<?, ?> network = getNetwork();
|
||||
if(network != null) {
|
||||
if (network != null) {
|
||||
network.destroyNetwork();
|
||||
}
|
||||
connectionsChanged();
|
||||
@@ -536,11 +541,11 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@Override
|
||||
public boolean onNeighborBlockChange(Block block) {
|
||||
|
||||
|
||||
// NB: No need to check externals if the neighbour that changed was a
|
||||
// conduit bundle as this
|
||||
// can't effect external connections.
|
||||
if(block == EnderIO.blockConduitBundle) {
|
||||
if (block == EnderIO.blockConduitBundle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -548,36 +553,36 @@ public abstract class AbstractConduit implements IConduit {
|
||||
// handled by the bundle
|
||||
Set<ForgeDirection> newCons = EnumSet.noneOf(ForgeDirection.class);
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
|
||||
if (!containsConduitConnection(dir) && canConnectToExternal(dir, false)) {
|
||||
newCons.add(dir);
|
||||
}
|
||||
}
|
||||
if(newCons.size() != externalConnections.size()) {
|
||||
if (newCons.size() != externalConnections.size()) {
|
||||
connectionsDirty = true;
|
||||
return true;
|
||||
}
|
||||
for(ForgeDirection dir : externalConnections) {
|
||||
if(!newCons.remove(dir)) {
|
||||
for (ForgeDirection dir : externalConnections) {
|
||||
if (!newCons.remove(dir)) {
|
||||
connectionsDirty = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(!newCons.isEmpty()) {
|
||||
if (!newCons.isEmpty()) {
|
||||
connectionsDirty = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
public boolean onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
return onNeighborBlockChange(world.getBlock(tileX, tileY, tileZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
return Collections.singletonList(new CollidableComponent(getCollidableType(), ConduitGeometryUtil.instance.getBoundingBox(getBaseConduitType(), key.dir,
|
||||
key.isStub, key.offset), key.dir, null));
|
||||
return Collections.singletonList(new CollidableComponent(getCollidableType(), ConduitGeometryUtil.instance.getBoundingBox(
|
||||
getBaseConduitType(), key.dir, key.isStub, key.offset), key.dir, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -588,14 +593,14 @@ public abstract class AbstractConduit implements IConduit {
|
||||
@Override
|
||||
public List<CollidableComponent> getCollidableComponents() {
|
||||
|
||||
if(collidables != null && !collidablesDirty) {
|
||||
if (collidables != null && !collidablesDirty) {
|
||||
return collidables;
|
||||
}
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Collection<CollidableComponent> col = getCollidables(dir);
|
||||
if(col != null) {
|
||||
if (col != null) {
|
||||
result.addAll(col);
|
||||
}
|
||||
}
|
||||
@@ -607,40 +612,48 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
protected boolean renderStub(ForgeDirection dir) {
|
||||
//return getConectionMode(dir) == ConnectionMode.DISABLED;
|
||||
// return getConectionMode(dir) == ConnectionMode.DISABLED;
|
||||
return false;
|
||||
}
|
||||
|
||||
private Collection<CollidableComponent> getCollidables(ForgeDirection dir) {
|
||||
CollidableCache cc = CollidableCache.instance;
|
||||
Class<? extends IConduit> type = getCollidableType();
|
||||
if(isConnectedTo(dir) && getConnectionMode(dir) != ConnectionMode.DISABLED) {
|
||||
if (isConnectedTo(dir) && getConnectionMode(dir) != ConnectionMode.DISABLED) {
|
||||
return cc.getCollidables(cc.createKey(type, getBundle().getOffset(getBaseConduitType(), dir), dir, renderStub(dir)), this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractConduitNetwork<?, ?> createNetworkForType()
|
||||
{
|
||||
Class<? extends IConduit> type = this.getClass();
|
||||
if(IRedstoneConduit.class.isAssignableFrom(type)) {
|
||||
return new RedstoneConduitNetwork();
|
||||
} else if(IPowerConduit.class.isAssignableFrom(type)) {
|
||||
return new PowerConduitNetwork();
|
||||
} else if(EnderLiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new EnderLiquidConduitNetwork();
|
||||
} else if(AdvancedLiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new AdvancedLiquidConduitNetwork();
|
||||
} else if(ILiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new LiquidConduitNetwork();
|
||||
} else if(IItemConduit.class.isAssignableFrom(type)) {
|
||||
return new ItemConduitNetwork();
|
||||
} else if(IGasConduit.class.isAssignableFrom(type)) {
|
||||
return new GasConduitNetwork();
|
||||
} else if(IMEConduit.class.isAssignableFrom(type)) {
|
||||
return new MEConduitNetwork();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
public AbstractConduitNetwork<?, ?> createNetworkForType() {
|
||||
Class<? extends IConduit> type = this.getClass();
|
||||
if (IRedstoneConduit.class.isAssignableFrom(type)) {
|
||||
return new RedstoneConduitNetwork();
|
||||
} else if (IPowerConduit.class.isAssignableFrom(type)) {
|
||||
return new PowerConduitNetwork();
|
||||
} else if (EnderLiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new EnderLiquidConduitNetwork();
|
||||
} else if (AdvancedLiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new AdvancedLiquidConduitNetwork();
|
||||
} else if (ILiquidConduit.class.isAssignableFrom(type)) {
|
||||
return new LiquidConduitNetwork();
|
||||
} else if (IItemConduit.class.isAssignableFrom(type)) {
|
||||
return new ItemConduitNetwork();
|
||||
} else if (IGasConduit.class.isAssignableFrom(type)) {
|
||||
return new GasConduitNetwork();
|
||||
} else if (IMEConduit.class.isAssignableFrom(type)) {
|
||||
return new MEConduitNetwork();
|
||||
} else if (IOCConduit.class.isAssignableFrom(type)) {
|
||||
return new OCConduitNetwork();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMirrorTexture() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,6 +63,7 @@ import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
import crazypants.enderio.conduit.packet.PacketConnectionMode;
|
||||
import crazypants.enderio.conduit.packet.PacketExtractMode;
|
||||
import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
@@ -101,6 +102,8 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketOpenConduitUI.class, PacketOpenConduitUI.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketSlotVisibility.class, PacketSlotVisibility.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketOCConduitSignalColor.class, PacketOCConduitSignalColor.class,
|
||||
PacketHandler.nextID(), Side.SERVER);
|
||||
|
||||
BlockConduitBundle result = new BlockConduitBundle();
|
||||
result.init();
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.util.MathHelper;
|
||||
import crazypants.enderio.api.tool.IConduitControl;
|
||||
import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
|
||||
public enum ConduitDisplayMode {
|
||||
ALL,
|
||||
@@ -13,20 +14,24 @@ public enum ConduitDisplayMode {
|
||||
REDSTONE,
|
||||
FLUID,
|
||||
ITEM,
|
||||
GAS,
|
||||
GAS,
|
||||
ME,
|
||||
OC,
|
||||
NONE;
|
||||
|
||||
public static ConduitDisplayMode next(ConduitDisplayMode mode) {
|
||||
int index = mode.ordinal() + 1;
|
||||
if(index >= values().length) {
|
||||
if (index >= values().length) {
|
||||
index = 0;
|
||||
}
|
||||
ConduitDisplayMode res = values()[index];
|
||||
if(res == GAS && !GasUtil.isGasConduitEnabled()) {
|
||||
if (res == OC && !OCUtil.isOCEnabled()) {
|
||||
return next(res);
|
||||
}
|
||||
if(res == ME && !MEUtil.isMEEnabled()) {
|
||||
if (res == GAS && !GasUtil.isGasConduitEnabled()) {
|
||||
return next(res);
|
||||
}
|
||||
if (res == ME && !MEUtil.isMEEnabled()) {
|
||||
return next(res);
|
||||
}
|
||||
return res;
|
||||
@@ -34,14 +39,17 @@ public enum ConduitDisplayMode {
|
||||
|
||||
public static ConduitDisplayMode previous(ConduitDisplayMode mode) {
|
||||
int index = mode.ordinal() - 1;
|
||||
if(index < 0) {
|
||||
if (index < 0) {
|
||||
index = values().length - 1;
|
||||
}
|
||||
ConduitDisplayMode res = values()[index];
|
||||
if(res == GAS && !GasUtil.isGasConduitEnabled()) {
|
||||
if (res == GAS && !GasUtil.isGasConduitEnabled()) {
|
||||
return previous(res);
|
||||
}
|
||||
if(res == ME && !MEUtil.isMEEnabled()) {
|
||||
if (res == ME && !MEUtil.isMEEnabled()) {
|
||||
return previous(res);
|
||||
}
|
||||
if (res == OC && !OCUtil.isOCEnabled()) {
|
||||
return previous(res);
|
||||
}
|
||||
return res;
|
||||
@@ -50,7 +58,7 @@ public enum ConduitDisplayMode {
|
||||
private static final String NBT_KEY = "enderio.displaymode";
|
||||
|
||||
public static ConduitDisplayMode getDisplayMode(ItemStack equipped) {
|
||||
if(equipped == null || !(equipped.getItem() instanceof IConduitControl)) {
|
||||
if (equipped == null || !(equipped.getItem() instanceof IConduitControl)) {
|
||||
return ALL;
|
||||
}
|
||||
initDisplayModeTag(equipped);
|
||||
@@ -60,7 +68,7 @@ public enum ConduitDisplayMode {
|
||||
}
|
||||
|
||||
public static void setDisplayMode(ItemStack equipped, ConduitDisplayMode mode) {
|
||||
if(mode == null || equipped == null || !(equipped.getItem() instanceof IConduitControl)) {
|
||||
if (mode == null || equipped == null || !(equipped.getItem() instanceof IConduitControl)) {
|
||||
return;
|
||||
}
|
||||
initDisplayModeTag(equipped);
|
||||
|
||||
@@ -14,12 +14,12 @@ import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.conduit.item.filter.ClearFilterRecipe;
|
||||
import crazypants.enderio.conduit.item.filter.CopyFilterRecipe;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.material.BlockFusedQuartz;
|
||||
import crazypants.enderio.material.FrankenSkull;
|
||||
import crazypants.enderio.material.Material;
|
||||
|
||||
import static crazypants.enderio.ModObject.blockPainter;
|
||||
import static crazypants.enderio.material.Alloy.*;
|
||||
import static crazypants.enderio.material.Material.*;
|
||||
@@ -104,6 +104,18 @@ public class ConduitRecipes {
|
||||
if (MEUtil.isMEEnabled()) {
|
||||
addAeRecipes();
|
||||
}
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
addOCRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
private static void addOCRecipes() {
|
||||
int numConduits = Config.numConduitsPerRecipe;
|
||||
String redstoneAlloy = REDSTONE_ALLOY.getOreIngot();
|
||||
String binder = CONDUIT_BINDER.oreDict;
|
||||
|
||||
addShaped(new ItemStack(EnderIO.itemOCConduit, numConduits, 0), "bbb", "rir", "bbb", 'b', binder, 'r', redstoneAlloy, 'i',
|
||||
"ingotIron");
|
||||
}
|
||||
|
||||
@Method(modid = "appliedenergistics2")
|
||||
|
||||
@@ -36,6 +36,9 @@ import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.oc.OCConduitNetwork;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
@@ -203,6 +206,8 @@ public class ConduitUtil {
|
||||
return conduitType == IGasConduit.class;
|
||||
case ME:
|
||||
return conduitType == IMEConduit.class;
|
||||
case OC:
|
||||
return conduitType == IOCConduit.class;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -299,7 +304,8 @@ public class ConduitUtil {
|
||||
if(typeName == null || conduitBody == null) {
|
||||
return null;
|
||||
}
|
||||
if ((typeName.contains("conduit.me") && !MEUtil.isMEEnabled()) || typeName.contains("conduit.gas") && !GasUtil.isGasConduitEnabled()) {
|
||||
if ((typeName.contains("conduit.oc") && !OCUtil.isOCEnabled()) || (typeName.contains("conduit.me") && !MEUtil.isMEEnabled())
|
||||
|| (typeName.contains("conduit.gas") && !GasUtil.isGasConduitEnabled())) {
|
||||
return null;
|
||||
}
|
||||
if (nbtVersion == 0 && "crazypants.enderio.conduit.liquid.LiquidConduit".equals(typeName)) {
|
||||
|
||||
@@ -137,4 +137,10 @@ public interface IConduit {
|
||||
|
||||
public AbstractConduitNetwork<?, ?> createNetworkForType();
|
||||
|
||||
/**
|
||||
* Should the texture of the conduit connectors be mirrored around the conduit
|
||||
* node?
|
||||
*/
|
||||
boolean shouldMirrorTexture();
|
||||
|
||||
}
|
||||
@@ -4,6 +4,9 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -29,9 +32,12 @@ import crazypants.enderio.power.IInternalPowerHandler;
|
||||
@InterfaceList({
|
||||
@Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2"),
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = "MekanismAPI|gas"),
|
||||
@Interface(iface = "mods.immibis.microblocks.api.IMicroblockSupporterTile", modid = "ImmibisMicroblocks")
|
||||
@Interface(iface = "mods.immibis.microblocks.api.IMicroblockSupporterTile", modid = "ImmibisMicroblocks"),
|
||||
@Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputersAPI|Network"),
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network")
|
||||
})
|
||||
public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, IItemDuct, IGasHandler, IGridHost, IMicroblockSupporterTile {
|
||||
public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, IItemDuct, IGasHandler, IGridHost,
|
||||
IMicroblockSupporterTile, Environment, SidedEnvironment {
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.*;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
@@ -51,6 +54,7 @@ import crazypants.enderio.conduit.geom.Offsets;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.config.Config;
|
||||
@@ -512,7 +516,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
cachedConnectors.clear();
|
||||
|
||||
//TODO: What an unholly mess!
|
||||
// TODO: What an unholly mess! (and it doesn't even work correctly...)
|
||||
List<CollidableComponent> coreBounds = new ArrayList<CollidableComponent>();
|
||||
for (IConduit con : conduits) {
|
||||
addConduitCores(coreBounds, con);
|
||||
@@ -885,6 +889,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
return (IGridNode) node;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public void setGridNode(Object node) {
|
||||
@@ -1058,4 +1063,77 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OpenComputers
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node node() {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
return cond.node();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onConnect(Node node) {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
cond.onConnect(node);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onDisconnect(Node node) {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
cond.onDisconnect(node);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onMessage(Message message) {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
cond.onMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node sidedNode(ForgeDirection side) {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
return cond.sidedNode(side);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean canConnect(ForgeDirection side) {
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
return cond.canConnect(side);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
IOCConduit cond = getConduit(IOCConduit.class);
|
||||
if (cond != null) {
|
||||
cond.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,8 +24,10 @@ public enum Offset {
|
||||
WEST_DOWN(ForgeDirection.WEST, ForgeDirection.DOWN),
|
||||
SOUTH_DOWN(ForgeDirection.SOUTH, ForgeDirection.DOWN),
|
||||
NORTH_DOWN(ForgeDirection.NORTH, ForgeDirection.DOWN),
|
||||
NORTH_EAST(ForgeDirection.NORTH, ForgeDirection.EAST),
|
||||
NORTH_WEST(ForgeDirection.NORTH, ForgeDirection.WEST);
|
||||
NORTH_EAST(ForgeDirection.NORTH, ForgeDirection.EAST),
|
||||
NORTH_WEST(ForgeDirection.NORTH, ForgeDirection.WEST),
|
||||
SOUTH_EAST(ForgeDirection.SOUTH, ForgeDirection.EAST),
|
||||
SOUTH_WEST(ForgeDirection.SOUTH, ForgeDirection.WEST);
|
||||
|
||||
public final int xOffset;
|
||||
public final int yOffset;
|
||||
|
||||
@@ -9,6 +9,7 @@ import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
|
||||
@@ -39,14 +40,24 @@ public class Offsets {
|
||||
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.NONE), Offset.NORTH_UP);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.X), Offset.NORTH_UP);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.Y), Offset.NORTH_EAST);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.Y), Offset.NORTH_WEST);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.Z), Offset.WEST_UP);
|
||||
|
||||
OFFSETS.put(key(IMEConduit.class, Axis.NONE), Offset.SOUTH_UP);
|
||||
OFFSETS.put(key(IMEConduit.class, Axis.X), Offset.SOUTH_UP);
|
||||
OFFSETS.put(key(IMEConduit.class, Axis.Y), Offset.NORTH_WEST);
|
||||
OFFSETS.put(key(IMEConduit.class, Axis.Y), Offset.NORTH_EAST);
|
||||
OFFSETS.put(key(IMEConduit.class, Axis.Z), Offset.EAST_UP);
|
||||
|
||||
OFFSETS.put(key(IOCConduit.class, Axis.NONE), Offset.NORTH_DOWN);
|
||||
OFFSETS.put(key(IOCConduit.class, Axis.X), Offset.NORTH_DOWN);
|
||||
OFFSETS.put(key(IOCConduit.class, Axis.Y), Offset.SOUTH_WEST);
|
||||
OFFSETS.put(key(IOCConduit.class, Axis.Z), Offset.WEST_DOWN);
|
||||
|
||||
// OFFSETS.put(key(IxConduit.class, Axis.NONE), Offset.SOUTH_DOWN);
|
||||
// OFFSETS.put(key(IxConduit.class, Axis.X), Offset.SOUTH_DOWN);
|
||||
// OFFSETS.put(key(IxConduit.class, Axis.Y), Offset.SOUTH_EAST);
|
||||
// OFFSETS.put(key(IxConduit.class, Axis.Z), Offset.EAST_DOWN);
|
||||
|
||||
}
|
||||
|
||||
public static Offset get(Class<? extends IConduit> type, ForgeDirection dir) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
@@ -50,6 +51,7 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
TAB_ORDER.put(IPowerConduit.class, 3);
|
||||
TAB_ORDER.put(IMEConduit.class, 4);
|
||||
TAB_ORDER.put(IGasConduit.class, 5);
|
||||
TAB_ORDER.put(IOCConduit.class, 6);
|
||||
}
|
||||
|
||||
final InventoryPlayer playerInv;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import com.enderio.core.client.gui.button.ColorButton;
|
||||
import com.enderio.core.client.render.ColorUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class OCSettings extends BaseSettingsPanel {
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
private ColorButton cb;
|
||||
|
||||
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final IOCConduit occon;
|
||||
|
||||
public OCSettings(GuiExternalConnection gui, IConduit con) {
|
||||
super(IconEIO.WRENCH_OVERLAY_OC, EnderIO.lang.localize("itemOCConduit.name"), gui, con);
|
||||
occon = (IOCConduit) con;
|
||||
|
||||
int x = 0;
|
||||
int y = customTop;
|
||||
|
||||
x += gap + gap + 2 + gui.getFontRenderer().getStringWidth(signalColorStr);
|
||||
cb = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
cb.setToolTipHeading(EnderIO.lang.localize("gui.conduit.redstone.signalColor"));
|
||||
DyeColor sigCol = occon.getSignalColor(gui.getDir());
|
||||
cb.setColorIndex(sigCol.ordinal());
|
||||
x += cb.getButtonWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
|
||||
occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initCustomOptions() {
|
||||
if (cb != null) {
|
||||
cb.setColorIndex(cb.getColorIndex());
|
||||
cb.onGuiInit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
if (cb != null) {
|
||||
cb.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
if (cb != null) {
|
||||
gui.getFontRenderer().drawString(signalColorStr, left, top, ColorUtil.getRGB(Color.darkGray));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import crazypants.enderio.conduit.gui.item.ItemSettings;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
|
||||
@@ -32,6 +33,8 @@ public class TabFactory {
|
||||
return new GasSettings(gui, con);
|
||||
} else if(baseType.isAssignableFrom(IMEConduit.class)) {
|
||||
return new MESettings(gui, con);
|
||||
} else if (baseType.isAssignableFrom(IOCConduit.class)) {
|
||||
return new OCSettings(gui, con);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import li.cil.oc.api.network.Node;
|
||||
|
||||
@InterfaceList({ @Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputersAPI|Network"),
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network") })
|
||||
public interface IOCConduit extends IConduit, Environment, SidedEnvironment {
|
||||
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
void invalidate();
|
||||
|
||||
public abstract void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
public abstract DyeColor getSignalColor(ForgeDirection dir);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.AbstractItemConduit;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.ItemConduitSubtype;
|
||||
|
||||
public class ItemOCConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { new ItemConduitSubtype(ModObject.itemOCConduit.name(),
|
||||
"enderio:itemOCConduit") };
|
||||
|
||||
public static ItemOCConduit create() {
|
||||
ItemOCConduit result = new ItemOCConduit();
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
result.init();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ItemOCConduit() {
|
||||
super(ModObject.itemOCConduit, subtypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IOCConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConduit createConduit(ItemStack item, EntityPlayer player) {
|
||||
OCConduit con = new OCConduit(item.getItemDamage());
|
||||
return con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldHideFacades(ItemStack stack, EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,564 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import com.enderio.core.common.util.Log;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.Network;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.me.MEConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.Signal;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.item.PacketConduitProbe;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
|
||||
protected OCConduitNetwork network;
|
||||
|
||||
private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
|
||||
|
||||
public static IIcon[] coreTextures;
|
||||
public static IIcon[] longTextures;
|
||||
|
||||
public OCConduit() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OCConduit(int meta) {
|
||||
super();
|
||||
}
|
||||
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
coreTextures = new IIcon[2];
|
||||
longTextures = new IIcon[2];
|
||||
|
||||
coreTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":ocConduitCore");
|
||||
coreTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":ocConduitCoreAnim");
|
||||
|
||||
longTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":ocConduit");
|
||||
longTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":ocConduitAnim");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setSignalColor(dir, DyeColor.values()[dataRoot.getShort("signalColor")]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
dataRoot.setShort("signalColor", (short) getSignalColor(dir).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getSignalColor(ForgeDirection dir) {
|
||||
DyeColor res = signalColors.get(dir);
|
||||
if (res == null) {
|
||||
return DyeColor.SILVER;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
Collection<CollidableComponent> baseCollidables = super.createCollidables(key);
|
||||
if (key.dir == ForgeDirection.UNKNOWN) {
|
||||
return baseCollidables;
|
||||
}
|
||||
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IOCConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
if (signalColors.size() >= 0) {
|
||||
byte[] modes = new byte[6];
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
DyeColor col = signalColors.get(dir);
|
||||
if (col != null) {
|
||||
modes[i] = (byte) col.ordinal();
|
||||
} else {
|
||||
modes[i] = -1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
nbtRoot.setByteArray("signalColors", modes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
signalColors.clear();
|
||||
byte[] cols = nbtRoot.getByteArray("signalColors");
|
||||
if (cols != null && cols.length == 6) {
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (cols[i] >= 0) {
|
||||
signalColors.put(dir, DyeColor.values()[cols[i]]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
if (signalColors.get(dir) == col) {
|
||||
return;
|
||||
}
|
||||
disconnectNode(dir);
|
||||
signalColors.put(dir, col);
|
||||
addMissingNodeConnections();
|
||||
setClientStateDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IOCConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemOCConduit, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractConduitNetwork<?, ?> getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNetwork(AbstractConduitNetwork<?, ?> network) {
|
||||
if (network == null) {
|
||||
for (ForgeDirection dir : getExternalConnections()) {
|
||||
disconnectNode(dir);
|
||||
}
|
||||
}
|
||||
this.network = (OCConduitNetwork) network;
|
||||
addMissingNodeConnections();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
int state = Config.enableOCConduitsAnimatedTexture ? 1 : 0;
|
||||
if (component.dir == ForgeDirection.UNKNOWN) {
|
||||
return coreTextures[state];
|
||||
} else {
|
||||
return longTextures[state];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMirrorTexture() {
|
||||
return !Config.enableOCConduitsAnimatedTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTransmitionTextureForState(CollidableComponent component) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String prettyNode(Node o) {
|
||||
String at = "";
|
||||
Environment host = o.host();
|
||||
if (host instanceof TileEntity) {
|
||||
BlockCoord bc = new BlockCoord((TileEntity) host);
|
||||
at = " at " + bc.x + "/" + bc.y + "/" + bc.z;
|
||||
}
|
||||
return host.getClass().getName().replaceFirst("^.*\\.", "") + at;
|
||||
}
|
||||
|
||||
private static EnumChatFormatting dye2chat(DyeColor dyeColor) {
|
||||
switch (dyeColor) {
|
||||
case BLACK:
|
||||
return EnumChatFormatting.BLACK;
|
||||
case BLUE:
|
||||
return EnumChatFormatting.DARK_BLUE;
|
||||
case BROWN:
|
||||
return EnumChatFormatting.DARK_RED;
|
||||
case CYAN:
|
||||
return EnumChatFormatting.DARK_AQUA;
|
||||
// return EnumChatFormatting.AQUA;
|
||||
case GRAY:
|
||||
return EnumChatFormatting.DARK_GRAY;
|
||||
case GREEN:
|
||||
return EnumChatFormatting.DARK_GREEN;
|
||||
case LIGHT_BLUE:
|
||||
return EnumChatFormatting.BLUE;
|
||||
case LIME:
|
||||
return EnumChatFormatting.GREEN;
|
||||
case MAGENTA:
|
||||
return EnumChatFormatting.LIGHT_PURPLE;
|
||||
case ORANGE:
|
||||
return EnumChatFormatting.GOLD;
|
||||
case PINK:
|
||||
return EnumChatFormatting.LIGHT_PURPLE;
|
||||
case PURPLE:
|
||||
return EnumChatFormatting.DARK_PURPLE;
|
||||
case RED:
|
||||
return EnumChatFormatting.RED;
|
||||
case SILVER:
|
||||
return EnumChatFormatting.GRAY;
|
||||
case WHITE:
|
||||
return EnumChatFormatting.WHITE;
|
||||
case YELLOW:
|
||||
return EnumChatFormatting.YELLOW;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
DyeColor col = DyeColor.getColorFromDye(player.getCurrentEquippedItem());
|
||||
if (col != null && res.component != null) {
|
||||
setSignalColor(res.component.dir, col);
|
||||
return true;
|
||||
} else if (ConduitUtil.isProbeEquipped(player)) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
BlockCoord bc = getLocation();
|
||||
if (network != null) {
|
||||
boolean noconnections = true;
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
if (node(color).neighbors().iterator().hasNext()) {
|
||||
noconnections = false;
|
||||
ChatComponentText coltxt = new ChatComponentText(color.getLocalisedName());
|
||||
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);
|
||||
for (Node other : node(color).neighbors()) {
|
||||
player.addChatMessage(new ChatComponentText(" Connected to: " + prettyNode(other)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noconnections) {
|
||||
player.addChatMessage(new ChatComponentText("No connections at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("No network at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (ToolUtil.isToolEquipped(player)) {
|
||||
if (!getBundle().getEntity().getWorldObj().isRemote) {
|
||||
if (res != null && res.component != null) {
|
||||
ForgeDirection connDir = res.component.dir;
|
||||
ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
|
||||
if (all != null && containsExternalConnection(connDir)) {
|
||||
for (RaytraceResult rtr : all) {
|
||||
if (rtr != null && rtr.component != null && COLOR_CONTROLLER_ID.equals(rtr.component.data)) {
|
||||
setSignalColor(connDir, DyeColor.getNext(getSignalColor(connDir)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
if (getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
|
||||
setConnectionMode(faceHit, ConnectionMode.IN_OUT);
|
||||
return true;
|
||||
}
|
||||
return ConduitUtil.joinConduits(this, faceHit);
|
||||
} else if (externalConnections.contains(connDir)) {
|
||||
setConnectionMode(connDir, getNextConnectionMode(connDir));
|
||||
return true;
|
||||
} else if (containsConduitConnection(connDir)) {
|
||||
ConduitUtil.disconectConduits(this, connDir);
|
||||
addMissingNodeConnections();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
if (mode == ConnectionMode.DISABLED) {
|
||||
disconnectNode(dir);
|
||||
}
|
||||
super.setConnectionMode(dir, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionsChanged() {
|
||||
super.connectionsChanged();
|
||||
addMissingNodeConnections();
|
||||
}
|
||||
|
||||
private void addMissingNodeConnections() {
|
||||
BlockCoord loc = getLocation();
|
||||
if (loc != null && network != null) {
|
||||
World world = getBundle().getWorld();
|
||||
EnumSet<ForgeDirection> conns = getConnections();
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
Set<Node> should = new HashSet<Node>();
|
||||
for (ForgeDirection direction : conns) {
|
||||
if (getSignalColor(direction) == color) {
|
||||
TileEntity te = getLocation().getLocation(direction).getTileEntity(world);
|
||||
Node other = null;
|
||||
if (te instanceof SidedEnvironment) {
|
||||
other = ((SidedEnvironment) te).sidedNode(direction.getOpposite());
|
||||
} else if (te instanceof Environment) {
|
||||
other = ((Environment) te).node();
|
||||
} else {
|
||||
// We have a connection to something we cannot connect to. Should
|
||||
// not happen. Poke debugger in >here< if it does!
|
||||
}
|
||||
if (other != null && other != node(color)) {
|
||||
should.add(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Node other : should) {
|
||||
if (!node(color).isNeighborOf(other)) {
|
||||
node(color).connect(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void disconnectNode(ForgeDirection direction) {
|
||||
World world = getBundle().getWorld();
|
||||
TileEntity te = getLocation().getLocation(direction).getTileEntity(world);
|
||||
Node other = null;
|
||||
if (te instanceof SidedEnvironment) {
|
||||
other = ((SidedEnvironment) te).sidedNode(direction.getOpposite());
|
||||
} else if (te instanceof Environment) {
|
||||
other = ((Environment) te).node();
|
||||
}
|
||||
if (other != null) {
|
||||
disconnectNode(other, getSignalColor(direction));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will disconnect a node from our network unless it has another
|
||||
* connection to our network. This only works if all the node's blocks are
|
||||
* adjacent to us. Connecting 2 ManagedEnvironments at different locations
|
||||
* won't work well.
|
||||
*
|
||||
* @param other
|
||||
* The node to disconnect from us
|
||||
*/
|
||||
private void disconnectNode(Node other, DyeColor color) {
|
||||
|
||||
// Um. No.
|
||||
if (other == node(color)) {
|
||||
return;
|
||||
}
|
||||
// Two conduit networks never connect to each other. They join instead.
|
||||
Environment otherHost = other.host();
|
||||
if (otherHost instanceof OCConduitNetwork && otherHost != network) {
|
||||
node(color).disconnect(other);
|
||||
return;
|
||||
}
|
||||
|
||||
World world = getBundle().getWorld();
|
||||
EnumSet<ForgeDirection> conns = getConnections();
|
||||
// we need to check if that node has another way of connecting to our
|
||||
// network. First find out which of our neighbor(s) it belongs to. May
|
||||
// be just one, may be many.
|
||||
List<TileEntity> toCheck = new ArrayList<TileEntity>();
|
||||
if (otherHost instanceof TileEntity) {
|
||||
TileEntity otherTe = (TileEntity) otherHost;
|
||||
toCheck.add(otherTe);
|
||||
} else {
|
||||
for (ForgeDirection direction : conns) {
|
||||
if (getSignalColor(direction) == color) {
|
||||
TileEntity te = getLocation().getLocation(direction).getTileEntity(world);
|
||||
Node other2 = null;
|
||||
if (te instanceof SidedEnvironment) {
|
||||
other2 = ((SidedEnvironment) te).sidedNode(direction.getOpposite());
|
||||
} else if (te instanceof Environment) {
|
||||
other2 = ((Environment) te).node();
|
||||
}
|
||||
if (other2 == other) {
|
||||
toCheck.add(te);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Then see if it still has a connection to our node other than through us.
|
||||
boolean stayConnected = false;
|
||||
for (TileEntity otherTe : toCheck) {
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (!stayConnected) {
|
||||
boolean checkThisSide = true;
|
||||
if (otherHost instanceof SidedEnvironment) {
|
||||
checkThisSide = ((SidedEnvironment) otherHost).sidedNode(direction) != null;
|
||||
}
|
||||
if (checkThisSide) {
|
||||
BlockCoord otherPos = new BlockCoord(otherTe);
|
||||
BlockCoord connTo = otherPos.getLocation(direction);
|
||||
if (!connTo.equals(getLocation())) {
|
||||
TileEntity connToTe = connTo.getTileEntity(world);
|
||||
if (connToTe instanceof SidedEnvironment) {
|
||||
stayConnected = ((SidedEnvironment) connToTe).sidedNode(direction.getOpposite()) == node(color);
|
||||
} else if (connToTe instanceof Environment) {
|
||||
stayConnected = ((Environment) connToTe).node() == node(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!stayConnected) {
|
||||
node(color).disconnect(other);
|
||||
}
|
||||
}
|
||||
|
||||
public EnumSet<ForgeDirection> getConnections() {
|
||||
EnumSet<ForgeDirection> cons = EnumSet.noneOf(ForgeDirection.class);
|
||||
cons.addAll(getConduitConnections());
|
||||
for (ForgeDirection dir : getExternalConnections()) {
|
||||
if (getConnectionMode(dir) != ConnectionMode.DISABLED) {
|
||||
cons.add(dir);
|
||||
}
|
||||
}
|
||||
return cons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionMode getNextConnectionMode(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
mode = mode == ConnectionMode.IN_OUT ? ConnectionMode.DISABLED : ConnectionMode.IN_OUT;
|
||||
return mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionMode getPreviousConnectionMode(ForgeDirection dir) {
|
||||
return getNextConnectionMode(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreConnectionMode) {
|
||||
TileEntity te = getLocation().getLocation(direction).getTileEntity(getBundle().getWorld());
|
||||
if (te instanceof SidedEnvironment) {
|
||||
if (getBundle().getWorld().isRemote) {
|
||||
return ((SidedEnvironment) te).canConnect(direction.getOpposite());
|
||||
} else {
|
||||
return ((SidedEnvironment) te).sidedNode(direction.getOpposite()) != null;
|
||||
}
|
||||
} else if (te instanceof Environment) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node node() {
|
||||
return network != null ? network.node(DyeColor.SILVER) : null;
|
||||
}
|
||||
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node node(DyeColor subnet) {
|
||||
return network != null ? network.node(subnet) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onConnect(Node node) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onDisconnect(Node node) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onMessage(Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node sidedNode(ForgeDirection side) {
|
||||
return getConnections().contains(side) ? node(getSignalColor(side)) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public boolean canConnect(ForgeDirection side) {
|
||||
return getConnections().contains(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import li.cil.oc.api.Network;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
|
||||
@Interface(iface = "li.cil.oc.api.network.ManagedEnvironment", modid = "OpenComputersAPI|Network")
|
||||
public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCConduit> implements ManagedEnvironment {
|
||||
|
||||
private Node[] node = new Node[DyeColor.values().length];
|
||||
|
||||
public OCConduitNetwork() {
|
||||
super(IOCConduit.class, IOCConduit.class);
|
||||
for (DyeColor dyeColor : DyeColor.values()) {
|
||||
node[dyeColor.ordinal()] = Network.newNode(this, Visibility.Network).create();
|
||||
Network.joinNewNetwork(node[dyeColor.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public Node node() {
|
||||
return node[DyeColor.SILVER.ordinal()];
|
||||
}
|
||||
|
||||
public Node node(DyeColor subnet) {
|
||||
return node[subnet.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onConnect(Node node) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onDisconnect(Node node) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void onMessage(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void load(NBTTagCompound nbt) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void save(NBTTagCompound nbt) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "OpenComputersAPI|Network")
|
||||
public void update() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyNetwork() {
|
||||
for (DyeColor dyeColor : DyeColor.values()) {
|
||||
node[dyeColor.ordinal()].remove();
|
||||
}
|
||||
super.destroyNetwork();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class OCConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IOCConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
|
||||
if (IOCConduit.COLOR_CONTROLLER_ID.equals(component.data)) {
|
||||
if (conduit.containsExternalConnection(component.dir)) {
|
||||
int c = ((IOCConduit) conduit).getSignalColor(component.dir).getColor();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(c);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
super.renderConduit(tex, conduit, component, selfIllum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class OCUtil {
|
||||
|
||||
private static boolean useCheckPerformed = false;
|
||||
private static boolean isOCConduitEnabled = false;
|
||||
|
||||
public static boolean isOCEnabled() {
|
||||
if(!useCheckPerformed) {
|
||||
isOCConduitEnabled = Loader.isModLoaded("OpenComputers") && Config.enableOCConduits;
|
||||
useCheckPerformed = true;
|
||||
}
|
||||
return isOCConduitEnabled;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
|
||||
@@ -15,7 +16,8 @@ public enum ConTypeEnum {
|
||||
ITEM(IItemConduit.class),
|
||||
REDSTONE(IRedstoneConduit.class),
|
||||
GAS(IGasConduit.class),
|
||||
ME(IMEConduit.class);
|
||||
ME(IMEConduit.class),
|
||||
OC(IOCConduit.class);
|
||||
|
||||
final Class<? extends IConduit> baseType;
|
||||
|
||||
@@ -30,7 +32,7 @@ public enum ConTypeEnum {
|
||||
public static ConTypeEnum get(IConduit con) {
|
||||
Class<? extends IConduit> from = con.getBaseConduitType();
|
||||
for (ConTypeEnum ct : ConTypeEnum.values()) {
|
||||
if(ct.getBaseType() == from) {
|
||||
if (ct.getBaseType() == from) {
|
||||
return ct;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package crazypants.enderio.conduit.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
|
||||
public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit> implements
|
||||
IMessageHandler<PacketOCConduitSignalColor, IMessage> {
|
||||
|
||||
private ForgeDirection dir;
|
||||
private DyeColor col;
|
||||
|
||||
public PacketOCConduitSignalColor() {
|
||||
}
|
||||
|
||||
public PacketOCConduitSignalColor(IOCConduit con, ForgeDirection dir) {
|
||||
super(con.getBundle().getEntity(), ConTypeEnum.OC);
|
||||
this.dir = dir;
|
||||
col = con.getSignalColor(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeShort(dir.ordinal());
|
||||
buf.writeShort(col.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
col = DyeColor.values()[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketOCConduitSignalColor message, MessageContext ctx) {
|
||||
message.getTileCasted(ctx).setSignalColor(message.dir, message.col);
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
|
||||
BoundingBox cube = component.bound;
|
||||
BoundingBox bb = cube.scale(xLen, yLen, zLen);
|
||||
drawSection(bb, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false);
|
||||
drawSection(bb, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false, conduit.shouldMirrorTexture());
|
||||
|
||||
if(conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
|
||||
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
@@ -119,6 +119,11 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
}
|
||||
|
||||
protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir, boolean isTransmission) {
|
||||
drawSection(bound, minU, maxU, minV, maxV, dir, isTransmission, true);
|
||||
}
|
||||
|
||||
protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir,
|
||||
boolean isTransmission, boolean mirrorTexture) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
@@ -128,10 +133,8 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
setupVertices(bound);
|
||||
}
|
||||
|
||||
if(dir == NORTH || dir == UP || dir == EAST) { // maintain consistent
|
||||
// texture
|
||||
// dir relative to the cneter
|
||||
// of the conduit
|
||||
if (mirrorTexture && (dir == NORTH || dir == UP || dir == EAST)) {
|
||||
// maintain consistent texture dir relative to the center of the conduit
|
||||
float tmp = minU;
|
||||
minU = maxU;
|
||||
maxU = tmp;
|
||||
|
||||
@@ -390,6 +390,8 @@ public final class Config {
|
||||
|
||||
public static boolean isGasConduitEnabled = true;
|
||||
public static boolean enableMEConduits = true;
|
||||
public static boolean enableOCConduits = true;
|
||||
public static boolean enableOCConduitsAnimatedTexture = true;
|
||||
|
||||
public static String[] soulVesselBlackList = new String[0];
|
||||
public static boolean soulVesselCapturesBosses = false;
|
||||
@@ -1157,6 +1159,10 @@ public final class Config {
|
||||
isGasConduitEnabled = config.getBoolean("gasConduitEnabled", sectionItems.name, isGasConduitEnabled,
|
||||
"If true, gas conduits will be enabled if the Mekanism Gas API is found. False to forcibly disable.");
|
||||
enableMEConduits = config.getBoolean("enableMEConduits", sectionItems.name, enableMEConduits, "Allows ME conduits. Only has an effect with AE2 installed.");
|
||||
enableOCConduits = config.getBoolean("enableOCConduits", sectionItems.name, enableOCConduits,
|
||||
"Allows OC conduits. Only has an effect with OpenComputers installed.");
|
||||
enableOCConduitsAnimatedTexture = config.getBoolean("enableOCConduitsAnimatedTexture", sectionItems.name,
|
||||
enableOCConduitsAnimatedTexture, "Use the animated texture for OC conduits.");
|
||||
|
||||
soulVesselBlackList = config.getStringList("soulVesselBlackList", sectionSoulBinder.name, soulVesselBlackList,
|
||||
"Entities listed here will can not be captured in a Soul Vial");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package crazypants.enderio.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.api.client.render.IWidgetIcon;
|
||||
import com.enderio.core.api.client.render.IWidgetMap;
|
||||
|
||||
@@ -37,6 +37,9 @@ public enum IconEIO implements IWidgetIcon {
|
||||
WRENCH_OVERLAY_ME(32, 128),
|
||||
WRENCH_OVERLAY_ME_OFF(32 + 48, 128),
|
||||
|
||||
WRENCH_OVERLAY_OC(96, 112),
|
||||
WRENCH_OVERLAY_OC_OFF(96, 128),
|
||||
|
||||
PROBE_OVERLAY_PROBE(112, 192, 16, 16),
|
||||
PROBE_OVERLAY_COPY(128, 192, 16, 16),
|
||||
PROBE_OVERLAY_PROBE_OFF(144, 192, 16, 16),
|
||||
@@ -134,7 +137,9 @@ public enum IconEIO implements IWidgetIcon {
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("enderio:textures/gui/widgetsv2.png");
|
||||
|
||||
public static final IWidgetMap map = new IWidgetMap.WidgetMapImpl(TEX_SIZE, TEXTURE) {
|
||||
public void render(IWidgetIcon widget, double x, double y, double width, double height, double zLevel, boolean doDraw, boolean flipY) {
|
||||
@Override
|
||||
public void render(IWidgetIcon widget, double x, double y, double width, double height, double zLevel, boolean doDraw,
|
||||
boolean flipY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.render(widget, x, y, width, height, zLevel, doDraw, flipY);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
riddenByEntity = riddenByEntity.riddenByEntity;
|
||||
}
|
||||
|
||||
if(player == null || !player.capabilities.isCreativeMode) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if(itemstack.stackSize > 1) {
|
||||
itemstack.stackSize--;
|
||||
player.inventory.addItemStackToInventory(new ItemStack(this));
|
||||
|
||||
@@ -19,6 +19,7 @@ import crazypants.enderio.api.tool.IConduitControl;
|
||||
import crazypants.enderio.conduit.ConduitDisplayMode;
|
||||
import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class YetaWrenchOverlayRenderer {
|
||||
@@ -89,37 +90,43 @@ public class YetaWrenchOverlayRenderer {
|
||||
}
|
||||
boolean meEnabled = MEUtil.isMEEnabled();
|
||||
boolean gasEnabled = GasUtil.isGasConduitEnabled();
|
||||
boolean ocEnabled = OCUtil.isOCEnabled();
|
||||
|
||||
onIcons = new IconEIO[numIcons];
|
||||
offIcons = new IconEIO[numIcons];
|
||||
iconOffsets = new Point[numIcons];
|
||||
int index = 0;
|
||||
|
||||
indices.put(ConduitDisplayMode.POWER, 0);
|
||||
onIcons[0] = IconEIO.WRENCH_OVERLAY_POWER;
|
||||
offIcons[0] = IconEIO.WRENCH_OVERLAY_POWER_OFF;
|
||||
indices.put(ConduitDisplayMode.POWER, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_POWER;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_POWER_OFF;
|
||||
|
||||
indices.put(ConduitDisplayMode.REDSTONE, 1);
|
||||
onIcons[1] = IconEIO.WRENCH_OVERLAY_REDSTONE;
|
||||
offIcons[1] = IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
|
||||
indices.put(ConduitDisplayMode.REDSTONE, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_REDSTONE;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
|
||||
|
||||
indices.put(ConduitDisplayMode.FLUID, 2);
|
||||
onIcons[2] = IconEIO.WRENCH_OVERLAY_FLUID;
|
||||
offIcons[2] = IconEIO.WRENCH_OVERLAY_FLUID_OFF;
|
||||
indices.put(ConduitDisplayMode.FLUID, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_FLUID;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_FLUID_OFF;
|
||||
|
||||
indices.put(ConduitDisplayMode.ITEM, 3);
|
||||
onIcons[3] = IconEIO.WRENCH_OVERLAY_ITEM;
|
||||
offIcons[3] = IconEIO.WRENCH_OVERLAY_ITEM_OFF;
|
||||
indices.put(ConduitDisplayMode.ITEM, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_ITEM;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_ITEM_OFF;
|
||||
|
||||
if(meEnabled) {
|
||||
indices.put(ConduitDisplayMode.ME, 4);
|
||||
onIcons[4] = IconEIO.WRENCH_OVERLAY_ME;
|
||||
offIcons[4] = IconEIO.WRENCH_OVERLAY_ME_OFF;
|
||||
indices.put(ConduitDisplayMode.ME, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_ME;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_ME_OFF;
|
||||
}
|
||||
if(gasEnabled) {
|
||||
int index = meEnabled ? 5 : 4;
|
||||
indices.put(ConduitDisplayMode.GAS, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_GAS;
|
||||
offIcons[index] = IconEIO.WRENCH_OVERLAY_GAS_OFF;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_GAS_OFF;
|
||||
}
|
||||
if (ocEnabled) {
|
||||
indices.put(ConduitDisplayMode.OC, index);
|
||||
onIcons[index] = IconEIO.WRENCH_OVERLAY_OC;
|
||||
offIcons[index++] = IconEIO.WRENCH_OVERLAY_OC_OFF;
|
||||
}
|
||||
|
||||
int xOffset = numIcons == 5 ? 8 : 0;
|
||||
@@ -139,7 +146,8 @@ public class YetaWrenchOverlayRenderer {
|
||||
private int getNumConduitsEnabled() {
|
||||
boolean meEnabled = MEUtil.isMEEnabled();
|
||||
boolean gasEnabled = GasUtil.isGasConduitEnabled();
|
||||
return 4 + (meEnabled ? 1 : 0) + (gasEnabled ? 1 : 0);
|
||||
boolean ocEnabled = OCUtil.isOCEnabled();
|
||||
return 4 + (meEnabled ? 1 : 0) + (gasEnabled ? 1 : 0) + (ocEnabled ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||