Energized Induction Matrix work!

This commit is contained in:
Aidan C. Brady 2015-03-02 23:05:54 -05:00
parent 63706900ba
commit 1c0fe96fed
40 changed files with 485 additions and 52 deletions

View file

@ -142,6 +142,10 @@ import mekanism.common.tile.TileEntityEntangledBlock;
import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityGasTank; 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.TileEntityLaser;
import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLaserAmplifier;
import mekanism.common.tile.TileEntityLaserTractorBeam; import mekanism.common.tile.TileEntityLaserTractorBeam;
@ -321,6 +325,10 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam", new RenderLaserTractorBeam()); ClientRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam", new RenderLaserTractorBeam());
ClientRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator", new RenderSolarNeutronActivator()); ClientRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator", new RenderSolarNeutronActivator());
GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator"); 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 @Override
@ -347,6 +355,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.GasTank), handler); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.GasTank), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), handler); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.BasicBlock), handler); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.BasicBlock), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), handler);
MinecraftForgeClient.registerItemRenderer(MekanismItems.Jetpack, handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.Jetpack, handler);
MinecraftForgeClient.registerItemRenderer(MekanismItems.ArmoredJetpack, handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.ArmoredJetpack, handler);
MinecraftForgeClient.registerItemRenderer(MekanismItems.PartTransmitter, handler); MinecraftForgeClient.registerItemRenderer(MekanismItems.PartTransmitter, handler);

View file

