More work. @unpairedbracket, I wasn't able to get connected textures to work with my Induction Ports - would you mind taking a look at the code?
The ports have an "output" and "input" mode with different textures, you can change the mode by shift-right clicking the port with a configurator. For some reason, no matter what I do, only the input texture is shown when I use the ctm system. For now I am using default block textures, but CTM textures are much preferred!
This commit is contained in:
parent
13f36a52a6
commit
2ed43e5328
13 changed files with 135 additions and 40 deletions
|
@ -1,10 +1,8 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.inventory.container.ContainerInductionMatrix;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -24,7 +22,6 @@ public class GuiInductionMatrix extends GuiMekanism
|
|||
{
|
||||
super(tentity, new ContainerInductionMatrix(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiContainerEditMode(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiInductionMatrix.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,6 +53,7 @@ public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
|
||||
return rendererCTM.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(1, 0, 4, 5, 14, 19, 17, 23, 9);
|
||||
|
@ -170,8 +170,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(3, 2, 6, 7, 15, 25, 16, 21, 11);
|
||||
|
@ -193,8 +193,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(2, 3, 0, 1, 15, 18, 14, 22, 8);
|
||||
|
@ -217,8 +217,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(4, 7, 6, 5, 20, 16, 24, 17, 10);
|
||||
|
@ -240,8 +240,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(0, 3, 7, 4, 18, 21, 20, 19, 13);
|
||||
|
@ -263,8 +263,8 @@ public class RenderBlocksCTM extends RenderBlocks
|
|||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1, dataCTM.acceptableBlockMetas);
|
||||
|
||||
setupSides(2, 1, 5, 6, 22, 23, 24, 25, 12);
|
||||
|
|
|
@ -93,5 +93,4 @@ public class TextureVirtual implements IIcon
|
|||
{
|
||||
return oy;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ public class CTMData
|
|||
{
|
||||
return facingOverride;
|
||||
}
|
||||
|
||||
if(sideOverrides[side] != null)
|
||||
{
|
||||
return sideOverrides[side];
|
||||
|
|
|
@ -176,18 +176,17 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
|||
break;
|
||||
case BASIC_BLOCK_2:
|
||||
ctms[0][0] = new CTMData("ctm/SolarEvaporationBlock", this, Arrays.asList(0)).addOtherBlockConnectivities(MekanismBlocks.BasicBlock, Arrays.asList(14, 15)).registerIcons(register);
|
||||
//ctms[1][0] = new CTMData("ctm/SteamBoiler", this, Arrays.asList(1, 2)).registerIcons(register);
|
||||
//ctms[2][0] = new CTMData("ctm/BoilerValve", this, Arrays.asList(2, 1)).registerIcons(register);
|
||||
ctms[1][0] = new CTMData("ctm/InductionCasing", this, Arrays.asList(1, 2)).registerIcons(register);
|
||||
ctms[2][0] = new CTMData("ctm/InductionPortInput", this, Arrays.asList(2, 1)).registerIcons(register);
|
||||
ctms[2][1] = new CTMData("ctm/InductionPortOutput", this, Arrays.asList(2, 1)).registerIcons(register);
|
||||
|
||||
//ctms[2][0] = new CTMData("ctm/InductionPortInput", this, Arrays.asList(1, 2)).registerIcons(register);
|
||||
//ctms[2][1] = new CTMData("ctm/InductionPortOutput", this, Arrays.asList(1, 2)).registerIcons(register);
|
||||
//TODO @unpairedbracket, mind fixing this?
|
||||
|
||||
icons[0][0] = ctms[0][0].mainTextureData.icon;
|
||||
//icons[1][0] = ctms[1][0].mainTextureData.icon;
|
||||
//icons[2][0] = ctms[2][0].mainTextureData.icon;
|
||||
icons[1][0] = ctms[1][0].mainTextureData.icon;
|
||||
icons[2][0] = ctms[2][0].mainTextureData.icon;
|
||||
icons[2][1] = ctms[2][1].mainTextureData.icon;
|
||||
icons[2][0] = ctms[2][0].facingOverride.icon;
|
||||
icons[2][1] = ctms[2][1].facingOverride.icon;
|
||||
icons[2][0] = register.registerIcon("mekanism:InductionPortInput");
|
||||
icons[2][1] = register.registerIcon("mekanism:InductionPortOutput");
|
||||
icons[3][0] = register.registerIcon("mekanism:InductionCellBasic");
|
||||
icons[3][1] = register.registerIcon("mekanism:InductionCellAdvanced");
|
||||
icons[3][2] = register.registerIcon("mekanism:InductionCellElite");
|
||||
|
@ -225,10 +224,6 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
|||
else {
|
||||
return icons[meta][0];
|
||||
}
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
return ctms[meta][0].getIcon(side);
|
||||
case 14:
|
||||
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
|
||||
|
||||
|
@ -318,6 +313,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
|||
{
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
break;
|
||||
case BASIC_BLOCK_2:
|
||||
for(int i = 0; i < 5; i++)
|
||||
|
@ -547,6 +543,26 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(blockType == BasicBlock.BASIC_BLOCK_2)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(metadata == 1 || metadata == 2)
|
||||
{
|
||||
if(!entityplayer.isSneaking() && ((TileEntityInductionCasing)world.getTileEntity(x, y, z)).structure != null)
|
||||
{
|
||||
TileEntityInductionCasing tileEntity = (TileEntityInductionCasing)world.getTileEntity(x, y, z);
|
||||
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
entityplayer.openGui(Mekanism.instance, 49, world, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,9 @@ public class ContainerEnergyCube extends Container
|
|||
public ContainerEnergyCube(InventoryPlayer inventory, TileEntityEnergyCube unit)
|
||||
{
|
||||
tileEntity = unit;
|
||||
addSlotToContainer(new SlotDischarge(unit, 1, 17, 35));
|
||||
|
||||
addSlotToContainer(new SlotCharge(unit, 0, 143, 35));
|
||||
addSlotToContainer(new SlotDischarge(unit, 1, 17, 35));
|
||||
|
||||
int slotY;
|
||||
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import ic2.api.item.IElectricItem;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotCharge;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
public class ContainerInductionMatrix extends Container
|
||||
{
|
||||
|
@ -65,19 +68,73 @@ public class ContainerInductionMatrix extends Container
|
|||
ItemStack slotStack = currentSlot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if(FluidContainerRegistry.isEmptyContainer(slotStack) || FluidContainerRegistry.isFilledContainer(slotStack))
|
||||
if(ChargeUtils.canBeCharged(slotStack) || ChargeUtils.canBeDischarged(slotStack))
|
||||
{
|
||||
if(slotID != 0 && slotID != 1)
|
||||
if(slotStack.getItem() == Items.redstone)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
if(slotID != 1)
|
||||
{
|
||||
return null;
|
||||
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
if(slotID != 1 && slotID != 0)
|
||||
{
|
||||
return null;
|
||||
if(ChargeUtils.canBeDischarged(slotStack))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
if(canTransfer(slotStack))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(canTransfer(slotStack))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
if(canTransfer(slotStack))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,4 +179,9 @@ public class ContainerInductionMatrix extends Container
|
|||
|
||||
return stack;
|
||||
}
|
||||
|
||||
private boolean canTransfer(ItemStack slotStack)
|
||||
{
|
||||
return MekanismUtils.useIC2() && slotStack.getItem() instanceof IElectricItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.content.matrix.MatrixUpdateProtocol;
|
||||
import mekanism.common.content.matrix.SynchronizedMatrixData;
|
||||
import mekanism.common.multiblock.MultiblockManager;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TileEntityInductionCasing extends TileEntityMultiblock<SynchronizedMatrixData>
|
||||
|
@ -36,4 +37,10 @@ public class TileEntityInductionCasing extends TileEntityMultiblock<Synchronized
|
|||
{
|
||||
return Mekanism.matrixManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return MekanismUtils.localize("gui.inductionMatrix");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,13 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.energy.ICableOutputter;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.api.transmitters.IGridTransmitter;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -133,14 +136,19 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
|
|||
public void handlePacketData(ByteBuf dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
setEnergy(dataStream.readDouble());
|
||||
|
||||
mode = dataStream.readBoolean();
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
data.add(getEnergy());
|
||||
|
||||
data.add(mode);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -406,7 +414,9 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
|
|||
{
|
||||
mode = !mode;
|
||||
String modeText = " " + (mode ? EnumColor.DARK_RED : EnumColor.DARK_GREEN) + LangUtils.transOutputInput(mode) + ".";
|
||||
player.addChatMessage(new ChatComponentText(MekanismUtils.localize("tooltip.inductionPortMode") + modeText));
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.inductionPortMode") + modeText));
|
||||
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
|
||||
markDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -403,6 +403,7 @@ gui.fuel=Fuel
|
|||
gui.heat=Heat
|
||||
gui.formed=Formed
|
||||
gui.incomplete=Incomplete
|
||||
gui.inductionMatrix=Induction Matrix
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue