mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Factory textures & block states, working perfectly
This commit is contained in:
1 parent
6a14acd987
commit
758bc49515
45 files changed
+928
-63
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package mekanism.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.client;
|
||||
@@ -206,6 +208,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
public static Map<String, ModelResourceLocation> machineResources = new HashMap<String, ModelResourceLocation>();
|
||||
|
||||
@Override
|
||||
public void loadConfiguration()
|
||||
{
|
||||
|
||||
@@ -10,9 +10,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.ClientProxy;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
import mekanism.common.base.IEnergyCube;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.common.block.BlockBasic;
|
||||
import mekanism.common.block.BlockBounding;
|
||||
import mekanism.common.block.BlockCardboardBox;
|
||||
@@ -123,31 +125,65 @@ public class MekanismBlocks
|
||||
|
||||
for(MachineType type : MachineType.values())
|
||||
{
|
||||
List<String> entries = new ArrayList<String>();
|
||||
List<ModelResourceLocation> modelsToAdd = new ArrayList<ModelResourceLocation>();
|
||||
String resource = "mekanism:" + type.getName();
|
||||
RecipeType recipePointer = null;
|
||||
|
||||
if(type.hasActiveTexture())
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
{
|
||||
entries.add("active=false");
|
||||
recipePointer = RecipeType.values()[0];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipePointer.getName();
|
||||
}
|
||||
|
||||
if(type.hasRotations())
|
||||
while(true)
|
||||
{
|
||||
entries.add("facing=north");
|
||||
}
|
||||
|
||||
String properties = new String();
|
||||
|
||||
for(int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
properties += entries.get(i);
|
||||
|
||||
if(i < entries.size()-1)
|
||||
if(ClientProxy.machineResources.get(resource) == null)
|
||||
{
|
||||
properties += ",";
|
||||
List<String> entries = new ArrayList<String>();
|
||||
|
||||
if(type.hasActiveTexture())
|
||||
{
|
||||
entries.add("active=false");
|
||||
}
|
||||
|
||||
if(type.hasRotations())
|
||||
{
|
||||
entries.add("facing=north");
|
||||
}
|
||||
|
||||
String properties = new String();
|
||||
|
||||
for(int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
properties += entries.get(i);
|
||||
|
||||
if(i < entries.size()-1)
|
||||
{
|
||||
properties += ",";
|
||||
}
|
||||
}
|
||||
|
||||
ModelResourceLocation model = new ModelResourceLocation(resource, properties);
|
||||
|
||||
ClientProxy.machineResources.put(resource, model);
|
||||
modelsToAdd.add(model);
|
||||
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
{
|
||||
if(recipePointer.ordinal() < RecipeType.values().length-1)
|
||||
{
|
||||
recipePointer = RecipeType.values()[recipePointer.ordinal()+1];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipePointer.getName();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.typeBlock.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(), properties));
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(type.typeBlock.getBlock()), modelsToAdd.toArray(new ModelResourceLocation[] {}));
|
||||
}
|
||||
|
||||
for(BasicBlockType type : BasicBlockType.values())
|
||||
@@ -169,7 +205,7 @@ public class MekanismBlocks
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.OreBlock), ore.ordinal(), new ModelResourceLocation("mekanism:OreBlock", "type=" + ore.getName()));
|
||||
}
|
||||
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.EnergyCube), new ItemMeshDefinition() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
@@ -191,5 +227,32 @@ public class MekanismBlocks
|
||||
return new ModelResourceLocation(baseLocation, "facing=north,tier="+tier);
|
||||
}
|
||||
});
|
||||
|
||||
ItemMeshDefinition mesher = new ItemMeshDefinition() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
MachineType type = MachineType.get(stack);
|
||||
|
||||
if(type != null)
|
||||
{
|
||||
String resource = "mekanism:" + type.getName();
|
||||
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
{
|
||||
RecipeType recipe = RecipeType.values()[((ItemBlockMachine)stack.getItem()).getRecipeType(stack)];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipe.getName();
|
||||
}
|
||||
|
||||
return ClientProxy.machineResources.get(resource);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock), mesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), mesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), mesher);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.InfuseStorage;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
@@ -20,10 +21,9 @@ import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import static mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
|
||||
/**
|
||||
* Internal interface for managing various Factory types.
|
||||
* @author AidanBrady
|
||||
@@ -45,20 +45,20 @@ public interface IFactory
|
||||
*/
|
||||
public void setRecipeType(int type, ItemStack itemStack);
|
||||
|
||||
public static enum RecipeType
|
||||
public static enum RecipeType implements IStringSerializable
|
||||
{
|
||||
SMELTING("Smelting", "smelter", MachineType.ENERGIZED_SMELTER.getStack(), false, false, Recipe.ENERGIZED_SMELTER),
|
||||
ENRICHING("Enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER.getStack(), false, false, Recipe.ENRICHMENT_CHAMBER),
|
||||
CRUSHING("Crushing", "crusher", MachineType.CRUSHER.getStack(), false, false, Recipe.CRUSHER),
|
||||
COMPRESSING("Compressing", "compressor", MachineType.OSMIUM_COMPRESSOR.getStack(), true, false, Recipe.OSMIUM_COMPRESSOR),
|
||||
COMBINING("Combining", "combiner", MachineType.COMBINER.getStack(), true, false, Recipe.COMBINER),
|
||||
PURIFYING("Purifying", "purifier", MachineType.PURIFICATION_CHAMBER.getStack(), true, true, Recipe.PURIFICATION_CHAMBER),
|
||||
INJECTING("Injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, true, Recipe.CHEMICAL_INJECTION_CHAMBER),
|
||||
INFUSING("Infusing", "metalinfuser", MachineType.METALLURGIC_INFUSER.getStack(), false, false, Recipe.METALLURGIC_INFUSER);
|
||||
SMELTING("Smelting", "smelter", MachineType.ENERGIZED_SMELTER, false, false, Recipe.ENERGIZED_SMELTER),
|
||||
ENRICHING("Enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER, false, false, Recipe.ENRICHMENT_CHAMBER),
|
||||
CRUSHING("Crushing", "crusher", MachineType.CRUSHER, false, false, Recipe.CRUSHER),
|
||||
COMPRESSING("Compressing", "compressor", MachineType.OSMIUM_COMPRESSOR, true, false, Recipe.OSMIUM_COMPRESSOR),
|
||||
COMBINING("Combining", "combiner", MachineType.COMBINER, true, false, Recipe.COMBINER),
|
||||
PURIFYING("Purifying", "purifier", MachineType.PURIFICATION_CHAMBER, true, true, Recipe.PURIFICATION_CHAMBER),
|
||||
INJECTING("Injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER, true, true, Recipe.CHEMICAL_INJECTION_CHAMBER),
|
||||
INFUSING("Infusing", "metalinfuser", MachineType.METALLURGIC_INFUSER, false, false, Recipe.METALLURGIC_INFUSER);
|
||||
|
||||
private String name;
|
||||
private ResourceLocation sound;
|
||||
private ItemStack stack;
|
||||
private MachineType type;
|
||||
private boolean usesFuel;
|
||||
private boolean fuelSpeed;
|
||||
private Recipe recipe;
|
||||
@@ -170,7 +170,6 @@ public interface IFactory
|
||||
if(((Map.Entry)obj).getKey() instanceof AdvancedMachineInput)
|
||||
{
|
||||
Map.Entry entry = (Map.Entry)obj;
|
||||
|
||||
ItemStack stack = ((AdvancedMachineInput)entry.getKey()).itemStack;
|
||||
|
||||
if(StackUtils.equalsWildcard(stack, itemStack))
|
||||
@@ -187,7 +186,7 @@ public interface IFactory
|
||||
{
|
||||
if(cacheTile == null)
|
||||
{
|
||||
MachineType type = MachineType.get(Block.getBlockFromItem(getStack().getItem()), getStack().getItemDamage());
|
||||
MachineType type = MachineType.get(getStack());
|
||||
cacheTile = (TileEntityAdvancedElectricMachine)type.create();
|
||||
}
|
||||
|
||||
@@ -201,7 +200,7 @@ public interface IFactory
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return stack;
|
||||
return type.getStack();
|
||||
}
|
||||
|
||||
public String getUnlocalizedName()
|
||||
@@ -229,14 +228,20 @@ public interface IFactory
|
||||
return fuelSpeed;
|
||||
}
|
||||
|
||||
private RecipeType(String s, String s1, ItemStack is, boolean b, boolean b1, Recipe r)
|
||||
private RecipeType(String s, String s1, MachineType t, boolean b, boolean b1, Recipe r)
|
||||
{
|
||||
name = s;
|
||||
sound = new ResourceLocation("mekanism", "tile.machine." + s1);
|
||||
stack = is;
|
||||
type = t;
|
||||
usesFuel = b;
|
||||
fuelSpeed = b1;
|
||||
recipe = r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,11 +195,14 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
|
||||
state = state.withProperty(BlockStateMachine.tierProperty, ((TileEntityFluidTank)tile).tier.getBaseTier());
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityFactory)
|
||||
{
|
||||
state = state.withProperty(BlockStateMachine.recipeProperty, ((TileEntityFactory)tile).recipeType);
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mekanism.common.block.states;
|
||||
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
@@ -11,9 +12,9 @@ public class BlockStateFacing extends BlockState
|
||||
{
|
||||
public static final PropertyDirection facingProperty = PropertyDirection.create("facing");
|
||||
|
||||
public BlockStateFacing(Block block, PropertyEnum typeProperty, PropertyBool activeProperty, PropertyEnum<BaseTier> tierProperty)
|
||||
public BlockStateFacing(Block block, PropertyEnum typeProperty, PropertyBool activeProperty, PropertyEnum<BaseTier> tierProperty, PropertyEnum<RecipeType> recipeProperty)
|
||||
{
|
||||
super(block, facingProperty, typeProperty, activeProperty, tierProperty);
|
||||
super(block, facingProperty, typeProperty, activeProperty, tierProperty, recipeProperty);
|
||||
}
|
||||
|
||||
public BlockStateFacing(Block block, PropertyEnum typeProperty, PropertyBool activeProperty)
|
||||
|
||||
@@ -11,6 +11,7 @@ import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.common.block.BlockMachine;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
@@ -73,15 +74,13 @@ 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 static final PropertyEnum<RecipeType> recipeProperty = PropertyEnum.create("recipe", RecipeType.class);
|
||||
|
||||
public BlockStateMachine(BlockMachine block, PropertyEnum typeProperty)
|
||||
{
|
||||
super(block, typeProperty, activeProperty, tierProperty);
|
||||
super(block, typeProperty, activeProperty, tierProperty, recipeProperty);
|
||||
}
|
||||
|
||||
public static final Predicate<EnumFacing> never = Predicates.<EnumFacing>alwaysFalse();
|
||||
public static final Predicate<EnumFacing> always = Predicates.<EnumFacing>alwaysTrue();
|
||||
|
||||
public static enum MachineBlock
|
||||
{
|
||||
MACHINE_BLOCK_1,
|
||||
@@ -129,11 +128,11 @@ public class BlockStateMachine extends BlockStateFacing
|
||||
METALLURGIC_INFUSER(MachineBlock.MACHINE_BLOCK_1, 8, "MetallurgicInfuser", 12, TileEntityMetallurgicInfuser.class, true, true, true, Plane.HORIZONTAL, false),
|
||||
PURIFICATION_CHAMBER(MachineBlock.MACHINE_BLOCK_1, 9, "PurificationChamber", 15, TileEntityPurificationChamber.class, true, false, true, Plane.HORIZONTAL, true),
|
||||
ENERGIZED_SMELTER(MachineBlock.MACHINE_BLOCK_1, 10, "EnergizedSmelter", 16, TileEntityEnergizedSmelter.class, true, false, true, Plane.HORIZONTAL, true),
|
||||
TELEPORTER(MachineBlock.MACHINE_BLOCK_1, 11, "Teleporter", 13, TileEntityTeleporter.class, true, false, false, never, false),
|
||||
TELEPORTER(MachineBlock.MACHINE_BLOCK_1, 11, "Teleporter", 13, TileEntityTeleporter.class, true, false, false, Predicates.alwaysFalse(), false),
|
||||
ELECTRIC_PUMP(MachineBlock.MACHINE_BLOCK_1, 12, "ElectricPump", 17, TileEntityElectricPump.class, true, true, false, Plane.HORIZONTAL, false),
|
||||
PERSONAL_CHEST(MachineBlock.MACHINE_BLOCK_1, 13, "PersonalChest", -1, TileEntityPersonalChest.class, true, true, false, Plane.HORIZONTAL, false),
|
||||
CHARGEPAD(MachineBlock.MACHINE_BLOCK_1, 14, "Chargepad", -1, TileEntityChargepad.class, true, true, false, Plane.HORIZONTAL, false),
|
||||
LOGISTICAL_SORTER(MachineBlock.MACHINE_BLOCK_1, 15, "LogisticalSorter", -1, TileEntityLogisticalSorter.class, false, true, false, always, true),
|
||||
LOGISTICAL_SORTER(MachineBlock.MACHINE_BLOCK_1, 15, "LogisticalSorter", -1, TileEntityLogisticalSorter.class, false, true, false, Predicates.alwaysTrue(), true),
|
||||
ROTARY_CONDENSENTRATOR(MachineBlock.MACHINE_BLOCK_2, 0, "RotaryCondensentrator", 7, TileEntityRotaryCondensentrator.class, true, true, false, Plane.HORIZONTAL, false),
|
||||
CHEMICAL_OXIDIZER(MachineBlock.MACHINE_BLOCK_2, 1, "ChemicalOxidizer", 29, TileEntityChemicalOxidizer.class, true, true, true, Plane.HORIZONTAL, true),
|
||||
CHEMICAL_INFUSER(MachineBlock.MACHINE_BLOCK_2, 2, "ChemicalInfuser", 30, TileEntityChemicalInfuser.class, true, true, false, Plane.HORIZONTAL, true),
|
||||
@@ -145,18 +144,18 @@ public class BlockStateMachine extends BlockStateFacing
|
||||
CHEMICAL_CRYSTALLIZER(MachineBlock.MACHINE_BLOCK_2, 8, "ChemicalCrystallizer", 37, TileEntityChemicalCrystallizer.class, true, true, true, Plane.HORIZONTAL, true),
|
||||
SEISMIC_VIBRATOR(MachineBlock.MACHINE_BLOCK_2, 9, "SeismicVibrator", 39, TileEntitySeismicVibrator.class, true, true, false, Plane.HORIZONTAL, true),
|
||||
PRESSURIZED_REACTION_CHAMBER(MachineBlock.MACHINE_BLOCK_2, 10, "PressurizedReactionChamber", 40, TileEntityPRC.class, true, true, false, Plane.HORIZONTAL, true),
|
||||
FLUID_TANK(MachineBlock.MACHINE_BLOCK_2, 11, "FluidTank", 41, TileEntityFluidTank.class, false, true, false, never, true),
|
||||
FLUID_TANK(MachineBlock.MACHINE_BLOCK_2, 11, "FluidTank", 41, TileEntityFluidTank.class, false, true, false, Predicates.alwaysFalse(), true),
|
||||
FLUIDIC_PLENISHER(MachineBlock.MACHINE_BLOCK_2, 12, "FluidicPlenisher", 42, TileEntityFluidicPlenisher.class, true, true, false, Plane.HORIZONTAL, true),
|
||||
LASER(MachineBlock.MACHINE_BLOCK_2, 13, "Laser", -1, TileEntityLaser.class, true, true, false, always, false),
|
||||
LASER_AMPLIFIER(MachineBlock.MACHINE_BLOCK_2, 14, "LaserAmplifier", 44, TileEntityLaserAmplifier.class, false, true, false, always, true),
|
||||
LASER_TRACTOR_BEAM(MachineBlock.MACHINE_BLOCK_2, 15, "LaserTractorBeam", 45, TileEntityLaserTractorBeam.class, false, true, false, always, true),
|
||||
LASER(MachineBlock.MACHINE_BLOCK_2, 13, "Laser", -1, TileEntityLaser.class, true, true, false, Predicates.alwaysTrue(), false),
|
||||
LASER_AMPLIFIER(MachineBlock.MACHINE_BLOCK_2, 14, "LaserAmplifier", 44, TileEntityLaserAmplifier.class, false, true, false, Predicates.alwaysTrue(), true),
|
||||
LASER_TRACTOR_BEAM(MachineBlock.MACHINE_BLOCK_2, 15, "LaserTractorBeam", 45, TileEntityLaserTractorBeam.class, false, true, false, Predicates.alwaysTrue(), true),
|
||||
QUANTUM_ENTANGLOPORTER(MachineBlock.MACHINE_BLOCK_3, 0, "QuantumEntangloporter", 46, TileEntityQuantumEntangloporter.class, true, false, false, Plane.HORIZONTAL, true),
|
||||
SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false, Plane.HORIZONTAL, true),
|
||||
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false, never, true),
|
||||
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false, Predicates.alwaysFalse(), true),
|
||||
OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false, Plane.HORIZONTAL, true),
|
||||
RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, false, false, always, true),
|
||||
FORMULAIC_ASSEMBLICATOR(MachineBlock.MACHINE_BLOCK_3, 5, "FormulaicAssemblicator", 56, TileEntityFormulaicAssemblicator.class, true, false, true, always, true),
|
||||
FUELWOOD_HEATER(MachineBlock.MACHINE_BLOCK_3, 6, "FuelwoodHeater", 58, TileEntityFuelwoodHeater.class, false, false, false, always, true);
|
||||
RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, false, false, Predicates.alwaysTrue(), true),
|
||||
FORMULAIC_ASSEMBLICATOR(MachineBlock.MACHINE_BLOCK_3, 5, "FormulaicAssemblicator", 56, TileEntityFormulaicAssemblicator.class, true, false, true, Predicates.alwaysTrue(), true),
|
||||
FUELWOOD_HEATER(MachineBlock.MACHINE_BLOCK_3, 6, "FuelwoodHeater", 58, TileEntityFuelwoodHeater.class, false, false, false, Predicates.alwaysTrue(), true);
|
||||
|
||||
public MachineBlock typeBlock;
|
||||
public int meta;
|
||||
@@ -413,6 +412,7 @@ public class BlockStateMachine extends BlockStateFacing
|
||||
BlockMachine block = (BlockMachine)state.getBlock();
|
||||
MachineType type = state.getValue(block.getProperty());
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String nameOverride = null;
|
||||
|
||||
if(type.hasActiveTexture())
|
||||
{
|
||||
@@ -440,13 +440,20 @@ public class BlockStateMachine extends BlockStateFacing
|
||||
return new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
}
|
||||
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
{
|
||||
RecipeType recipe = state.getValue(recipeProperty);
|
||||
|
||||
nameOverride = type.getName() + "_" + recipe.getName();
|
||||
}
|
||||
|
||||
if(builder.length() == 0)
|
||||
{
|
||||
builder.append("normal");
|
||||
}
|
||||
|
||||
ResourceLocation baseLocation = new ResourceLocation("mekanism", type.getName());
|
||||
ResourceLocation baseLocation = new ResourceLocation("mekanism", nameOverride != null ? nameOverride : type.getName());
|
||||
|
||||
return new ModelResourceLocation(baseLocation, builder.toString());
|
||||
}
|
||||
|
||||
@@ -3,17 +3,20 @@ package mekanism.common.item;
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.Tier.FluidTankTier;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IFactory;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
@@ -28,6 +31,7 @@ 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.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
@@ -363,6 +367,8 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
factory.upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
|
||||
factory.secondaryEnergyPerTick = factory.getSecondaryEnergyPerTick(recipeType);
|
||||
world.notifyNeighborsOfStateChange(pos, tileEntity.getBlockType());
|
||||
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList<Object>())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISustainedTank)
|
||||
|
||||
@@ -769,13 +769,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||
clientActive = dataStream.readBoolean();
|
||||
RecipeType oldRecipe = recipeType;
|
||||
recipeType = RecipeType.values()[dataStream.readInt()];
|
||||
upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
|
||||
|
||||
if(recipeType != oldRecipe)
|
||||
{
|
||||
secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType);
|
||||
}
|
||||
|
||||
upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
|
||||
recipeTicks = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
sorting = dataStream.readBoolean();
|
||||
@@ -783,6 +777,16 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||
lastUsage = dataStream.readDouble();
|
||||
infuseStored.amount = dataStream.readInt();
|
||||
infuseStored.type = InfuseRegistry.get(PacketHandler.readString(dataStream));
|
||||
|
||||
if(recipeType != oldRecipe)
|
||||
{
|
||||
secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType);
|
||||
|
||||
if(!upgraded)
|
||||
{
|
||||
MekanismUtils.updateBlock(worldObj, getPos());
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < tier.processes; i++)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user