@ -357,14 +357,7 @@ public class MekanismRenderer
GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL12.GL_RESCALE_NORMAL);
} }
/** public static void prepareItemRender(RenderBlocks renderer, int metadata, Block block)
* 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)) if(!(block instanceof ISpecialBounds) || ((ISpecialBounds)block).doDefaultBoundSetting(metadata))
{ {
@ -394,6 +387,59 @@ public class MekanismRenderer
} }
GL11.glTranslatef(-0.5F, -0.5F, -0.5F); 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 { try {
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
@ -527,4 +573,9 @@ public class MekanismRenderer
{ {
return TextureMap.locationItemsTexture; return TextureMap.locationItemsTexture;
} }
public static interface ICustomBlockIcon
{
public IIcon getIcon(ItemStack stack, int side);
}
} }

View file

@ -46,7 +46,6 @@ import mekanism.common.tile.TileEntityBin;
import mekanism.common.tile.TileEntityPortableTank; import mekanism.common.tile.TileEntityPortableTank;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
@ -65,11 +64,12 @@ import net.minecraft.src.FMLRenderAccessLibrary;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ItemRenderingHandler implements IItemRenderer public class ItemRenderingHandler implements IItemRenderer
{ {
@ -162,7 +162,15 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else if(item.getItem() instanceof ItemBlockBasic && item.getItemDamage() == 6) else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock2 && item.getItemDamage() == 3)
{
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); FMLRenderAccessLibrary.renderInventoryBlock((RenderBlocks)data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID);

View file

@ -77,7 +77,9 @@ import mekanism.common.tile.TileEntityEnrichmentChamber;
import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityGasTank; import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.tile.TileEntityInductionCasing;
import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionPort;
import mekanism.common.tile.TileEntityInductionProvider; import mekanism.common.tile.TileEntityInductionProvider;
import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaser;
import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLaserAmplifier;
@ -163,6 +165,8 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam"); GameRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam");
GameRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator"); GameRegistry.registerTileEntity(TileEntitySolarNeutronActivator.class, "SolarNeutronActivator");
GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator"); GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator");
GameRegistry.registerTileEntity(TileEntityInductionCasing.class, "InductionCasing");
GameRegistry.registerTileEntity(TileEntityInductionPort.class, "InductionPort");
GameRegistry.registerTileEntity(TileEntityInductionCell.class, "InductionCell"); GameRegistry.registerTileEntity(TileEntityInductionCell.class, "InductionCell");
GameRegistry.registerTileEntity(TileEntityInductionProvider.class, "InductionProvider"); GameRegistry.registerTileEntity(TileEntityInductionProvider.class, "InductionProvider");
} }

View file

@ -8,27 +8,31 @@ import java.util.Random;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.Range4D; import mekanism.api.Range4D;
import mekanism.client.ClientProxy; import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
import mekanism.common.CTMData; import mekanism.common.CTMData;
import mekanism.common.ItemAttacher; import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks; import mekanism.common.MekanismBlocks;
import mekanism.common.Tier.BaseTier;
import mekanism.common.base.IActiveState; import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM; import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock; import mekanism.common.base.IBoundingBlock;
import mekanism.common.content.tank.TankUpdateProtocol; import mekanism.common.content.tank.TankUpdateProtocol;
import mekanism.common.inventory.InventoryBin; import mekanism.common.inventory.InventoryBin;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityBin;
import mekanism.common.tile.TileEntityBoiler;
import mekanism.common.tile.TileEntityBoilerValve;
import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityDynamicTank;
import mekanism.common.tile.TileEntityDynamicValve; 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.TileEntitySolarEvaporationBlock;
import mekanism.common.tile.TileEntitySolarEvaporationController; import mekanism.common.tile.TileEntitySolarEvaporationController;
import mekanism.common.tile.TileEntitySolarEvaporationValve; import mekanism.common.tile.TileEntitySolarEvaporationValve;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -73,12 +77,14 @@ import cpw.mods.fml.relauncher.SideOnly;
* 0:14: Solar Evaporation Controller * 0:14: Solar Evaporation Controller
* 0:15: Solar Evaporation Valve * 0:15: Solar Evaporation Valve
* 1:0: Solar Evaporation Block * 1:0: Solar Evaporation Block
* 1:1: Steam Boiler * 1:1: Induction Casing
* 1:2: Boiler Valve * 1:2: Induction Port
* 1:3: Induction Cell
* 1:4: Induction Provider
* @author AidanBrady * @author AidanBrady
* *
*/ */
public class BlockBasic extends Block implements IBlockCTM public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{ {
public IIcon[][] icons = new IIcon[16][6]; public IIcon[][] icons = new IIcon[16][6];
@ -95,6 +101,21 @@ public class BlockBasic extends Block implements IBlockCTM
blockType = type; 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 @Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) 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; break;
case BASIC_BLOCK_2: 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[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[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[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[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[1][0] = ctms[1][0].mainTextureData.icon;
icons[2][0] = ctms[2][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; break;
} }
} }
@ -176,16 +209,17 @@ public class BlockBasic extends Block implements IBlockCTM
switch(meta) switch(meta)
{ {
case 6: case 6:
TileEntityBasicBlock tileEntity6 = (TileEntityBasicBlock)world.getTileEntity(x, y, z); TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
if(side == 0 || side == 1) if(side == 0 || side == 1)
{ {
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][3] : icons[meta][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]; return MekanismUtils.isActive(world, x, y, z) ? icons[meta][4] : icons[meta][2];
} else }
{ else {
return icons[meta][0]; return icons[meta][0];
} }
case 9: case 9:
@ -193,13 +227,13 @@ public class BlockBasic extends Block implements IBlockCTM
case 11: case 11:
return ctms[meta][0].getIcon(side); return ctms[meta][0].getIcon(side);
case 14: 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]; return MekanismUtils.isActive(world, x, y, z) ? icons[meta][1] : icons[meta][0];
} else }
{ else {
return icons[meta][2]; return icons[meta][2];
} }
default: default:
@ -208,6 +242,12 @@ public class BlockBasic extends Block implements IBlockCTM
case BASIC_BLOCK_2: case BASIC_BLOCK_2:
switch(meta) 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: default:
return getIcon(side, meta); return getIcon(side, meta);
} }
@ -229,19 +269,20 @@ public class BlockBasic extends Block implements IBlockCTM
if(side == 0 || side == 1) if(side == 0 || side == 1)
{ {
return icons[meta][1]; return icons[meta][1];
} else if(side == 3) }
else if(side == 3)
{ {
return icons[meta][2]; return icons[meta][2];
} else }
{ else {
return icons[meta][0]; return icons[meta][0];
} }
case 14: case 14:
if(side == 3) if(side == 3)
{ {
return icons[meta][0]; return icons[meta][0];
} else }
{ else {
return icons[meta][2]; return icons[meta][2];
} }
default: default:
@ -273,10 +314,37 @@ public class BlockBasic extends Block implements IBlockCTM
} }
break; break;
case BASIC_BLOCK_2: case BASIC_BLOCK_2:
for(int i = 0; i < 3; i++) for(int i = 0; i < 5; 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)); list.add(new ItemStack(item, 1, i));
} }
}
break; break;
} }
} }
@ -304,17 +372,43 @@ public class BlockBasic extends Block implements IBlockCTM
{ {
return false; return false;
} }
} else }
{ else {
if(tileEntity.clientHasStructure) if(tileEntity.clientHasStructure)
{ {
return false; return false;
} }
} }
} }
default:
return super.canCreatureSpawn(type, world, x, y, z);
} }
case BASIC_BLOCK_2: case BASIC_BLOCK_2:
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); return super.canCreatureSpawn(type, world, x, y, z);
}
default: default:
return super.canCreatureSpawn(type, world, x, y, z); return super.canCreatureSpawn(type, world, x, y, z);
} }
@ -652,6 +746,8 @@ public class BlockBasic extends Block implements IBlockCTM
case 0: case 0:
case 1: case 1:
case 2: case 2:
case 3:
case 4:
return true; return true;
default: default:
return false; return false;
@ -690,9 +786,13 @@ public class BlockBasic extends Block implements IBlockCTM
case 0: case 0:
return new TileEntitySolarEvaporationBlock(); return new TileEntitySolarEvaporationBlock();
case 1: case 1:
return new TileEntityBoiler(); return new TileEntityInductionCasing();
case 2: case 2:
return new TileEntityBoilerValve(); return new TileEntityInductionPort();
case 3:
return new TileEntityInductionCell();
case 4:
return new TileEntityInductionProvider();
default: default:
return null; 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; 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) 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()); Coord4D obj = new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side).getOpposite());
if(blockType == BasicBlock.BASIC_BLOCK_1 && obj.getMetadata(world) == 10) if(blockType == BasicBlock.BASIC_BLOCK_1 && obj.getMetadata(world) == 10)
{ {
return ctms[10][0].shouldRenderSide(world, x, y, z, side); return ctms[10][0].shouldRenderSide(world, x, y, z, side);
@ -860,6 +974,7 @@ public class BlockBasic extends Block implements IBlockCTM
} }
} }
} }
return valid; return valid;
} }

