mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
Refactored Basic Block to use enum-based block types instead of the messy way things were done before
Also: - Worked on preliminary boiler code and assets - Added tooltips to certain basic blocks Todo: move pressure disperser from generators to main module
This commit is contained in:
1 parent
2bea8ac29a
commit
269cd2b406
11 files changed
+242
-228
No files matched your search
@@ -34,6 +34,7 @@ import mekanism.common.tile.TileEntitySolarEvaporationBlock;
|
||||
import mekanism.common.tile.TileEntitySolarEvaporationController;
|
||||
import mekanism.common.tile.TileEntitySolarEvaporationValve;
|
||||
import mekanism.common.tile.TileEntityStructuralGlass;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -84,6 +85,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* 1:2: Induction Port
|
||||
* 1:3: Induction Cell
|
||||
* 1:4: Induction Provider
|
||||
* 1:5: Superheating Element
|
||||
* 1:6: Boiler Casing
|
||||
* 1:7: Boiler Valve
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@@ -196,6 +200,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
ctms[4][1] = new CTMData("ctm/InductionProviderAdvanced", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
|
||||
ctms[4][2] = new CTMData("ctm/InductionProviderElite", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
|
||||
ctms[4][3] = new CTMData("ctm/InductionProviderUltimate", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
|
||||
ctms[5][0] = new CTMData("ctm/SuperheatingElement", this, Arrays.asList(5)).registerIcons(register).setRenderConvexConnections();
|
||||
|
||||
icons[0][0] = ctms[0][0].mainTextureData.icon;
|
||||
icons[1][0] = ctms[1][0].mainTextureData.icon;
|
||||
@@ -209,6 +214,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
icons[4][1] = ctms[4][1].mainTextureData.icon;
|
||||
icons[4][2] = ctms[4][2].mainTextureData.icon;
|
||||
icons[4][3] = ctms[4][3].mainTextureData.icon;
|
||||
icons[5][0] = ctms[5][0].mainTextureData.icon;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -255,6 +261,8 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
case 4:
|
||||
TileEntityInductionProvider tileEntity2 = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
return icons[meta][tileEntity2.tier.ordinal()];
|
||||
case 5:
|
||||
return icons[meta][0];
|
||||
default:
|
||||
return getIcon(side, meta);
|
||||
}
|
||||
@@ -312,7 +320,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
|
||||
break;
|
||||
case BASIC_BLOCK_2:
|
||||
for(int i = 0; i < 5; i++)
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
if(i == 3)
|
||||
{
|
||||
@@ -735,37 +743,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
switch(blockType)
|
||||
{
|
||||
case BASIC_BLOCK_1:
|
||||
switch(metadata)
|
||||
{
|
||||
case 6:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 14:
|
||||
case 15:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case BASIC_BLOCK_2:
|
||||
switch(metadata)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
BasicType type = BasicType.get(blockType, metadata);
|
||||
|
||||
return type != null && type.tileEntityClass != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -785,45 +765,12 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
switch(blockType)
|
||||
if(BasicType.get(blockType, metadata) == null)
|
||||
{
|
||||
case BASIC_BLOCK_1:
|
||||
switch(metadata)
|
||||
{
|
||||
case 6:
|
||||
return new TileEntityBin();
|
||||
case 9:
|
||||
return new TileEntityDynamicTank();
|
||||
case 10:
|
||||
return new TileEntityStructuralGlass();
|
||||
case 11:
|
||||
return new TileEntityDynamicValve();
|
||||
case 14:
|
||||
return new TileEntitySolarEvaporationController();
|
||||
case 15:
|
||||
return new TileEntitySolarEvaporationValve();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
case BASIC_BLOCK_2:
|
||||
switch(metadata)
|
||||
{
|
||||
case 0:
|
||||
return new TileEntitySolarEvaporationBlock();
|
||||
case 1:
|
||||
return new TileEntityInductionCasing();
|
||||
case 2:
|
||||
return new TileEntityInductionPort();
|
||||
case 3:
|
||||
return new TileEntityInductionCell();
|
||||
case 4:
|
||||
return new TileEntityInductionProvider();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
return BasicType.get(blockType, metadata).create();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1065,10 +1012,116 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum BasicType
|
||||
{
|
||||
OSMIUM_BLOCK(BasicBlock.BASIC_BLOCK_1, 0, "OsmiumBlock", null, false),
|
||||
BRONZE_BLOCK(BasicBlock.BASIC_BLOCK_1, 1, "BronzeBlock", null, false),
|
||||
REFINED_OBSIDIAN(BasicBlock.BASIC_BLOCK_1, 2, "RefinedObsidian", null, false),
|
||||
CHARCOAL_BLOCK(BasicBlock.BASIC_BLOCK_1, 3, "CharcoalBlock", null, false),
|
||||
REFINED_GLOWSTONE(BasicBlock.BASIC_BLOCK_1, 4, "RefinedGlowstone", null, false),
|
||||
STEEL_BLOCK(BasicBlock.BASIC_BLOCK_1, 5, "SteelBlock", null, false),
|
||||
BIN(BasicBlock.BASIC_BLOCK_1, 6, "Bin", TileEntityBin.class, true),
|
||||
TELEPORTER_FRAME(BasicBlock.BASIC_BLOCK_1, 7, "TeleporterFrame", null, true),
|
||||
STEEL_CASING(BasicBlock.BASIC_BLOCK_1, 8, "SteelCasing", null, true),
|
||||
DYNAMIC_TANK(BasicBlock.BASIC_BLOCK_1, 9, "DynamicTank", TileEntityDynamicTank.class, true),
|
||||
STRUCTURAL_GLASS(BasicBlock.BASIC_BLOCK_1, 10, "StructuralGlass", TileEntityStructuralGlass.class, true),
|
||||
DYNAMIC_VALVE(BasicBlock.BASIC_BLOCK_1, 11, "DynamicValve", TileEntityDynamicValve.class, true),
|
||||
COPPER_BLOCK(BasicBlock.BASIC_BLOCK_1, 12, "CopperBlock", null, false),
|
||||
TIN_BLOCK(BasicBlock.BASIC_BLOCK_1, 13, "TinBlock", null, false),
|
||||
SOLAR_EVAPORATION_CONTROLLER(BasicBlock.BASIC_BLOCK_1, 14, "SolarEvaporationController", TileEntitySolarEvaporationController.class, true),
|
||||
SOLAR_EVAPORATION_VALVE(BasicBlock.BASIC_BLOCK_1, 15, "SolarEvaporationValve", TileEntitySolarEvaporationValve.class, true),
|
||||
SOLAR_EVAPORATION_BLOCK(BasicBlock.BASIC_BLOCK_2, 0, "SolarEvaporationBlock", TileEntitySolarEvaporationBlock.class, true),
|
||||
INDUCTION_CASING(BasicBlock.BASIC_BLOCK_2, 1, "InductionCasing", TileEntityInductionCasing.class, true),
|
||||
INDUCTION_PORT(BasicBlock.BASIC_BLOCK_2, 2, "InductionPort", TileEntityInductionPort.class, true),
|
||||
INDUCTION_CELL(BasicBlock.BASIC_BLOCK_2, 3, "InductionCell", TileEntityInductionCell.class, true),
|
||||
INDUCTION_PROVIDER(BasicBlock.BASIC_BLOCK_2, 4, "InductionProvider", TileEntityInductionProvider.class, true),
|
||||
SUPERHEATING_ELEMENT(BasicBlock.BASIC_BLOCK_2, 5, "SuperheatingElement", null, true);
|
||||
//BOILER_CASING(BasicBlock.BASIC_BLOCK_2, 6, "BoilerCasing", TileEntityBoilerCasing.class, true),
|
||||
//BOILER_VALVE(BasicBlock.BASIC_BLOCK_2, 7, "BoilerValve", TileEntityBoilerValve.class, true);
|
||||
|
||||
public BasicBlock typeBlock;
|
||||
public int meta;
|
||||
public String name;
|
||||
public Class<? extends TileEntity> tileEntityClass;
|
||||
public boolean isElectric;
|
||||
public boolean hasDescription;
|
||||
|
||||
private BasicType(BasicBlock block, int i, String s, Class<? extends TileEntity> tileClass, boolean hasDesc)
|
||||
{
|
||||
typeBlock = block;
|
||||
meta = i;
|
||||
name = s;
|
||||
tileEntityClass = tileClass;
|
||||
hasDescription = hasDesc;
|
||||
}
|
||||
|
||||
public static BasicType get(Block block, int meta)
|
||||
{
|
||||
if(block instanceof BlockBasic)
|
||||
{
|
||||
return get(((BlockBasic)block).blockType, meta);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BasicType get(BasicBlock block, int meta)
|
||||
{
|
||||
for(BasicType type : values())
|
||||
{
|
||||
if(type.meta == meta && type.typeBlock == block)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TileEntity create()
|
||||
{
|
||||
try {
|
||||
return tileEntityClass.newInstance();
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Unable to indirectly create tile entity.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return LangUtils.localize("tooltip." + name);
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return new ItemStack(typeBlock.getBlock(), 1, meta);
|
||||
}
|
||||
|
||||
public static BasicType get(ItemStack stack)
|
||||
{
|
||||
return get(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BasicBlock
|
||||
{
|
||||
BASIC_BLOCK_1,
|
||||
BASIC_BLOCK_2;
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BASIC_BLOCK_1:
|
||||
return MekanismBlocks.BasicBlock;
|
||||
case BASIC_BLOCK_2:
|
||||
return MekanismBlocks.BasicBlock2;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
package mekanism.common.content.boiler;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.content.tank.SynchronizedTankData;
|
||||
import mekanism.common.multiblock.MultiblockCache;
|
||||
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BoilerCache extends MultiblockCache<SynchronizedBoilerData>
|
||||
{
|
||||
public ItemStack[] inventory = new ItemStack[2];
|
||||
|
||||
@@ -8,11 +8,14 @@ import mekanism.api.EnumColor;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
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.block.BlockBasic.BasicType;
|
||||
import mekanism.common.inventory.InventoryBin;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityBin;
|
||||
@@ -22,6 +25,7 @@ import mekanism.common.tile.TileEntityMultiblock;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -55,6 +59,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* 1:2: Induction Port
|
||||
* 1:3: Induction Cell
|
||||
* 1:4: Induction Provider
|
||||
* 1:5: Superheating Element
|
||||
* 1:6: Boiler Casing
|
||||
* 1:7: Boiler Valve
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@@ -130,56 +137,63 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock && itemstack.getItemDamage() == 6)
|
||||
BasicType type = BasicType.get(itemstack);
|
||||
|
||||
if(type.hasDescription)
|
||||
{
|
||||
InventoryBin inv = new InventoryBin(itemstack);
|
||||
|
||||
if(inv.getItemCount() > 0)
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + inv.getItemType().getDisplayName());
|
||||
list.add(EnumColor.INDIGO + "Item amount: " + EnumColor.GREY + inv.getItemCount());
|
||||
if(type == BasicType.BIN)
|
||||
{
|
||||
InventoryBin inv = new InventoryBin(itemstack);
|
||||
|
||||
if(inv.getItemCount() > 0)
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + inv.getItemType().getDisplayName());
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.itemAmount") + ": " + EnumColor.GREY + inv.getItemCount());
|
||||
}
|
||||
else {
|
||||
list.add(EnumColor.DARK_RED + LangUtils.localize("gui.empty"));
|
||||
}
|
||||
}
|
||||
else if(type == BasicType.INDUCTION_CELL)
|
||||
{
|
||||
InductionCellTier tier = InductionCellTier.values()[getTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.maxEnergy));
|
||||
}
|
||||
else if(type == BasicType.INDUCTION_PROVIDER)
|
||||
{
|
||||
InductionProviderTier tier = InductionProviderTier.values()[getTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.outputRate") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.output));
|
||||
}
|
||||
|
||||
if(getMaxEnergy(itemstack) > 0)
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
|
||||
list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.INDIGO + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDetails") + ".");
|
||||
}
|
||||
else {
|
||||
list.add(EnumColor.DARK_RED + "Empty");
|
||||
list.addAll(MekanismUtils.splitTooltip(type.getDescription(), itemstack));
|
||||
}
|
||||
}
|
||||
else if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2)
|
||||
{
|
||||
if(itemstack.getItemDamage() == 3)
|
||||
{
|
||||
InductionCellTier tier = InductionCellTier.values()[getTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.maxEnergy));
|
||||
}
|
||||
else if(itemstack.getItemDamage() == 4)
|
||||
{
|
||||
InductionProviderTier tier = InductionProviderTier.values()[getTier(itemstack).ordinal()];
|
||||
|
||||
list.add(tier.getBaseTier().getColor() + LangUtils.localize("tooltip.outputRate") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.output));
|
||||
}
|
||||
}
|
||||
|
||||
if(getMaxEnergy(itemstack) > 0)
|
||||
{
|
||||
list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage() == 6 && stack.stackTagCompound != null && stack.stackTagCompound.hasKey("newCount");
|
||||
return BasicType.get(stack) == BasicType.BIN && stack.stackTagCompound != null && stack.stackTagCompound.hasKey("newCount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock)
|
||||
if(BasicType.get(stack) != BasicType.BIN)
|
||||
{
|
||||
if(stack.getItemDamage() != 6)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if(stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("newCount"))
|
||||
@@ -193,9 +207,9 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock)
|
||||
if(BasicType.get(stack) == BasicType.BIN)
|
||||
{
|
||||
if(stack.getItemDamage() != 6 || stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("newCount"))
|
||||
if(stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("newCount"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -216,42 +230,38 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
|
||||
if(place)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock)
|
||||
BasicType type = BasicType.get(stack);
|
||||
|
||||
if(type == BasicType.BIN && stack.stackTagCompound != null)
|
||||
{
|
||||
if(stack.getItemDamage() == 6 && stack.stackTagCompound != null)
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
InventoryBin inv = new InventoryBin(stack);
|
||||
|
||||
if(inv.getItemType() != null)
|
||||
{
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
InventoryBin inv = new InventoryBin(stack);
|
||||
tileEntity.setItemType(inv.getItemType());
|
||||
}
|
||||
|
||||
if(inv.getItemType() != null)
|
||||
{
|
||||
tileEntity.setItemType(inv.getItemType());
|
||||
}
|
||||
|
||||
tileEntity.setItemCount(inv.getItemCount());
|
||||
tileEntity.setItemCount(inv.getItemCount());
|
||||
}
|
||||
else if(type == BasicType.INDUCTION_CELL)
|
||||
{
|
||||
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(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2)
|
||||
else if(type == BasicType.INDUCTION_PROVIDER)
|
||||
{
|
||||
if(stack.getItemDamage() == 3)
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
tileEntity.tier = InductionProviderTier.values()[getTier(stack).ordinal()];
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
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)));
|
||||
}
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,98 +275,35 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
|
||||
return place;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock)
|
||||
if(BasicType.get(itemstack) != null)
|
||||
{
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "OsmiumBlock";
|
||||
break;
|
||||
case 1:
|
||||
name = "BronzeBlock";
|
||||
break;
|
||||
case 2:
|
||||
name = "RefinedObsidian";
|
||||
break;
|
||||
case 3:
|
||||
name = "CharcoalBlock";
|
||||
break;
|
||||
case 4:
|
||||
name = "RefinedGlowstone";
|
||||
break;
|
||||
case 5:
|
||||
name = "SteelBlock";
|
||||
break;
|
||||
case 6:
|
||||
name = "Bin";
|
||||
break;
|
||||
case 7:
|
||||
name = "TeleporterFrame";
|
||||
break;
|
||||
case 8:
|
||||
name = "SteelCasing";
|
||||
break;
|
||||
case 9:
|
||||
name = "DynamicTank";
|
||||
break;
|
||||
case 10:
|
||||
name = "StructuralGlass";
|
||||
break;
|
||||
case 11:
|
||||
name = "DynamicValve";
|
||||
break;
|
||||
case 12:
|
||||
name = "CopperBlock";
|
||||
break;
|
||||
case 13:
|
||||
name = "TinBlock";
|
||||
break;
|
||||
case 14:
|
||||
name = "SolarEvaporationController";
|
||||
break;
|
||||
case 15:
|
||||
name = "SolarEvaporationValve";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2)
|
||||
{
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
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;
|
||||
}
|
||||
return getUnlocalizedName() + "." + BasicType.get(itemstack).name;
|
||||
}
|
||||
|
||||
return getUnlocalizedName() + "." + name;
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack)
|
||||
{
|
||||
BasicType type = BasicType.get(itemstack);
|
||||
|
||||
if(type == BasicType.INDUCTION_CELL || type == BasicType.INDUCTION_PROVIDER)
|
||||
{
|
||||
return getTier(itemstack).getLocalizedName() + " " + super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
|
||||
return super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergy(ItemStack itemStack)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2 && itemStack.getItemDamage() == 3)
|
||||
if(BasicType.get(itemStack) == BasicType.INDUCTION_CELL)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
@@ -372,7 +319,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
@Override
|
||||
public void setEnergy(ItemStack itemStack, double amount)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2 && itemStack.getItemDamage() == 3)
|
||||
if(BasicType.get(itemStack) == BasicType.INDUCTION_CELL)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
@@ -386,7 +333,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
@Override
|
||||
public double getMaxEnergy(ItemStack itemStack)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2 && itemStack.getItemDamage() == 3)
|
||||
if(BasicType.get(itemStack) == BasicType.INDUCTION_CELL)
|
||||
{
|
||||
return InductionCellTier.values()[getTier(itemStack).ordinal()].maxEnergy;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class TileEntityInductionCasing extends TileEntityMultiblock<Synchronized
|
||||
return structure != null ? structure.getEnergy(worldObj) : 0;
|
||||
}
|
||||
else {
|
||||
return structure.clientEnergy;
|
||||
return structure != null ? structure.clientEnergy : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package mekanism.generators.common.tile.turbine;
|
||||
package mekanism.common.tile;
|
||||
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
|
||||
public class TileEntityPressureDisperser extends TileEntityBasicBlock
|
||||
{
|
||||
@@ -5,6 +5,7 @@ import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IGuiProvider;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.TileEntityPressureDisperser;
|
||||
import mekanism.generators.common.inventory.container.ContainerBioGenerator;
|
||||
import mekanism.generators.common.inventory.container.ContainerGasGenerator;
|
||||
import mekanism.generators.common.inventory.container.ContainerHeatGenerator;
|
||||
@@ -26,7 +27,6 @@ import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityPressureDisperser;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
|
||||
|
||||
@@ -20,6 +20,7 @@ import mekanism.common.multiblock.IMultiblock;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.tile.TileEntityPressureDisperser;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.common.GeneratorsBlocks;
|
||||
@@ -32,7 +33,6 @@ import mekanism.generators.common.tile.TileEntityHeatGenerator;
|
||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
||||
import mekanism.generators.common.tile.TileEntityWindGenerator;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityPressureDisperser;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
|
||||
|
||||
@@ -9,11 +9,11 @@ import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.multiblock.MultiblockCache;
|
||||
import mekanism.common.multiblock.MultiblockManager;
|
||||
import mekanism.common.multiblock.UpdateProtocol;
|
||||
import mekanism.common.tile.TileEntityPressureDisperser;
|
||||
import mekanism.generators.common.GeneratorsBlocks;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.block.BlockGenerator.GeneratorType;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityPressureDisperser;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
|
||||
|
||||
Reference in new issue
Block a user