Posted December 4, 20159 yr I have a "generator" block that has an "active" state. I have 4 textures for the front of the block: generator_front generator_front_active1 generator_front_active2 generator_front_active3 When the generator is "active", I want the front of it to randomly switch between the 3 active textures (for a fire-effect). What is the best way to do this? I tried adding an "active" property to the block class, and ended up with this as my .json model file: { "variants": { "active=0,facing=east": { "model": “generator_front” }, "active=0,facing=south": { "model": "generator_front", "y": 90 }, "active=0,facing=west": { "model": "generator_front", "y": 180 }, "active=0,facing=north": { "model": "generator_front", "y": 270 }, "active=1,facing=east": { "model": "generator_front_active1” }, "active=1,facing=south": { "model": "generator_front_active1”, "y": 90 }, "active=1,facing=west": { "model": "generator_front_active1”, "y": 180 }, "active=1,facing=north": { "model": "generator_front_active1”, "y": 270 }, "active=2,facing=east": { "model": "generator_front_active2” }, "active=2,facing=south": { "model": "generator_front_active2”, "y": 90 }, "active=2,facing=west": { "model": "generator_front_active2”, "y": 180 }, "active=2,facing=north": { "model": "generator_front_active2”, "y": 270 }, "active=3,facing=east": { "model": "generator_front_active3” }, "active=3,facing=south": { "model": "generator_front_active3”, "y": 90 }, "active=3,facing=west": { "model": "generator_front_active3”, "y": 180 }, "active=3,facing=north": { "model": "generator_front_active3”, "y": 270 } } } I also tried changing the "active" value in the random display tick method, but i got this weird problem where I would only see the block change textures 1 state at a time if I placed/broke a block nearby. What is the right way to do this?
December 4, 20159 yr Just a guess here: Try using getActualState(IBlockState, IBlockAccess, BlockPos){} And then using a value in the tile entity to cycle. I think its my java of the variables.
December 6, 20159 yr Are you trying to randomly select a model/texture to make each block "unique", or do you want programmatic control of the texture? Minecraft's model system allows you to designate several models for 1 property definition line, and it will randomly pick a model using seeded ranomization, with the seed being fetched from the coordinates. This page has a little run-down of it. So to sum it up, when the game looks for models, it looks for JSON objects (denoted by curly brackets), but it also looks for a JSON array (denoted by square brackets) of these JSON objects. So rather than "on=true": {"model":"mymodel"} You can do "on=true": [{"model":"mymodel"}, {"model":"mymodel2"}, {"model":"mymodel3"}]
December 6, 20159 yr Are you after an animated texture while your generator is active? I have not yet made my animated textures so I can't verify if this works yet. But... I made my animated textures and this works perfectly Block and item textures support animation by placing each additional frame below the last. The animation is then controlled using using a .mcmeta file in JSON format with the same name in the same directory. For example, the .mcmeta file for stone.png would be stone.png.mcmeta. (source: http://minecraft.gamepedia.com/Resource_pack) So in your case you'd make a new texture "generator_front_active.png" that is the same width as the ones you have now but is three times as tall that contains your original three. next make a text file named "generator_front_active.png.mcmeta", with the following code: { "animation": { "frametime": 2, "frames": [ 0, 1, 2, 1 ] } } You would no longer need the multiple active states a boolean would do. while active=false you use the static "generator_front", and when active=true you use the animated "generator_front_active"
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.