American2050
Members-
Posts
553 -
Joined
Everything posted by American2050
-
So I have this on my readFromNBT in a TileEntity Problem is... Why this if is false? @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); LogHelper.info("CALLED HERE!!! " + compound); if (compound.hasKey(PANELS)) { LogHelper.info("CALLED INSIDE HAS KEY PANELS"); NBTTagCompound panels = compound.getCompoundTag(PANELS); this.stackPanelUp = new ItemStack(panels.getCompoundTag("up")); } else { LogHelper.info("NOT TRUE PANELS"); } } Console shows: [21:46:03] [main/INFO] [LogHelper]: CALLED HERE!!! {ForgeData:{factory.panels:{east:{id:"minecraft:air",Count:1b,Damage:0s},south:{id:"minecraft:air",Count:1b,Damage:0s},north:{id:"minecraft:air",Count:1b,Damage:0s},west:{id:"minecraft:air",Count:1b,Damage:0s},up:{id:"minecraft:air",Count:1b,Damage:0s},down:{id:"minecraft:air",Count:1b,Damage:0s}}},x:50,y:83,z:272,id:"factoryblock:te_factory"} [21:46:03] [main/INFO] [LogHelper]: NOT TRUE PANELS PANEL is: public static final String PANELS = "factory.panels";
-
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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. -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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. -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
Ohh ok. Back to the code then and see how that works. -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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? -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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: -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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. -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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? -
[1.12.2] [Solved] How do I render something like this
American2050 replied to American2050's topic in Modder Support
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; } } -
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.
-
[*.*] What is the best way to store a boolean for this case
American2050 replied to American2050's topic in Modder Support
Ok I went with a simple boolean variable on the class that changes it value client side That should do it. -
[*.*] What is the best way to store a boolean for this case
American2050 replied to American2050's topic in Modder Support
Packets I'm not very familiar with. I guess I will have to learn them at some point. What you mean with how am I setting this values? I'm still not as as I mentioned, not sure where to store them. -
EntityPlayer player = event.getPlayer(); And don't forget to check if it was actually a player who actually broke the block, because the cause could be an explosion, or a quarry on modded MC So you can probably can do everything within that Event
-
Apply it only when player is not sneaking, as you did on the code you showing us If player is sneaking, "do nothing"
-
You need to cancel the drops. Not sure if you can from that event, if not try BlockEvent.BreakEvent And look there for cancelling the event event.setCanceled(true); or a way to remove the drops. I think you can access the list of drops and clear it.
-
I need to store a boolean value somewhere when a key in game is pressed so depending on that value, an event that runs only Client Side executes or not. What's the best way to do this? PS: I was thinking on NBT Data on the player, but I believe that wont work as the Key Presses and the Event that I'm using are both Client side only.
-
I believe I didn't explain the problem correctly. For example I call the NBT from "onItemRightClick" and there, if the NBT doesn't exists, it gets created. I'm looking for the NBT to exists right away. That's why I call that from onCreated, but the problem is that onCreated doesn't trigger when I pick the item in creative mode. Sorry if it sounds repetitive, but maybe I didn't explain the problem correctly. PS: I also read NBT from the method that display items description when you hover on them. But that runs only "Client Side" is that good to create the NBT there? Or it needs to be done on a method that runs both server and client side.
-
But when and where from that method would get called? And sorry for this question, I guess the answer is probably obvious, but... Can an item have NBT data "pre-loaded" like for example on the Creative Tab come already with the NBT on it?
-
I have a question, I have an item that stores a boolean value when the player right clicks it. I notice that the NBT isn't there until the first right click I use on it. I know we have the onCreated method. But it looks like that only gets called when the item is crafted. But not if I'm on Creative Mode and pick it from inventory. Is there anything to do around this to get the NBT created even when the item is picked up on creative mode?
-
[1.12.2] addItemStackToInventory not working correctly
American2050 replied to American2050's topic in Modder Support
I believe I figured out what the problem is, will do some tests tomorrow and let you know. I believe at some point in my code I was checking for empty slots and passing the prefered slot instead of passing -1 so probably (most likely) that is messing. I will update after I do testings -
[1.12.2] addItemStackToInventory not working correctly
American2050 replied to American2050's topic in Modder Support
So I have an item that is trying to put items on player inventory onUpdate and every X tics. Using the ItemHandlerHelper.giveItemToPlayer as you mentioned. I give the player, let's say 4 Stone Bricks. Now lets say I have slots 1 thru 9 empty, and this item is in my inventory, doing it's thing. My "hand" is on slot 9 (My slot selected as main hand) The item starts placing 4 Stone bricks at a time on slot 1 that was empty. So it goes (4-8-12-16 and so on) As soon as I "move my hand" to slot 1, then the item starts placing items on slot 2 (The next empty slot available) and it doesn't keep popping items on slot 1 even when it still has room to accept more items. Then if I move hand to slot 2, it stops popping blocks there and goes to slot 3 and so on and so on. I believe I now know what the error is, will do some testing tomorrow and post updates -
[1.12.2] Stuck getting started; need simple example
American2050 replied to JoeStrout's topic in Modder Support
YouTube is also a good source if you like watching videos over reading documentation. The basics can be learn from those videos. Just try to find updated content from 1.12 as old videos for other Forge versions may be not so accurate and basic stuff wont work. -
[1.12.2] addItemStackToInventory not working correctly
American2050 replied to American2050's topic in Modder Support
Actually, as soon as I select in my hand any of the stacks, it start putting content on a new empty slot, instead of the one with still room for more items on it. -
Why you have the onUpdate ? Can you do a Switch with the result of the raytrace instead of those if else statements? That will probably make things cleaner. Also I think it's not breaking blocks, because when you actually call the worldIn.detroyBlock you passing "pos" and not "blockPos" that you using on the for loop.
-
[1.12.2] addItemStackToInventory not working correctly
American2050 replied to American2050's topic in Modder Support
Thanks. It's working almost perfectly. Just for some reason I couldn't find out yet, if while the method it giving me the items and my inventory is all full except 1 slot and my active hand is in that slot, I get 1 itemstack but the rest starts spawning on the floor. I guess I will have to copy the method and see why that happens and change behavior. PS: If items start filling the last empty slot on my inventory and my hand wasn't there, it keeps filling correctly.