mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
Loads and loads of render work. I can see the light at the end of the tunnel
- Finished CTM - BasicBlock item rendering - Balloon item rendering - Plastic Fence item rendering - Started work on Portable Tank fluid item rendering - Fixed Obsidian TNT and Bin rendering
This commit is contained in:
1 parent
98c57960d1
commit
730ee4e450
41 files changed
+759
-386
No files matched your search
@@ -226,19 +226,14 @@ public class CommonProxy implements IGuiProvider
|
||||
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos) {}
|
||||
|
||||
/**
|
||||
* Register and load client-only render information.
|
||||
* Register and load client-only item render information.
|
||||
*/
|
||||
public void registerRenderInformation() {}
|
||||
|
||||
public void registerItemRenders() {}
|
||||
|
||||
/**
|
||||
* Gets the armor index number from ClientProxy.
|
||||
* @param string - armor indicator
|
||||
* @return armor index number
|
||||
* Register and load client-only block render information.
|
||||
*/
|
||||
public int getArmorIndex(String string)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public void registerBlockRenders() {}
|
||||
|
||||
/**
|
||||
* Set and load the mod's common configuration properties.
|
||||
|
||||
@@ -1379,7 +1379,7 @@ public class Mekanism
|
||||
packetHandler.initialize();
|
||||
|
||||
//Load proxy
|
||||
proxy.registerRenderInformation();
|
||||
proxy.registerItemRenders();
|
||||
proxy.loadUtilities();
|
||||
|
||||
//Completion notification
|
||||
|
||||
@@ -5,16 +5,6 @@ import static mekanism.common.block.states.BlockStateBasic.BasicBlock.BASIC_BLOC
|
||||
import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_1;
|
||||
import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_2;
|
||||
import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_3;
|
||||
|
||||
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;
|
||||
@@ -28,11 +18,8 @@ import mekanism.common.block.BlockPlasticFence;
|
||||
import mekanism.common.block.BlockPlasticFence.PlasticFenceStateMapper;
|
||||
import mekanism.common.block.BlockSalt;
|
||||
import mekanism.common.block.states.BlockStateBasic.BasicBlockStateMapper;
|
||||
import mekanism.common.block.states.BlockStateBasic.BasicBlockType;
|
||||
import mekanism.common.block.states.BlockStateCardboardBox.CardboardBoxStateMapper;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineBlockStateMapper;
|
||||
import mekanism.common.block.states.BlockStateMachine.MachineType;
|
||||
import mekanism.common.block.states.BlockStateOre.EnumOreType;
|
||||
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockStateMapper;
|
||||
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockType;
|
||||
import mekanism.common.item.ItemBlockBasic;
|
||||
@@ -43,12 +30,7 @@ import mekanism.common.item.ItemBlockMachine;
|
||||
import mekanism.common.item.ItemBlockOre;
|
||||
import mekanism.common.item.ItemBlockPlastic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
@@ -118,167 +100,6 @@ public class MekanismBlocks
|
||||
ModelLoader.setCustomStateMapper(PlasticFence, fenceMapper);
|
||||
ModelLoader.setCustomStateMapper(CardboardBox, boxMapper);
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), 0, new ModelResourceLocation("mekanism:ObsidianTNT", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SaltBlock), 0, new ModelResourceLocation("mekanism:SaltBlock", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 0, new ModelResourceLocation("mekanism:CardboardBox", "storage=false"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 1, new ModelResourceLocation("mekanism:CardboardBox", "storage=true"));
|
||||
|
||||
for(MachineType type : MachineType.values())
|
||||
{
|
||||
List<ModelResourceLocation> modelsToAdd = new ArrayList<ModelResourceLocation>();
|
||||
String resource = "mekanism:" + type.getName();
|
||||
RecipeType recipePointer = null;
|
||||
|
||||
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
|
||||
{
|
||||
recipePointer = RecipeType.values()[0];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipePointer.getName();
|
||||
}
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(ClientProxy.machineResources.get(resource) == null)
|
||||
{
|
||||
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.registerItemVariants(Item.getItemFromBlock(type.typeBlock.getBlock()), modelsToAdd.toArray(new ModelResourceLocation[] {}));
|
||||
}
|
||||
|
||||
for(BasicBlockType type : BasicBlockType.values())
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.blockType.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(), "inventory"));
|
||||
}
|
||||
|
||||
for(EnumColor color : EnumColor.DYES)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=plastic"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SlickPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=slick"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=glow"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ReinforcedPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=reinforced"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.RoadPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=road"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticFence), color.getMetaValue(), new ModelResourceLocation("mekanism:PlasticFence", "inventory"));
|
||||
}
|
||||
|
||||
for(EnumOreType ore : EnumOreType.values())
|
||||
{
|
||||
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)
|
||||
{
|
||||
EnergyCubeTier tier = ((IEnergyCube)stack.getItem()).getEnergyCubeTier(stack);
|
||||
ResourceLocation baseLocation = new ResourceLocation("mekanism", "EnergyCube");
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
ItemMeshDefinition machineMesher = 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), machineMesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), machineMesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), machineMesher);
|
||||
|
||||
ItemMeshDefinition basicMesher = 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.BasicBlock), basicMesher);
|
||||
//ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), basicMesher);
|
||||
Mekanism.proxy.registerBlockRenders();
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,11 @@ public abstract class BlockBasic extends Block implements ICTMBlock//TODO? imple
|
||||
state = state.withProperty(BlockStateBasic.tierProperty, ((TileEntityInductionProvider)tile).tier.getBaseTier());
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityBin)
|
||||
{
|
||||
state = state.withProperty(BlockStateBasic.tierProperty, ((TileEntityBin)tile).tier.getBaseTier());
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityInductionPort)
|
||||
{
|
||||
state = state.withProperty(BlockStateBasic.activeProperty, ((TileEntityInductionPort)tile).mode);
|
||||
@@ -1008,7 +1013,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock//TODO? imple
|
||||
|
||||
if(type == BasicBlockType.INDUCTION_PORT)
|
||||
{
|
||||
return type.getName() + (state.getValue(BlockStateBasic.activeProperty) ? "output" : "input");
|
||||
return type.getName() + (state.getValue(BlockStateBasic.activeProperty) ? "_output" : "");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BlockStateBasic extends ExtendedBlockState
|
||||
COAL_BLOCK(BasicBlock.BASIC_BLOCK_1, 3, "CharcoalBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
REFINED_GLOWSTONE(BasicBlock.BASIC_BLOCK_1, 4, "RefinedGlowstone", null, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
STEEL_BLOCK(BasicBlock.BASIC_BLOCK_1, 5, "SteelBlock", null, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
BIN(BasicBlock.BASIC_BLOCK_1, 6, "Bin", TileEntityBin.class, false, Plane.HORIZONTAL, true, false),
|
||||
BIN(BasicBlock.BASIC_BLOCK_1, 6, "Bin", TileEntityBin.class, false, Plane.HORIZONTAL, true, true),
|
||||
TELEPORTER_FRAME(BasicBlock.BASIC_BLOCK_1, 7, "TeleporterFrame", null, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
STEEL_CASING(BasicBlock.BASIC_BLOCK_1, 8, "SteelCasing", null, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
DYNAMIC_TANK(BasicBlock.BASIC_BLOCK_1, 9, "DynamicTank", TileEntityDynamicTank.class, false, Predicates.<EnumFacing>alwaysFalse(), false, false),
|
||||
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBalloon extends ItemMekanism implements IMetaItem
|
||||
{
|
||||
@@ -34,7 +36,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
|
||||
@Override
|
||||
public String getTexture(int meta)
|
||||
{
|
||||
return EnumColor.DYES[meta].getOreDictName() + "Balloon";
|
||||
return "Balloon";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,6 +44,14 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
|
||||
{
|
||||
return EnumColor.DYES.length;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
EnumColor dye = getColor(stack);
|
||||
|
||||
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
|
||||
}
|
||||
|
||||
public EnumColor getColor(ItemStack stack)
|
||||
{
|
||||
@@ -74,7 +84,10 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
|
||||
world.spawnEntityInWorld(new EntityBalloon(world, pos.xCoord-0.5, pos.yCoord-0.25, pos.zCoord-0.5, getColor(itemstack)));
|
||||
}
|
||||
|
||||
itemstack.stackSize--;
|
||||
if(!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -242,6 +255,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
|
||||
}
|
||||
|
||||
stack.stackSize--;
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user