mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Gas Tank and Fluid Tank state management & renders, along with tier colors. I'm getting the hang of this!
This commit is contained in:
1 parent
4ecde79334
commit
b3b714cd36
28 files changed
+188
-162
No files matched your search
@@ -40,7 +40,7 @@ public class RenderEnergyCube extends TileEntitySpecialRenderer<TileEntityEnergy
|
||||
{
|
||||
for(EnergyCubeTier tier : EnergyCubeTier.values())
|
||||
{
|
||||
resources.put(tier, MekanismUtils.getResource(ResourceType.RENDER, "EnergyCube" + tier.getBaseTier().getName() + ".png"));
|
||||
resources.put(tier, MekanismUtils.getResource(ResourceType.RENDER, "EnergyCube" + tier.getBaseTier().getSimpleName() + ".png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class RenderGasTank extends TileEntitySpecialRenderer<TileEntityGasTank>
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "GasTank" + tileEntity.tier.getBaseTier().getName() + ".png"));
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "GasTank" + tileEntity.tier.getBaseTier().getSimpleName() + ".png"));
|
||||
|
||||
switch(tileEntity.facing.ordinal()) /*TODO: switch the enum*/
|
||||
{
|
||||
|
||||
@@ -119,7 +119,8 @@ public class MekanismBlocks
|
||||
|
||||
for(MachineType type : MachineType.values())
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.typeBlock.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(), (type.hasActiveTexture() ? "active=false," : "") + "facing=north"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.typeBlock.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(),
|
||||
(type.hasActiveTexture() ? "active=false," : "") + (type.hasRotations() ? "facing=north" : "")));
|
||||
}
|
||||
|
||||
for(BasicBlockType type : BasicBlockType.values())
|
||||
@@ -142,11 +143,6 @@ public class MekanismBlocks
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.OreBlock), ore.ordinal(), new ModelResourceLocation("mekanism:OreBlock", "type=" + ore.getName()));
|
||||
}
|
||||
|
||||
for(GasTankTier tier : GasTankTier.values())
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GasTank), tier.ordinal(), new ModelResourceLocation("mekanism:GasTank", "inventory")); //TODO tier states
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.EnergyCube), new ItemMeshDefinition() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
@@ -157,5 +153,16 @@ public class MekanismBlocks
|
||||
return new ModelResourceLocation(baseLocation, "facing=north,tier="+tier);
|
||||
}
|
||||
});
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.GasTank), new ItemMeshDefinition() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
GasTankTier tier = GasTankTier.values()[((ItemBlockGasTank)stack.getItem()).getBaseTier(stack).ordinal()];
|
||||
ResourceLocation baseLocation = new ResourceLocation("mekanism", "GasTank");
|
||||
|
||||
return new ModelResourceLocation(baseLocation, "facing=north,tier="+tier);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.multipart.TransmitterType;
|
||||
import mekanism.common.util.LangUtils;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -26,7 +25,7 @@ public final class Tier
|
||||
/** The default tiers used in Mekanism.
|
||||
* @author aidancbrady
|
||||
*/
|
||||
public static enum BaseTier
|
||||
public static enum BaseTier implements IStringSerializable
|
||||
{
|
||||
BASIC("Basic", EnumColor.BRIGHT_GREEN),
|
||||
ADVANCED("Advanced", EnumColor.DARK_RED),
|
||||
@@ -34,14 +33,14 @@ public final class Tier
|
||||
ULTIMATE("Ultimate", EnumColor.PURPLE),
|
||||
CREATIVE("Creative", EnumColor.BLACK);
|
||||
|
||||
public String getName()
|
||||
public String getSimpleName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LangUtils.localize("tier." + getName());
|
||||
return LangUtils.localize("tier." + getSimpleName());
|
||||
}
|
||||
|
||||
public EnumColor getColor()
|
||||
@@ -62,6 +61,12 @@ public final class Tier
|
||||
name = s;
|
||||
color = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
public static enum EnergyCubeTier implements ITier, IStringSerializable
|
||||
@@ -88,7 +93,7 @@ public final class Tier
|
||||
{
|
||||
for(EnergyCubeTier tier : values())
|
||||
{
|
||||
if(tierName.contains(tier.getBaseTier().getName()))
|
||||
if(tierName.contains(tier.getBaseTier().getSimpleName()))
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
@@ -102,8 +107,8 @@ public final class Tier
|
||||
{
|
||||
if(this != CREATIVE)
|
||||
{
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeMaxEnergy", baseMaxEnergy).getDouble();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeOutput", baseOutput).getDouble();
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "EnergyCubeMaxEnergy", baseMaxEnergy).getDouble();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "EnergyCubeOutput", baseOutput).getDouble();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +169,7 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionCellMaxEnergy", baseMaxEnergy).getDouble();
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "InductionCellMaxEnergy", baseMaxEnergy).getDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,7 +209,7 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionProviderOutput", baseOutput).getDouble();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "InductionProviderOutput", baseOutput).getDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,7 +238,7 @@ public final class Tier
|
||||
{
|
||||
for(FactoryTier tier : values())
|
||||
{
|
||||
if(tierName.contains(tier.getBaseTier().getName()))
|
||||
if(tierName.contains(tier.getBaseTier().getSimpleName()))
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
@@ -283,7 +288,7 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
cableCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "CableCapacity", baseCapacity).getInt();
|
||||
cableCapacity = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "CableCapacity", baseCapacity).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,8 +349,8 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
pipeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipeCapacity", baseCapacity).getInt();
|
||||
pipePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipePullAmount", basePull).getInt();
|
||||
pipeCapacity = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "PipeCapacity", baseCapacity).getInt();
|
||||
pipePullAmount = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "PipePullAmount", basePull).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -408,8 +413,8 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
tubeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubeCapacity", baseCapacity).getInt();
|
||||
tubePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubePullAmount", basePull).getInt();
|
||||
tubeCapacity = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "TubeCapacity", baseCapacity).getInt();
|
||||
tubePullAmount = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "TubePullAmount", basePull).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -472,8 +477,8 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
pullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterPullAmount", basePull).getInt();
|
||||
speed = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterSpeed", baseSpeed).getInt();
|
||||
pullAmount = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "TransporterPullAmount", basePull).getInt();
|
||||
speed = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "TransporterSpeed", baseSpeed).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -544,9 +549,9 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
inverseConduction = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorInverseConduction", baseConduction).getDouble();
|
||||
inverseHeatCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorHeatCapacity", baseHeatCapacity).getDouble();
|
||||
inverseConductionInsulation = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorConductionInsulation", baseConductionInsulation).getDouble();
|
||||
inverseConduction = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "ConductorInverseConduction", baseConduction).getDouble();
|
||||
inverseHeatCapacity = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "ConductorHeatCapacity", baseHeatCapacity).getDouble();
|
||||
inverseConductionInsulation = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "ConductorConductionInsulation", baseConductionInsulation).getDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -607,8 +612,8 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "FluidTankStorage", baseStorage).getInt();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "FluidTankOutput", baseOutput).getInt();
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "FluidTankStorage", baseStorage).getInt();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "FluidTankOutput", baseOutput).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -626,7 +631,7 @@ public final class Tier
|
||||
}
|
||||
}
|
||||
|
||||
public static enum GasTankTier implements ITier
|
||||
public static enum GasTankTier implements ITier, IStringSerializable
|
||||
{
|
||||
BASIC(64000, 256),
|
||||
ADVANCED(128000, 512),
|
||||
@@ -654,8 +659,8 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "GasTankStorage", baseStorage).getInt();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "GasTankOutput", baseOutput).getInt();
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "GasTankStorage", baseStorage).getInt();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "GasTankOutput", baseOutput).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -671,6 +676,12 @@ public final class Tier
|
||||
dataStream.writeInt(storage);
|
||||
dataStream.writeInt(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BinTier implements ITier
|
||||
@@ -697,7 +708,7 @@ public final class Tier
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "BinStorage", baseStorage).getInt();
|
||||
storage = Mekanism.configuration.get("tier", getBaseTier().getSimpleName() + "BinStorage", baseStorage).getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,14 +33,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumFacing.AxisDirection;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple energy cube block IDs.
|
||||
@@ -84,9 +83,11 @@ public class BlockEnergyCube extends BlockContainer
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityEnergyCube)
|
||||
{
|
||||
TileEntityEnergyCube cube = (TileEntityEnergyCube)tile;
|
||||
|
||||
if(cube.facing != null)
|
||||
{
|
||||
state = state.withProperty(BlockStateFacing.facingProperty, cube.facing);
|
||||
@@ -101,15 +102,6 @@ public class BlockEnergyCube extends BlockContainer
|
||||
return state;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon(BlockBasic.ICON_BASE);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
|
||||
{
|
||||
|
||||
@@ -5,12 +5,10 @@ import java.util.Random;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.block.states.BlockStateFacing;
|
||||
import mekanism.common.block.states.BlockStateGasTank;
|
||||
import mekanism.common.block.states.BlockStateMachine;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
@@ -20,7 +18,6 @@ import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -38,8 +35,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
import static mekanism.common.block.states.BlockStateFacing.facingProperty;
|
||||
|
||||
public class BlockGasTank extends BlockContainer
|
||||
{
|
||||
public BlockGasTank()
|
||||
@@ -60,7 +55,7 @@ public class BlockGasTank extends BlockContainer
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState();
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,24 +68,25 @@ public class BlockGasTank extends BlockContainer
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null)
|
||||
|
||||
if(tile instanceof TileEntityGasTank)
|
||||
{
|
||||
state = state.withProperty(facingProperty, ((TileEntityBasicBlock)tile).facing);
|
||||
TileEntityGasTank tank = (TileEntityGasTank)tile;
|
||||
|
||||
if(tank.facing != null)
|
||||
{
|
||||
state = state.withProperty(BlockStateFacing.facingProperty, tank.facing);
|
||||
}
|
||||
|
||||
if(tank.tier != null)
|
||||
{
|
||||
state = state.withProperty(BlockStateGasTank.typeProperty, tank.tier);
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
blockIcon = register.registerIcon("mekanism:SteelCasing");
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.MekanismConfig.client;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
@@ -23,7 +24,6 @@ import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.states.BlockStateBasic.BasicBlock;
|
||||
import mekanism.common.block.states.BlockStateFacing;
|
||||
import mekanism.common.block.states.BlockStateMachine;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineBlock;
|
||||
@@ -31,57 +31,22 @@ import mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
import mekanism.common.item.ItemBlockMachine;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
import mekanism.common.tile.TileEntityAmbientAccumulator;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityChargepad;
|
||||
import mekanism.common.tile.TileEntityChemicalCrystallizer;
|
||||
import mekanism.common.tile.TileEntityChemicalDissolutionChamber;
|
||||
import mekanism.common.tile.TileEntityChemicalInfuser;
|
||||
import mekanism.common.tile.TileEntityChemicalInjectionChamber;
|
||||
import mekanism.common.tile.TileEntityChemicalOxidizer;
|
||||
import mekanism.common.tile.TileEntityChemicalWasher;
|
||||
import mekanism.common.tile.TileEntityCombiner;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.TileEntityCrusher;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
import mekanism.common.tile.TileEntityEliteFactory;
|
||||
import mekanism.common.tile.TileEntityEnergizedSmelter;
|
||||
import mekanism.common.tile.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityFormulaicAssemblicator;
|
||||
import mekanism.common.tile.TileEntityFuelwoodHeater;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.tile.TileEntityResistiveHeater;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySeismicVibrator;
|
||||
import mekanism.common.tile.TileEntitySolarNeutronActivator;
|
||||
import mekanism.common.tile.TileEntityTeleporter;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -98,7 +63,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -106,15 +71,13 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple machine block IDs.
|
||||
@@ -216,14 +179,22 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null)
|
||||
{
|
||||
state = state.withProperty(BlockStateFacing.facingProperty, ((TileEntityBasicBlock)tile).facing);
|
||||
}
|
||||
|
||||
if(tile instanceof IActiveState)
|
||||
{
|
||||
state = state.withProperty(BlockStateMachine.activeProperty, ((IActiveState)tile).getActive());
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityFluidTank)
|
||||
{
|
||||
state = state.withProperty(BlockStateMachine.tierProperty, ((TileEntityFluidTank)tile).tier.getBaseTier());
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1093,6 +1064,25 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass)
|
||||
{
|
||||
return getRenderColor(getActualState(world.getBlockState(pos), world, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderColor(IBlockState state)
|
||||
{
|
||||
if(state.getValue(getMachineBlock().getProperty()) == MachineType.FLUID_TANK)
|
||||
{
|
||||
EnumColor color = state.getValue(BlockStateMachine.tierProperty).getColor();
|
||||
|
||||
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
|
||||
}
|
||||
|
||||
return super.getRenderColor(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mekanism.common.block.states;
|
||||
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
@@ -10,6 +11,11 @@ public class BlockStateFacing extends BlockState
|
||||
{
|
||||
public static final PropertyDirection facingProperty = PropertyDirection.create("facing");
|
||||
|
||||
public BlockStateFacing(Block block, PropertyEnum typeProperty, PropertyBool activeProperty, PropertyEnum<BaseTier> tierProperty)
|
||||
{
|
||||
super(block, facingProperty, typeProperty, activeProperty, tierProperty);
|
||||
}
|
||||
|
||||
public BlockStateFacing(Block block, PropertyEnum typeProperty, PropertyBool activeProperty)
|
||||
{
|
||||
super(block, facingProperty, typeProperty, activeProperty);
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package mekanism.common.block.states;
|
||||
|
||||
import mekanism.common.Tier;
|
||||
import mekanism.common.block.BlockGasTank;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
|
||||
/**
|
||||
* Created by ben on 23/12/14.
|
||||
*/
|
||||
public class BlockStateGasTank extends BlockStateFacing
|
||||
{
|
||||
public static final PropertyEnum<Tier.GasTankTier> typeProperty = PropertyEnum.create("tier", Tier.GasTankTier.class);
|
||||
|
||||
public BlockStateGasTank(BlockGasTank block)
|
||||
{
|
||||
super(block);
|
||||
super(block, typeProperty);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import mekanism.api.MekanismConfig.machines;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.block.BlockMachine;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
@@ -71,10 +72,11 @@ import com.google.common.base.Predicates;
|
||||
public class BlockStateMachine extends BlockStateFacing
|
||||
{
|
||||
public static final PropertyBool activeProperty = PropertyBool.create("active");
|
||||
public static final PropertyEnum<BaseTier> tierProperty = PropertyEnum.create("tier", BaseTier.class);
|
||||
|
||||
public BlockStateMachine(BlockMachine block, PropertyEnum typeProperty)
|
||||
{
|
||||
super(block, typeProperty, activeProperty);
|
||||
super(block, typeProperty, activeProperty, tierProperty);
|
||||
}
|
||||
|
||||
public static final Predicate<EnumFacing> never = Predicates.<EnumFacing>alwaysFalse();
|
||||
|
||||
@@ -308,7 +308,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
|
||||
|
||||
if(type == BasicBlockType.BIN || type == BasicBlockType.INDUCTION_CELL || type == BasicBlockType.INDUCTION_PROVIDER)
|
||||
{
|
||||
name += getBaseTier(itemstack).getName();
|
||||
name += getBaseTier(itemstack).getSimpleName();
|
||||
}
|
||||
|
||||
return name;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack)
|
||||
{
|
||||
return LangUtils.localize("tile.EnergyCube" + getEnergyCubeTier(itemstack).getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize("tile.EnergyCube" + getEnergyCubeTier(itemstack).getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +164,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemstack.getTagCompound().setString("tier", tier.getBaseTier().getName());
|
||||
itemstack.getTagCompound().setString("tier", tier.getBaseTier().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
return LangUtils.localize("tile.GasTank" + getBaseTier(itemstack).getName() + ".name");
|
||||
return LangUtils.localize("tile.GasTank" + getBaseTier(itemstack).getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,8 @@ import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
import mekanism.common.block.states.BlockStateMachine;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
import mekanism.common.integration.IC2ItemManager;
|
||||
import mekanism.common.inventory.InventoryPersonalChest;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
@@ -50,22 +50,22 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
import net.minecraftforge.fml.common.Optional.InterfaceList;
|
||||
import net.minecraftforge.fml.common.Optional.Method;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple machine block IDs.
|
||||
@@ -153,16 +153,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
BaseTier tier = type == BlockStateMachine.MachineType.BASIC_FACTORY ? BaseTier.BASIC : (type == BlockStateMachine.MachineType.ADVANCED_FACTORY ? BaseTier.ADVANCED : BaseTier.ELITE);
|
||||
|
||||
if(StatCollector.canTranslate("tile." + tier.getName() + RecipeType.values()[getRecipeType(itemstack)].getUnlocalizedName() + "Factory"))
|
||||
if(StatCollector.canTranslate("tile." + tier.getSimpleName() + RecipeType.values()[getRecipeType(itemstack)].getUnlocalizedName() + "Factory"))
|
||||
{
|
||||
return LangUtils.localize("tile." + tier.getName() + RecipeType.values()[getRecipeType(itemstack)].getUnlocalizedName() + "Factory");
|
||||
return LangUtils.localize("tile." + tier.getSimpleName() + RecipeType.values()[getRecipeType(itemstack)].getUnlocalizedName() + "Factory");
|
||||
}
|
||||
|
||||
return tier.getLocalizedName() + " " + RecipeType.values()[getRecipeType(itemstack)].getLocalizedName() + " " + super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
else if(type == MachineType.FLUID_TANK)
|
||||
{
|
||||
return LangUtils.localize("tile.FluidTank" + getBaseTier(itemstack).getName() + ".name");
|
||||
return LangUtils.localize("tile.FluidTank" + getBaseTier(itemstack).getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
return super.getItemStackDisplayName(itemstack);
|
||||
@@ -388,6 +388,19 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
if(MachineType.get(stack) == MachineType.FLUID_TANK)
|
||||
{
|
||||
EnumColor color = getBaseTier(stack).getColor();
|
||||
|
||||
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
|
||||
}
|
||||
|
||||
return super.getColorFromItemStack(stack, renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "IC2")
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ItemControlCircuit extends ItemMekanism implements IMetaItem
|
||||
@Override
|
||||
public String getTexture(int meta)
|
||||
{
|
||||
return BaseTier.values()[meta].getName() + "ControlCircuit";
|
||||
return BaseTier.values()[meta].getSimpleName() + "ControlCircuit";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,6 +43,6 @@ public class ItemControlCircuit extends ItemMekanism implements IMetaItem
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
{
|
||||
return "item." + BaseTier.values()[item.getItemDamage()].getName() + "ControlCircuit";
|
||||
return "item." + BaseTier.values()[item.getItemDamage()].getSimpleName() + "ControlCircuit";
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
|
||||
@Override
|
||||
public String getTexture(int meta)
|
||||
{
|
||||
return FactoryTier.values()[meta].getBaseTier().getName() + "FactoryInstaller";
|
||||
return FactoryTier.values()[meta].getBaseTier().getSimpleName() + "FactoryInstaller";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,6 +151,6 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
{
|
||||
return "item." + BaseTier.values()[item.getItemDamage()].getName().toLowerCase() + "FactoryInstaller";
|
||||
return "item." + BaseTier.values()[item.getItemDamage()].getSimpleName().toLowerCase() + "FactoryInstaller";
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,8 @@ import mekanism.common.tile.component.TileComponentSecurity;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>, OUTPUT extends MachineOutput<OUTPUT>, RECIPE extends MachineRecipe<INPUT, OUTPUT, RECIPE>> extends TileEntityNoisyElectricBlock implements IElectricMachine<INPUT, OUTPUT, RECIPE>, IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess, ISecurityTile
|
||||
{
|
||||
|
||||
@@ -433,7 +433,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".Bin" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".Bin" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -103,7 +103,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize("tile.EnergyCube" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize("tile.EnergyCube" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,7 +236,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setString("tier", tier.getBaseTier().getName());
|
||||
nbtTags.setString("tier", tier.getBaseTier().getSimpleName());
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize("tile.FluidTank" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize("tile.FluidTank" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
private void activeEmit()
|
||||
@@ -428,7 +428,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
|
||||
@Override
|
||||
public boolean renderUpdate()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -133,7 +133,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize("tile.GasTank" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize("tile.GasTank" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TileEntityInductionCell extends TileEntityBasicBlock implements ISt
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".InductionCell" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".InductionCell" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TileEntityInductionProvider extends TileEntityBasicBlock
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".InductionProvider" + tier.getBaseTier().getName() + ".name");
|
||||
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".InductionProvider" + tier.getBaseTier().getSimpleName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -352,7 +352,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static Object getControlCircuit(BaseTier tier)
|
||||
{
|
||||
return general.controlCircuitOreDict ? "circuit" + tier.getName() : new ItemStack(MekanismItems.ControlCircuit, 1, tier.ordinal());
|
||||
return general.controlCircuitOreDict ? "circuit" + tier.getSimpleName() : new ItemStack(MekanismItems.ControlCircuit, 1, tier.ordinal());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user