diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index a97360691..4ffeff1b3 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -142,6 +142,10 @@ import mekanism.common.tile.TileEntityEntangledBlock; import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityGasTank; +import mekanism.common.tile.TileEntityInductionCasing; +import mekanism.common.tile.TileEntityInductionCell; +import mekanism.common.tile.TileEntityInductionPort; +import mekanism.common.tile.TileEntityInductionProvider; import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLaserTractorBeam; @@ -321,6 +325,10 @@ public class ClientProxy extends CommonProxy ClientRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam", new RenderLaserTractorBeam()); ClientRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator", new RenderSolarNeutronActivator()); GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator"); + GameRegistry.registerTileEntity(TileEntityInductionCasing.class, "InductionCasing"); + GameRegistry.registerTileEntity(TileEntityInductionPort.class, "InductionPort"); + GameRegistry.registerTileEntity(TileEntityInductionCell.class, "InductionCell"); + GameRegistry.registerTileEntity(TileEntityInductionProvider.class, "InductionProvider"); } @Override @@ -347,6 +355,7 @@ public class ClientProxy extends CommonProxy MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.GasTank), handler); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), handler); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.BasicBlock), handler); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.Jetpack, handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.ArmoredJetpack, handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.PartTransmitter, handler); diff --git a/src/main/java/mekanism/client/render/MekanismRenderer.java b/src/main/java/mekanism/client/render/MekanismRenderer.java index 274913fda..91c473a5a 100644 --- a/src/main/java/mekanism/client/render/MekanismRenderer.java +++ b/src/main/java/mekanism/client/render/MekanismRenderer.java @@ -357,16 +357,9 @@ public class MekanismRenderer GL11.glDisable(GL12.GL_RESCALE_NORMAL); } - /** - * Cleaned-up snip of RenderBlocks.renderBlockAsItem() -- used for rendering an item as an entity, - * in a player's inventory, and in a player's hand. - * @param renderer - RenderBlocks renderer to render the item with - * @param metadata - block/item metadata - * @param block - block to render - */ - public static void renderItem(RenderBlocks renderer, int metadata, Block block) - { - if(!(block instanceof ISpecialBounds) || ((ISpecialBounds)block).doDefaultBoundSetting(metadata)) + public static void prepareItemRender(RenderBlocks renderer, int metadata, Block block) + { + if(!(block instanceof ISpecialBounds) || ((ISpecialBounds)block).doDefaultBoundSetting(metadata)) { block.setBlockBoundsForItemRender(); } @@ -394,7 +387,60 @@ public class MekanismRenderer } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - + } + + public static void renderCustomItem(RenderBlocks renderer, ItemStack stack) + { + Block block = Block.getBlockFromItem(stack.getItem()); + + if(block instanceof ICustomBlockIcon) + { + ICustomBlockIcon custom = (ICustomBlockIcon)block; + prepareItemRender(renderer, stack.getItemDamage(), Block.getBlockFromItem(stack.getItem())); + + try { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 0)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 1)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 2)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 3)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 4)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, custom.getIcon(stack, 5)); + tessellator.draw(); + } catch(Exception e) {} + + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + + /** + * Cleaned-up snip of RenderBlocks.renderBlockAsItem() -- used for rendering an item as an entity, + * in a player's inventory, and in a player's hand. + * @param renderer - RenderBlocks renderer to render the item with + * @param metadata - block/item metadata + * @param block - block to render + */ + public static void renderItem(RenderBlocks renderer, int metadata, Block block) + { + prepareItemRender(renderer, metadata, block); + try { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -527,4 +573,9 @@ public class MekanismRenderer { return TextureMap.locationItemsTexture; } + + public static interface ICustomBlockIcon + { + public IIcon getIcon(ItemStack stack, int side); + } } diff --git a/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java b/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java index 7cd470fb2..b0c6e7c47 100644 --- a/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java +++ b/src/main/java/mekanism/client/render/item/ItemRenderingHandler.java @@ -46,7 +46,6 @@ import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityPortableTank; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; - import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -65,11 +64,12 @@ import net.minecraft.src.FMLRenderAccessLibrary; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class ItemRenderingHandler implements IItemRenderer { @@ -162,9 +162,17 @@ public class ItemRenderingHandler implements IItemRenderer GL11.glPopMatrix(); } - else if(item.getItem() instanceof ItemBlockBasic && item.getItemDamage() == 6) + else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock2 && item.getItemDamage() == 3) { - FMLRenderAccessLibrary.renderInventoryBlock((RenderBlocks) data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID); + MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item); + } + else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock2 && item.getItemDamage() == 4) + { + MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item); + } + else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock && item.getItemDamage() == 6) + { + FMLRenderAccessLibrary.renderInventoryBlock((RenderBlocks)data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID); if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null) { diff --git a/src/main/java/mekanism/common/CommonProxy.java b/src/main/java/mekanism/common/CommonProxy.java index 008ca35b9..890c880a9 100644 --- a/src/main/java/mekanism/common/CommonProxy.java +++ b/src/main/java/mekanism/common/CommonProxy.java @@ -77,7 +77,9 @@ import mekanism.common.tile.TileEntityEnrichmentChamber; import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityGasTank; +import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCell; +import mekanism.common.tile.TileEntityInductionPort; import mekanism.common.tile.TileEntityInductionProvider; import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaserAmplifier; @@ -163,6 +165,8 @@ public class CommonProxy GameRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam"); GameRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator"); GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator"); + GameRegistry.registerTileEntity(TileEntityInductionCasing.class, "InductionCasing"); + GameRegistry.registerTileEntity(TileEntityInductionPort.class, "InductionPort"); GameRegistry.registerTileEntity(TileEntityInductionCell.class, "InductionCell"); GameRegistry.registerTileEntity(TileEntityInductionProvider.class, "InductionProvider"); } diff --git a/src/main/java/mekanism/common/block/BlockBasic.java b/src/main/java/mekanism/common/block/BlockBasic.java index 31688cd80..0253285b5 100644 --- a/src/main/java/mekanism/common/block/BlockBasic.java +++ b/src/main/java/mekanism/common/block/BlockBasic.java @@ -8,27 +8,31 @@ import java.util.Random; import mekanism.api.Coord4D; import mekanism.api.Range4D; import mekanism.client.ClientProxy; +import mekanism.client.render.MekanismRenderer.ICustomBlockIcon; import mekanism.common.CTMData; import mekanism.common.ItemAttacher; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.Tier.BaseTier; import mekanism.common.base.IActiveState; import mekanism.common.base.IBlockCTM; import mekanism.common.base.IBoundingBlock; import mekanism.common.content.tank.TankUpdateProtocol; import mekanism.common.inventory.InventoryBin; +import mekanism.common.item.ItemBlockBasic; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityBin; -import mekanism.common.tile.TileEntityBoiler; -import mekanism.common.tile.TileEntityBoilerValve; import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityDynamicValve; +import mekanism.common.tile.TileEntityInductionCasing; +import mekanism.common.tile.TileEntityInductionCell; +import mekanism.common.tile.TileEntityInductionPort; +import mekanism.common.tile.TileEntityInductionProvider; import mekanism.common.tile.TileEntitySolarEvaporationBlock; import mekanism.common.tile.TileEntitySolarEvaporationController; import mekanism.common.tile.TileEntitySolarEvaporationValve; import mekanism.common.util.MekanismUtils; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -73,12 +77,14 @@ import cpw.mods.fml.relauncher.SideOnly; * 0:14: Solar Evaporation Controller * 0:15: Solar Evaporation Valve * 1:0: Solar Evaporation Block - * 1:1: Steam Boiler - * 1:2: Boiler Valve + * 1:1: Induction Casing + * 1:2: Induction Port + * 1:3: Induction Cell + * 1:4: Induction Provider * @author AidanBrady * */ -public class BlockBasic extends Block implements IBlockCTM +public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon { public IIcon[][] icons = new IIcon[16][6]; @@ -94,6 +100,21 @@ public class BlockBasic extends Block implements IBlockCTM setCreativeTab(Mekanism.tabMekanism); blockType = type; } + + @Override + public IIcon getIcon(ItemStack stack, int side) + { + if(getBlockFromItem(stack.getItem()) == MekanismBlocks.BasicBlock2 && stack.getItemDamage() == 3) + { + return icons[3][((ItemBlockBasic)stack.getItem()).getTier(stack).ordinal()]; + } + else if(getBlockFromItem(stack.getItem()) == MekanismBlocks.BasicBlock2 && stack.getItemDamage() == 4) + { + return icons[4][((ItemBlockBasic)stack.getItem()).getTier(stack).ordinal()]; + } + + return getIcon(side, stack.getItemDamage()); + } @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) @@ -154,12 +175,24 @@ public class BlockBasic extends Block implements IBlockCTM 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/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/InductionPort", this, Arrays.asList(2, 1)).registerIcons(register); 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[3][0] = register.registerIcon("mekanism:InductionCellBasic"); + icons[3][1] = register.registerIcon("mekanism:InductionCellAdvanced"); + icons[3][2] = register.registerIcon("mekanism:InductionCellElite"); + icons[3][3] = register.registerIcon("mekanism:InductionCellUltimate"); + icons[4][0] = register.registerIcon("mekanism:InductionProviderBasic"); + icons[4][1] = register.registerIcon("mekanism:InductionProviderAdvanced"); + icons[4][2] = register.registerIcon("mekanism:InductionProviderElite"); + icons[4][3] = register.registerIcon("mekanism:InductionProviderUltimate"); break; } } @@ -176,16 +209,17 @@ public class BlockBasic extends Block implements IBlockCTM switch(meta) { case 6: - TileEntityBasicBlock tileEntity6 = (TileEntityBasicBlock)world.getTileEntity(x, y, z); + TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z); if(side == 0 || side == 1) { return MekanismUtils.isActive(world, x, y, z) ? icons[meta][3] : icons[meta][1]; - } else if(side == tileEntity6.facing) + } + else if(side == tileEntity.facing) { return MekanismUtils.isActive(world, x, y, z) ? icons[meta][4] : icons[meta][2]; - } else - { + } + else { return icons[meta][0]; } case 9: @@ -193,13 +227,13 @@ public class BlockBasic extends Block implements IBlockCTM case 11: return ctms[meta][0].getIcon(side); case 14: - TileEntitySolarEvaporationController tileEntity14 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z); + TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z); - if(side == tileEntity14.facing) + if(side == tileEntity1.facing) { return MekanismUtils.isActive(world, x, y, z) ? icons[meta][1] : icons[meta][0]; - } else - { + } + else { return icons[meta][2]; } default: @@ -208,6 +242,12 @@ public class BlockBasic extends Block implements IBlockCTM case BASIC_BLOCK_2: switch(meta) { + case 3: + TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z); + return icons[meta][tileEntity.tier.ordinal()]; + case 4: + TileEntityInductionProvider tileEntity1 = (TileEntityInductionProvider)world.getTileEntity(x, y, z); + return icons[meta][tileEntity1.tier.ordinal()]; default: return getIcon(side, meta); } @@ -229,19 +269,20 @@ public class BlockBasic extends Block implements IBlockCTM if(side == 0 || side == 1) { return icons[meta][1]; - } else if(side == 3) + } + else if(side == 3) { return icons[meta][2]; - } else - { + } + else { return icons[meta][0]; } case 14: if(side == 3) { return icons[meta][0]; - } else - { + } + else { return icons[meta][2]; } default: @@ -273,10 +314,37 @@ public class BlockBasic extends Block implements IBlockCTM } break; case BASIC_BLOCK_2: - for(int i = 0; i < 3; i++) + for(int i = 0; i < 5; i++) { - list.add(new ItemStack(item, 1, i)); + if(i == 3) + { + for(BaseTier tier : BaseTier.values()) + { + if(tier.isObtainable()) + { + ItemStack stack = new ItemStack(item, 1, i); + ((ItemBlockBasic)stack.getItem()).setTier(stack, tier); + list.add(stack); + } + } + } + else if(i == 4) + { + for(BaseTier tier : BaseTier.values()) + { + if(tier.isObtainable()) + { + ItemStack stack = new ItemStack(item, 1, i); + ((ItemBlockBasic)stack.getItem()).setTier(stack, tier); + list.add(stack); + } + } + } + else { + list.add(new ItemStack(item, 1, i)); + } } + break; } } @@ -304,17 +372,43 @@ public class BlockBasic extends Block implements IBlockCTM { return false; } - } else - { + } + else { if(tileEntity.clientHasStructure) { return false; } } } + default: + return super.canCreatureSpawn(type, world, x, y, z); } case BASIC_BLOCK_2: - return super.canCreatureSpawn(type, world, x, y, z); + switch(meta) + { + case 1: + case 2: + TileEntityInductionCasing tileEntity = (TileEntityInductionCasing)world.getTileEntity(x, y, z); + + if(tileEntity != null) + { + if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) + { + if(tileEntity.structure != null) + { + return false; + } + } + else { + if(tileEntity.clientHasStructure) + { + return false; + } + } + } + default: + return super.canCreatureSpawn(type, world, x, y, z); + } default: return super.canCreatureSpawn(type, world, x, y, z); } @@ -652,6 +746,8 @@ public class BlockBasic extends Block implements IBlockCTM case 0: case 1: case 2: + case 3: + case 4: return true; default: return false; @@ -690,9 +786,13 @@ public class BlockBasic extends Block implements IBlockCTM case 0: return new TileEntitySolarEvaporationBlock(); case 1: - return new TileEntityBoiler(); + return new TileEntityInductionCasing(); case 2: - return new TileEntityBoilerValve(); + return new TileEntityInductionPort(); + case 3: + return new TileEntityInductionCell(); + case 4: + return new TileEntityInductionProvider(); default: return null; } @@ -778,6 +878,19 @@ public class BlockBasic extends Block implements IBlockCTM } } } + else if(blockType == BasicBlock.BASIC_BLOCK_2) + { + if(ret.getItemDamage() == 3) + { + TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z); + ((ItemBlockBasic)ret.getItem()).setTier(ret, tileEntity.tier.getBaseTier()); + } + else if(ret.getItemDamage() == 4) + { + TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z); + ((ItemBlockBasic)ret.getItem()).setTier(ret, tileEntity.tier.getBaseTier()); + } + } return ret; } @@ -833,6 +946,7 @@ public class BlockBasic extends Block implements IBlockCTM public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { Coord4D obj = new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side).getOpposite()); + if(blockType == BasicBlock.BASIC_BLOCK_1 && obj.getMetadata(world) == 10) { return ctms[10][0].shouldRenderSide(world, x, y, z, side); @@ -860,6 +974,7 @@ public class BlockBasic extends Block implements IBlockCTM } } } + return valid; } diff --git a/src/main/java/mekanism/common/block/BlockEnergyCube.java b/src/main/java/mekanism/common/block/BlockEnergyCube.java index 07ba8b875..041b0fce5 100644 --- a/src/main/java/mekanism/common/block/BlockEnergyCube.java +++ b/src/main/java/mekanism/common/block/BlockEnergyCube.java @@ -48,6 +48,8 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider; * 0: Basic Energy Cube * 1: Advanced Energy Cube * 2: Elite Energy Cube + * 3: Ultimate Energy Cube + * 4: Creative Energy Cube * @author AidanBrady * */ diff --git a/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java b/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java index b25481a92..1fa4669b0 100644 --- a/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java +++ b/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java @@ -1,5 +1,48 @@ package mekanism.common.content.matrix; -public class MatrixUpdateProtocol { +import java.util.List; +import mekanism.common.Mekanism; +import mekanism.common.multiblock.MultiblockCache; +import mekanism.common.multiblock.MultiblockManager; +import mekanism.common.multiblock.UpdateProtocol; +import mekanism.common.tile.TileEntityMultiblock; +import net.minecraft.item.ItemStack; + +public class MatrixUpdateProtocol extends UpdateProtocol +{ + public MatrixUpdateProtocol(TileEntityMultiblock tileEntity) + { + super(tileEntity); + } + + @Override + protected boolean isValidFrame(int x, int y, int z) + { + return false; + } + + @Override + protected MatrixCache getNewCache() + { + return new MatrixCache(); + } + + @Override + protected SynchronizedMatrixData getNewStructure() + { + return new SynchronizedMatrixData(); + } + + @Override + protected MultiblockManager getManager() + { + return Mekanism.matrixManager; + } + + @Override + protected void mergeCaches(List rejectedItems, MultiblockCache cache, MultiblockCache merge) + { + + } } diff --git a/src/main/java/mekanism/common/item/ItemBlockBasic.java b/src/main/java/mekanism/common/item/ItemBlockBasic.java index 4181ab180..60e7498a9 100644 --- a/src/main/java/mekanism/common/item/ItemBlockBasic.java +++ b/src/main/java/mekanism/common/item/ItemBlockBasic.java @@ -1,16 +1,26 @@ package mekanism.common.item; +import java.util.ArrayList; import java.util.List; +import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.api.Range4D; +import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.Tier.BaseTier; +import mekanism.common.Tier.InductionCellTier; +import mekanism.common.Tier.InductionProviderTier; import mekanism.common.inventory.InventoryBin; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityBin; - +import mekanism.common.tile.TileEntityInductionCell; +import mekanism.common.tile.TileEntityInductionProvider; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; @@ -35,6 +45,10 @@ import cpw.mods.fml.relauncher.SideOnly; * 0:14: Solar Evaporation Controller * 0:15: Solar Evaporation Valve * 1:0: Solar Evaporation Block + * 1:1: Induction Casing + * 1:2: Induction Port + * 1:3: Induction Cell + * 1:4: Induction Provider * @author AidanBrady * */ @@ -48,6 +62,26 @@ public class ItemBlockBasic extends ItemBlock metaBlock = block; setHasSubtypes(true); } + + public BaseTier getTier(ItemStack itemstack) + { + if(itemstack.stackTagCompound == null) + { + return BaseTier.BASIC; + } + + return BaseTier.values()[itemstack.stackTagCompound.getInteger("tier")]; + } + + public void setTier(ItemStack itemstack, BaseTier tier) + { + if(itemstack.stackTagCompound == null) + { + itemstack.setTagCompound(new NBTTagCompound()); + } + + itemstack.stackTagCompound.setInteger("tier", tier.ordinal()); + } @Override public int getItemStackLimit(ItemStack stack) @@ -158,6 +192,29 @@ public class ItemBlockBasic extends ItemBlock tileEntity.setItemCount(inv.getItemCount()); } } + else if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2) + { + if(stack.getItemDamage() == 3) + { + TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z); + tileEntity.tier = InductionCellTier.values()[getTier(stack).ordinal()]; + + if(!world.isRemote) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); + } + } + else if(stack.getItemDamage() == 4) + { + TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z); + tileEntity.tier = InductionProviderTier.values()[getTier(stack).ordinal()]; + + if(!world.isRemote) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); + } + } + } } return place; @@ -232,6 +289,18 @@ public class ItemBlockBasic extends ItemBlock case 0: name = "SolarEvaporationBlock"; break; + case 1: + name = "InductionCasing"; + break; + case 2: + name = "InductionPort"; + break; + case 3: + name = "InductionCell" + getTier(itemstack).getName(); + break; + case 4: + name = "InductionProvider" + getTier(itemstack).getName(); + break; } } diff --git a/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java b/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java index 9025a328b..02d491af8 100644 --- a/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java +++ b/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java @@ -35,7 +35,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock +{ + public TileEntityInductionCasing() + { + this("InductionCasing"); + } + + public TileEntityInductionCasing(String name) + { + super(name); + } + + @Override + protected SynchronizedMatrixData getNewStructure() + { + return new SynchronizedMatrixData(); + } + + @Override + protected MatrixUpdateProtocol getProtocol() + { + return new MatrixUpdateProtocol(this); + } + + @Override + public MultiblockManager getManager() + { + return Mekanism.matrixManager; + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityInductionCell.java b/src/main/java/mekanism/common/tile/TileEntityInductionCell.java index 0ca94f201..2e073bb29 100644 --- a/src/main/java/mekanism/common/tile/TileEntityInductionCell.java +++ b/src/main/java/mekanism/common/tile/TileEntityInductionCell.java @@ -1,6 +1,12 @@ package mekanism.common.tile; +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; + import mekanism.common.Tier.InductionCellTier; +import mekanism.common.util.MekanismUtils; +import net.minecraft.nbt.NBTTagCompound; public class TileEntityInductionCell extends TileEntityBasicBlock { @@ -14,4 +20,40 @@ public class TileEntityInductionCell extends TileEntityBasicBlock { return false; } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + tier = InductionCellTier.values()[dataStream.readInt()]; + + super.handlePacketData(dataStream); + + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + data.add(tier.ordinal()); + + super.getNetworkedData(data); + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + tier = InductionCellTier.values()[nbtTags.getInteger("tier")]; + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setInteger("tier", tier.ordinal()); + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityInductionPort.java b/src/main/java/mekanism/common/tile/TileEntityInductionPort.java new file mode 100644 index 000000000..21032c497 --- /dev/null +++ b/src/main/java/mekanism/common/tile/TileEntityInductionPort.java @@ -0,0 +1,6 @@ +package mekanism.common.tile; + +public class TileEntityInductionPort extends TileEntityInductionCasing +{ + +} diff --git a/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java b/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java index bda7ff115..02142b4a9 100644 --- a/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java +++ b/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java @@ -1,6 +1,12 @@ package mekanism.common.tile; +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; + import mekanism.common.Tier.InductionProviderTier; +import mekanism.common.util.MekanismUtils; +import net.minecraft.nbt.NBTTagCompound; public class TileEntityInductionProvider extends TileEntityBasicBlock { @@ -14,4 +20,40 @@ public class TileEntityInductionProvider extends TileEntityBasicBlock { return false; } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + tier = InductionProviderTier.values()[dataStream.readInt()]; + + super.handlePacketData(dataStream); + + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + data.add(tier.ordinal()); + + super.getNetworkedData(data); + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + tier = InductionProviderTier.values()[nbtTags.getInteger("tier")]; + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setInteger("tier", tier.ordinal()); + } } diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_US.lang index eb678ea44..bea7a2d87 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_US.lang @@ -83,6 +83,16 @@ tile.BasicBlock.SolarEvaporationValve.name=Solar Evaporation Valve //Basic Block 2 (second ID iteration) tile.BasicBlock2.SolarEvaporationBlock.name=Solar Evaporation Block +tile.BasicBlock2.InductionCasing.name=Induction Casing +tile.BasicBlock2.InductionPort.name=Induction Port +tile.BasicBlock2.InductionCellBasic.name=Basic Induction Cell +tile.BasicBlock2.InductionCellAdvanced.name=Advanced Induction Cell +tile.BasicBlock2.InductionCellElite.name=Elite Induction Cell +tile.BasicBlock2.InductionCellUltimate.name=Ultimate Induction Cell +tile.BasicBlock2.InductionProviderBasic.name=Basic Induction Provider +tile.BasicBlock2.InductionProviderAdvanced.name=Advanced Induction Provider +tile.BasicBlock2.InductionProviderElite.name=Elite Induction Provider +tile.BasicBlock2.InductionProviderUltimate.name=Ultimate Induction Provider //Machine Block tile.MachineBlock.EnrichmentChamber.name=Enrichment Chamber diff --git a/src/main/resources/assets/mekanism/textures/blocks/DynamicGlass.png b/src/main/resources/assets/mekanism/textures/blocks/DynamicGlass.png deleted file mode 100644 index 938ca1ee7..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/DynamicGlass.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/DynamicTank.png b/src/main/resources/assets/mekanism/textures/blocks/DynamicTank.png deleted file mode 100644 index ca24627d3..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/DynamicTank.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/DynamicValve.png b/src/main/resources/assets/mekanism/textures/blocks/DynamicValve.png deleted file mode 100644 index b053a882c..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/DynamicValve.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationController.png b/src/main/resources/assets/mekanism/textures/blocks/InductionCasing.png similarity index 72% rename from src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationController.png rename to src/main/resources/assets/mekanism/textures/blocks/InductionCasing.png index fe0d60a55..0c77c3352 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationController.png and b/src/main/resources/assets/mekanism/textures/blocks/InductionCasing.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionCellAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/InductionCellAdvanced.png new file mode 100644 index 000000000..b6f941b70 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionCellAdvanced.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionCellBasic.png b/src/main/resources/assets/mekanism/textures/blocks/InductionCellBasic.png new file mode 100644 index 000000000..276f98c14 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionCellBasic.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionCellElite.png b/src/main/resources/assets/mekanism/textures/blocks/InductionCellElite.png new file mode 100644 index 000000000..de8df433f Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionCellElite.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionCellUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/InductionCellUltimate.png new file mode 100644 index 000000000..b8dabeda9 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionCellUltimate.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png b/src/main/resources/assets/mekanism/textures/blocks/InductionPort.png similarity index 60% rename from src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png rename to src/main/resources/assets/mekanism/textures/blocks/InductionPort.png index c37aea836..3b92af14b 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png and b/src/main/resources/assets/mekanism/textures/blocks/InductionPort.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionProviderAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderAdvanced.png new file mode 100644 index 000000000..26e530be1 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderAdvanced.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionProviderBasic.png b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderBasic.png new file mode 100644 index 000000000..9f5581eb0 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderBasic.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionProviderElite.png b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderElite.png new file mode 100644 index 000000000..c393d338f Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderElite.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/InductionProviderUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderUltimate.png new file mode 100644 index 000000000..998d7ac71 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/InductionProviderUltimate.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOff.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOff.png deleted file mode 100644 index 2aa4295d1..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOff.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png deleted file mode 100644 index 21274e180..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorFrame.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorFrame.png deleted file mode 100644 index aa259c269..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorFrame.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorGlass.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorGlass.png deleted file mode 100644 index 5f1c34c34..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorGlass.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorLaserFocus.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorLaserFocus.png deleted file mode 100644 index 588343a8d..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorLaserFocus.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorPort.png b/src/main/resources/assets/mekanism/textures/blocks/ReactorPort.png deleted file mode 100644 index cc6294ea3..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/ReactorPort.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationBlock.png b/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationBlock.png deleted file mode 100644 index a878432cc..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationBlock.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png.mcmeta deleted file mode 100644 index efc331201..000000000 --- a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationControllerOn.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation": { - "frametime": 10 - } -} diff --git a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationValve.png b/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationValve.png deleted file mode 100644 index b4a22621a..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/SolarEvaporationValve.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing-ctm.png b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing-ctm.png new file mode 100644 index 000000000..186329393 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing-ctm.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing.png b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing.png new file mode 100644 index 000000000..0c77c3352 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionCasing.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort-ctm.png b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort-ctm.png new file mode 100644 index 000000000..a116eaedc Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort-ctm.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort.png b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort.png new file mode 100644 index 000000000..469a9faf2 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/ctm/InductionPort.png differ