View file

@ -48,6 +48,8 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
* 0: Basic Energy Cube * 0: Basic Energy Cube
* 1: Advanced Energy Cube * 1: Advanced Energy Cube
* 2: Elite Energy Cube * 2: Elite Energy Cube
* 3: Ultimate Energy Cube
* 4: Creative Energy Cube
* @author AidanBrady * @author AidanBrady
* *
*/ */

View file

@ -1,5 +1,48 @@
package mekanism.common.content.matrix; 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<SynchronizedMatrixData>
{
public MatrixUpdateProtocol(TileEntityMultiblock<SynchronizedMatrixData> 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<SynchronizedMatrixData> getManager()
{
return Mekanism.matrixManager;
}
@Override
protected void mergeCaches(List<ItemStack> rejectedItems, MultiblockCache<SynchronizedMatrixData> cache, MultiblockCache<SynchronizedMatrixData> merge)
{
} }
}

View file

@ -1,16 +1,26 @@
package mekanism.common.item; package mekanism.common.item;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.api.Range4D;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks; 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.inventory.InventoryBin;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityBin;
import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionProvider;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -35,6 +45,10 @@ import cpw.mods.fml.relauncher.SideOnly;
* 0:14: Solar Evaporation Controller * 0:14: Solar Evaporation Controller
* 0:15: Solar Evaporation Valve * 0:15: Solar Evaporation Valve
* 1:0: Solar Evaporation Block * 1:0: Solar Evaporation Block
* 1:1: Induction Casing
* 1:2: Induction Port
* 1:3: Induction Cell
* 1:4: Induction Provider
* @author AidanBrady * @author AidanBrady
* *
*/ */
@ -49,6 +63,26 @@ public class ItemBlockBasic extends ItemBlock
setHasSubtypes(true); 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 @Override
public int getItemStackLimit(ItemStack stack) public int getItemStackLimit(ItemStack stack)
{ {
@ -158,6 +192,29 @@ public class ItemBlockBasic extends ItemBlock
tileEntity.setItemCount(inv.getItemCount()); 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; return place;
@ -232,6 +289,18 @@ public class ItemBlockBasic extends ItemBlock
case 0: case 0:
name = "SolarEvaporationBlock"; name = "SolarEvaporationBlock";
break; 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;
} }
} }

