American2050 Posted January 5, 2018 Posted January 5, 2018 (edited) So I'm trying to find out what's the best way to render a block that can have 6 different faces. The main block is a frame that is been rendered as normal with the json model. Now the block itself can have X different models on each of the 6 faces. I thought about having 6 Properties and different values for each of them... But I don't this that would work as... "top=empty": { "model": "aaa" }, "top=furnace": { "model": "bbb" }, "top=transfer": { "model": "ccc" }, "top=crusher": { "model": "ddd" }, "bottom=empty": { "model": "aaa" }, "bottom=furnace": { "model": "bbb" }, "bottom=transfer": { "model": "ccc" }, "bottom=crusher": { "model": "ddd" }, "north=empty": { "model": "aaa" }, "north=furnace": { "model": "bbb" }, "north=transfer": { "model": "ccc" }, "north=crusher": { "model": "ddd" }, ^^^^^I don't this that is good and I would have to use something like "top=empty,bottom=empty,north=empty,east=empty,south=empty,west=empty": { "model": "aaa" }, And the hundreds of possible combinations... Which I don't think it's practical. Should I just go with TESR or is there a way to do this with json models? Thanks a lot. Edited January 8, 2018 by American2050 Quote
Draco18s Posted January 5, 2018 Posted January 5, 2018 2 hours ago, American2050 said: "top=empty,bottom=empty,north=empty,east=empty,south=empty,west=empty": { "model": "aaa" }, And the hundreds of possible combinations... Which I don't think it's practical. Forge blockstate format. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
American2050 Posted January 5, 2018 Author Posted January 5, 2018 So I'm trying the suggested method. But doing something like this doesn't work This is on my blockstate json: { "forge_marker": 1, "defaults": { "model": "factoryblock:factory_frame" }, "variants": { "north": { "iron_panel": { "model": "factoryblock:iron_panel" }, "gold_panel": { "model": "factoryblock:gold_panel" }, "furnace": { "model": "factoryblock:furnace_off_panel" }, "empty": {} } } } I know I have variants still missing, but that doesn't even render the base block properly. This is my block class: package org.bitbucket.factoryblock.blocks; import org.bitbucket.factoryblock.interfaces.IPanel; import org.bitbucket.factoryblock.tileentity.TileEntityFactoryFrame; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockFactoryFrame extends BlockGeneric { public static final PropertyEnum<BlockFactoryFrame.EnumPartType> UP = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("up", BlockFactoryFrame.EnumPartType.class); public static final PropertyEnum<BlockFactoryFrame.EnumPartType> DOWN = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("down", BlockFactoryFrame.EnumPartType.class); public static final PropertyEnum<BlockFactoryFrame.EnumPartType> NORTH = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("north", BlockFactoryFrame.EnumPartType.class); public static final PropertyEnum<BlockFactoryFrame.EnumPartType> EAST = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("east", BlockFactoryFrame.EnumPartType.class); public static final PropertyEnum<BlockFactoryFrame.EnumPartType> SOUTH = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("south", BlockFactoryFrame.EnumPartType.class); public static final PropertyEnum<BlockFactoryFrame.EnumPartType> WEST = PropertyEnum.<BlockFactoryFrame.EnumPartType> create("west", BlockFactoryFrame.EnumPartType.class); public BlockFactoryFrame(Material material, String name, boolean andRegister) { super(material, name, andRegister); this.setDefaultState(this.blockState.getBaseState().withProperty(UP, BlockFactoryFrame.EnumPartType.EMPTY).withProperty(DOWN, BlockFactoryFrame.EnumPartType.EMPTY).withProperty(NORTH, BlockFactoryFrame.EnumPartType.EMPTY).withProperty(EAST, BlockFactoryFrame.EnumPartType.EMPTY).withProperty(SOUTH, BlockFactoryFrame.EnumPartType.EMPTY).withProperty(WEST, BlockFactoryFrame.EnumPartType.EMPTY)); } @Override public int getMetaFromState(IBlockState state) { return 0; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { UP, DOWN, NORTH, EAST, SOUTH, WEST }); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { // TODO Auto-generated method stub if (!worldIn.isRemote && hand == EnumHand.MAIN_HAND) { if (this.isPlayerHoldingValidPanel(playerIn, EnumHand.MAIN_HAND)) { ItemStack heldItemStack = playerIn.getHeldItemMainhand(); String heldItemName = heldItemStack.getItem().getRegistryName().toString(); BlockFactoryFrame.EnumPartType type; switch (heldItemName) { case "factoryblock:iron_panel": type = BlockFactoryFrame.EnumPartType.IRON_PANEL; break; case "factoryblock:gold_panel": type = BlockFactoryFrame.EnumPartType.GOLD_PANEL; break; case "factoryblock:furnace_panel": type = BlockFactoryFrame.EnumPartType.FURNACE; break; default: type = BlockFactoryFrame.EnumPartType.EMPTY; } switch (facing) { case UP: worldIn.setBlockState(pos, state.withProperty(UP, type), 3); break; case DOWN: worldIn.setBlockState(pos, state.withProperty(DOWN, type), 3); break; case NORTH: worldIn.setBlockState(pos, state.withProperty(NORTH, type), 3); break; case EAST: worldIn.setBlockState(pos, state.withProperty(EAST, type), 3); break; case SOUTH: worldIn.setBlockState(pos, state.withProperty(SOUTH, type), 3); break; case WEST: worldIn.setBlockState(pos, state.withProperty(WEST, type), 3); break; default: break; } } else if (this.isPlayerHoldingValidPanel(playerIn, EnumHand.OFF_HAND)) { // OFFHAND GOES HERE } } // HOLDING A STICK WE CAN EMPTY THAT SIDE if (!worldIn.isRemote && hand == EnumHand.MAIN_HAND && playerIn.getHeldItemMainhand().getItem() == Items.STICK) { switch (facing) { case UP: worldIn.setBlockState(pos, state.withProperty(UP, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; case DOWN: worldIn.setBlockState(pos, state.withProperty(DOWN, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; case NORTH: worldIn.setBlockState(pos, state.withProperty(NORTH, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; case EAST: worldIn.setBlockState(pos, state.withProperty(EAST, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; case SOUTH: worldIn.setBlockState(pos, state.withProperty(SOUTH, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; case WEST: worldIn.setBlockState(pos, state.withProperty(WEST, BlockFactoryFrame.EnumPartType.EMPTY), 3); break; default: break; } } return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); } private boolean isPlayerHoldingValidPanel(EntityPlayer playerIn, EnumHand hand) { ItemStack playerHolding = playerIn.getHeldItem(hand); if (playerHolding.getItem() instanceof IPanel) { return true; } return false; } public static enum EnumPartType implements IStringSerializable { EMPTY("empty"), FURNACE("furnace"), IRON_PANEL("iron_panel"), GOLD_PANEL("gold_panel"); private final String name; private EnumPartType(String name) { this.name = name; } public String toString() { return this.name; } public String getName() { return this.name; } } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @SideOnly(Side.CLIENT) @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityFactoryFrame(); } @Override public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } } Quote
American2050 Posted January 5, 2018 Author Posted January 5, 2018 Ok so Adding all the possible variations fixed the problem.... Now the "Problem" is... that it's not "accumulative" I was thinking this method was going to add json models to the default ones... But when I add any of the variations into the block, the main model disappears... Is this how this work, or I should be able to render one model on top of another? Quote
Draco18s Posted January 6, 2018 Posted January 6, 2018 Use submodels. That's what you're trying to do. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Choonster Posted January 6, 2018 Posted January 6, 2018 2 hours ago, American2050 said: Ok so Adding all the possible variations fixed the problem.... Now the "Problem" is... that it's not "accumulative" I was thinking this method was going to add json models to the default ones... But when I add any of the variations into the block, the main model disappears... Is this how this work, or I should be able to render one model on top of another? You need to use submodels to combine multiple models. Are you sure you actually need multiple models and not just a single model with multiple textures? Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
American2050 Posted January 6, 2018 Author Posted January 6, 2018 23 minutes ago, Choonster said: You need to use submodels to combine multiple models. Are you sure you actually need multiple models and not just a single model with multiple textures? Ahh ok Thanks a lot. Well yes I could use same model with different textures, but for this case multiple models will work better as each of the panels that can go on each side of a block will also be the model I will use to render that Panel Item when in inventory Thanks a lot for the help. Got this working nicely. Now I'm having an issue where I added more variants and I'm creating some memory leak but too late to see what's going on, will take it again freshly tomorrow I'm sure I must be doing something silly somewhere. Quote
American2050 Posted January 6, 2018 Author Posted January 6, 2018 (edited) So I went with the submodels but after adding some more possible variants, now my game "hangs" chewing up all the memory I have assigned to MC in few seconds. { "forge_marker": 1, "defaults": { "model": "factoryblock:factory_frame" }, "variants": { "normal": [ { } ], "up": { "iron_panel": { "submodel": "factoryblock:iron_panel", "x": -90 }, "gold_panel": { "submodel": "factoryblock:gold_panel", "x": -90 }, "furnace": { "submodel": "factoryblock:furnace_off_panel", "x": -90 }, "dropper": { "submodel": "factoryblock:dropper_panel", "x": -90 }, "dispenser": { "submodel": "factoryblock:dispenser_panel", "x": -90 }, "crafting": { "submodel": "factoryblock:crafting_panel", "x": -90 }, "empty": { } }, "down": { "iron_panel": { "submodel": "factoryblock:iron_panel", "x": 90 }, "gold_panel": { "submodel": "factoryblock:gold_panel", "x": 90 }, "furnace": { "submodel": "factoryblock:furnace_off_panel", "x": 90 }, "dropper": { "submodel": "factoryblock:dropper_panel", "x": 90 }, "dispenser": { "submodel": "factoryblock:dispenser_panel", "x": 90 }, "crafting": { "submodel": "factoryblock:crafting_panel", "x": 90 }, "empty": { } }, "north": { "iron_panel": { "submodel": "factoryblock:iron_panel" }, "gold_panel": { "submodel": "factoryblock:gold_panel" }, "furnace": { "submodel": "factoryblock:furnace_off_panel" }, "dropper": { "submodel": "factoryblock:dropper_panel" }, "dispenser": { "submodel": "factoryblock:dispenser_panel" }, "crafting": { "submodel": "factoryblock:crafting_panel" }, "empty": { } }, "east": { "iron_panel": { "submodel": "factoryblock:iron_panel", "y": 90 }, "gold_panel": { "submodel": "factoryblock:gold_panel", "y": 90 }, "furnace": { "submodel": "factoryblock:furnace_off_panel", "y": 90 }, "dropper": { "submodel": "factoryblock:dropper_panel", "y": 90 }, "dispenser": { "submodel": "factoryblock:dispenser_panel", "y": 90 }, "crafting": { "submodel": "factoryblock:crafting_panel", "y": 90 }, "empty": { } }, "south": { "iron_panel": { "submodel": "factoryblock:iron_panel", "y": 180 }, "gold_panel": { "submodel": "factoryblock:gold_panel", "y": 180 }, "furnace": { "submodel": "factoryblock:furnace_off_panel", "y": 180 }, "dropper": { "submodel": "factoryblock:dropper_panel", "y": 180 }, "dispenser": { "submodel": "factoryblock:dispenser_panel", "y": 180 }, "crafting": { "submodel": "factoryblock:crafting_panel", "y": 180 }, "empty": { } }, "west": { "iron_panel": { "submodel": "factoryblock:iron_panel", "y": 270 }, "gold_panel": { "submodel": "factoryblock:gold_panel", "y": 270 }, "furnace": { "submodel": "factoryblock:furnace_off_panel", "y": 270 }, "dropper": { "submodel": "factoryblock:dropper_panel", "y": 270 }, "dispenser": { "submodel": "factoryblock:dispenser_panel", "y": 270 }, "crafting": { "submodel": "factoryblock:crafting_panel", "y": 270 }, "empty": { } } } } Am I pushing this method too hard and should go in a different way to accomplish this? When I remove 5 of the 6 sides from the .json the game launches, but with all the combinations, memory leak shows up. Crash Log: ---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 1/6/18 9:46 AM Description: Initializing game java.lang.OutOfMemoryError: Java heap space at java.util.HashMap.newNode(Unknown Source) at java.util.HashMap.putVal(Unknown Source) at java.util.HashMap.put(Unknown Source) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:379) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:284) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:246) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:263) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.getSubmodelPermutations(ForgeBlockStateV1.java:280) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:207) at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:68) at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) at com.google.gson.Gson.fromJson(Gson.java:887) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at java.util.HashMap.newNode(Unknown Source) at java.util.HashMap.putVal(Unknown Source) at java.util.HashMap.put(Unknown Source) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:379) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.<init>(ForgeBlockStateV1.java:316) at net.minecraftforge.client.model.ForgeBlockStateV1$Variant.mergeModelPartVariants(ForgeBlockStateV1.java:377) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:426) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_151, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 3933168640 bytes (3750 MB) / 4260102144 bytes (4062 MB) up to 4260102144 bytes (4062 MB) JVM Flags: 3 total; -Xincgc -Xmx4096M -Xms4096M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.1.2583 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:----- |:------------ |:------------ |:-------------------------------- |:--------- | | UCH | minecraft | 1.12.2 | minecraft.jar | None | | UCH | mcp | 9.42 | minecraft.jar | None | | UCH | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.1.2583.jar | None | | UCH | forge | 14.23.1.2583 | forgeSrc-1.12.2-14.23.1.2583.jar | None | | UCH | factoryblock | 0.0.1 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 368.81' Renderer: 'GeForce GTX 750/PCIe/SSE2' Launched Version: 1.12.2 LWJGL: 2.9.4 OpenGL: GeForce GTX 750/PCIe/SSE2 GL version 4.5.0 NVIDIA 368.81, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) Profiler Position: N/A (disabled) CPU: 4x Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz PS: And as a sidenote, my block can have "infinite" combinations. So I wonder, what does getMetaFromState should return? This is the point where it freezes: Edited January 6, 2018 by American2050 Quote
larsgerrits Posted January 6, 2018 Posted January 6, 2018 (edited) You have six faces, each has 7 possible states. That means you have 7⁶ (117649) possible states. The game has to calculate and bake all different combinations of models for all of the states, and takes a lot of memory and time. So you either have to use a custom IBakedModel to combine multiple models or rethink your idea. Edited January 6, 2018 by larsgerrits Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
American2050 Posted January 7, 2018 Author Posted January 7, 2018 14 hours ago, larsgerrits said: You have six faces, each has 7 possible states. That means you have 7⁶ (117649) possible states. The game has to calculate and bake all different combinations of models for all of the states, and takes a lot of memory and time. So you either have to use a custom IBakedModel to combine multiple models or rethink your idea. Thanks you. Yes I was taking a look into that. Not sure yet what will work best for me, if that, or using TESR I believe going with TESR will give me more flexibility. Thanks for the answer. Also if I use TESR Minecraft will still be looking for those models? Or I just not use property anymore and store the 6 faces in a different way? Quote
Matryoshika Posted January 7, 2018 Posted January 7, 2018 (edited) 5 minutes ago, American2050 said: Thanks you. Yes I was taking a look into that. Not sure yet what will work best for me, if that, or using TESR I believe going with TESR will give me more flexibility. Thanks for the answer. Also if I use TESR Minecraft will still be looking for those models? Or I just not use property anymore and store the 6 faces in a different way? Other way round; a TESR is more rigid than custom IBakedModel handling. Might not be nearly as easy, but custom IBakedModel handling can do everything a TESR can, and if done correctly, using only mere fractions of the resources that a TESR would have taken. And it depends on how you're gonna store the models. If you cache them as they are rendered (aka lazy caching) then the memory foot-print will be much smaller. The client(s) will only know about the models that actually need to be rendered. Edited January 7, 2018 by Matryoshika Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
American2050 Posted January 7, 2018 Author Posted January 7, 2018 40 minutes ago, Matryoshika said: Other way round; a TESR is more rigid than custom IBakedModel handling. Might not be nearly as easy, but custom IBakedModel handling can do everything a TESR can, and if done correctly, using only mere fractions of the resources that a TESR would have taken. And it depends on how you're gonna store the models. If you cache them as they are rendered (aka lazy caching) then the memory foot-print will be much smaller. The client(s) will only know about the models that actually need to be rendered. Ohh ok. Back to the code then and see how that works. Quote
Matryoshika Posted January 7, 2018 Posted January 7, 2018 (edited) Key parts are : ICustomModelLoader -> Provide a dummy IModel here pointing to your actual IBakedModel. IExtendedBlockState -> Override Block::getExtendedState & Block::createBlockState to provide IUnlistedProperties. These are used to provide data to the IBakedModel through the IBlockState List<BakedQuad> -> This is the model boiled down. IBakedModel::getQuads is where you'll be doing your logic, per block-face. Be sure to as said cache your models, aka put the List<BakedQuad> somewhere. Always check if you have the wanted model, and only if you do not, should you make one from scratch. This is the optimization over TESR's. I am doing this in my project Echo (for 1.10.2, but procedure should be the same for 1.12.2) to allow any block (well, full blocks) to be compressed into Menger-fractals. ModelLoader, IBakedModel, Block Edited January 7, 2018 by Matryoshika 1 Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
American2050 Posted January 7, 2018 Author Posted January 7, 2018 (edited) Ok so I got most of this stuff working, but I'm having some issues. My Block still doesn't render as an item and I'm not sure why yet...Also, I noticed that even when I point to blockstates that points to the model to be used, the model isn't rotating as specified on the blockstate .json file. Any idea how to fix this? PS: Let me know if you need any of the code posted. Thanks a lot for the help, this is more complicate of what I thought Edit: Nevermind about the item not rendering, even if I get that working, it wont work for what I need as the block will render reading info from the TileEntity, but that I don't have when it's an item, so I will need a different ModelBaker for when the Block is on inventory. Edited January 7, 2018 by American2050 Quote
American2050 Posted January 8, 2018 Author Posted January 8, 2018 I edited the main post as Solved. Most of the problems were fixed. I have other problems now But I will create separate topic for them if I can't find out what I'm doing wrong. Thanks a lot to everyone for the help and patience. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.