View file

@ -35,7 +35,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
public TileEntityDynamicTank() public TileEntityDynamicTank()
{ {
this("DynamicTank"); super("DynamicTank");
} }
public TileEntityDynamicTank(String name) public TileEntityDynamicTank(String name)

View file

@ -0,0 +1,37 @@
package mekanism.common.tile;
import mekanism.common.Mekanism;
import mekanism.common.content.matrix.MatrixUpdateProtocol;
import mekanism.common.content.matrix.SynchronizedMatrixData;
import mekanism.common.multiblock.MultiblockManager;
public class TileEntityInductionCasing extends TileEntityMultiblock<SynchronizedMatrixData>
{
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<SynchronizedMatrixData> getManager()
{
return Mekanism.matrixManager;
}
}

View file

@ -1,6 +1,12 @@
package mekanism.common.tile; package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import mekanism.common.Tier.InductionCellTier; import mekanism.common.Tier.InductionCellTier;
import mekanism.common.util.MekanismUtils;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityInductionCell extends TileEntityBasicBlock public class TileEntityInductionCell extends TileEntityBasicBlock
{ {
@ -14,4 +20,40 @@ public class TileEntityInductionCell extends TileEntityBasicBlock
{ {
return false; 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());
}
} }

View file

@ -0,0 +1,6 @@
package mekanism.common.tile;
public class TileEntityInductionPort extends TileEntityInductionCasing
{
}

View file

@ -1,6 +1,12 @@
package mekanism.common.tile; package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import mekanism.common.Tier.InductionProviderTier; import mekanism.common.Tier.InductionProviderTier;
import mekanism.common.util.MekanismUtils;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityInductionProvider extends TileEntityBasicBlock public class TileEntityInductionProvider extends TileEntityBasicBlock
{ {
@ -14,4 +20,40 @@ public class TileEntityInductionProvider extends TileEntityBasicBlock
{ {
return false; 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());
}
} }

View file

@ -83,6 +83,16 @@ tile.BasicBlock.SolarEvaporationValve.name=Solar Evaporation Valve
//Basic Block 2 (second ID iteration) //Basic Block 2 (second ID iteration)
tile.BasicBlock2.SolarEvaporationBlock.name=Solar Evaporation Block 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 //Machine Block
tile.MachineBlock.EnrichmentChamber.name=Enrichment Chamber tile.MachineBlock.EnrichmentChamber.name=Enrichment Chamber

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,5 +0,0 @@
{
"animation": {
"frametime": 10
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB