Jump to content

Recommended Posts

Posted

Hello,

 

I created a block that is using the model from the chest, but now I have one question: How to set the texture for the particles that appears if you break a block to "planks_oak"?

I hope here someone can help me, because on minecraft.de they tried to help me, but nothing seems to work...

 

So this are my .json files:

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

models/block:

{
    "parent": "block/cube-all",
    "textures":
    {
    	"all": "minecraft:blocks/chest"
    }
}

 

models/item:

{
    "parent": "builtin/entity",
    "textures":
    {
    	"layer0": "minecraft:planks_oak"
    },
    "display":
    {
    	"thirdperson":
    	{
    		"rotation": [ 10, -45, 170 ],
    		"translation": [ 0, 1.5, -2.75 ],
    		"scale": [ 0.375, 0.375, 0.375 ]
    	}
    }
}

 

  Reveal hidden contents

 

 

Bektor

Developer of Primeval Forest.

Posted

It's because the block/cube_all model that you are using already has the particle texture defined.

block/cube_all:
{
    "parent": "block/cube",
    "textures": {
        "particle": "#all",
        "down": "#all",
        "up": "#all",
        "north": "#all",
        "east": "#all",
        "south": "#all",
        "west": "#all"
    }
}

 

Used block/cube instead and list all of the sides plus the particle texture, eg

{
    "parent": "block/cube",
    "textures": {
        "down": "minecraftbyexample:blocks/mbe01_block_simple_face0",
        "up": "minecraftbyexample:blocks/mbe01_block_simple_face1",
        "north": "minecraftbyexample:blocks/mbe01_block_simple_face2",
        "east": "minecraftbyexample:blocks/mbe01_block_simple_face5",
        "south": "minecraftbyexample:blocks/mbe01_block_simple_face3",
        "west": "minecraftbyexample:blocks/mbe01_block_simple_face4",
        "particle": "blocks/lapis_block"
    }
}

 

This link explains the background in a lot more detail:

http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html

and also

http://minecraft.gamepedia.com/Block_models

 

-TGG

Posted

This will not work, too. :(

 

models/item:

{
    "parent": "builtin/entity",
    "textures":
    {
    	"layer0": "minecraft:planks_oak"
    },
    "display":
    {
    	"thirdperson":
    	{
    		"rotation": [ 10, -45, 170 ],
    		"translation": [ 0, 1.5, -2.75 ],
    		"scale": [ 0.375, 0.375, 0.375 ]
    	}
    }
}

 

models/block:

{
    "parent": "block/cube",
    "textures":
    {
        "down": "minecraft:blocks/chest",
        "up": "minecraft:blocks/chest",
        "north": "minecraft:blocks/chest",
        "east": "minecraft:blocks/chest",
        "south": "minecraft:blocks/chest",
        "west": "minecraft:blocks/chest",
        "particle": "blocks/planks_oak"
    }
}

 

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

Developer of Primeval Forest.

Posted

Hi

 

Well that's odd, I don't see an obvious problem.  Are you sure it's not working?  i.e. if you change particle to lapis blue, is your break block particles blue?

 

If not, I suggest a couple of things to try

First try a breakpoint in EntityDiggingFX to find out what texture your block is actually using

    protected EntityDiggingFX(World worldIn, double p_i46280_2_, double p_i46280_4_, double p_i46280_6_, double p_i46280_8_, double p_i46280_10_, double p_i46280_12_, IBlockState p_i46280_14_)
    {
        super(worldIn, p_i46280_2_, p_i46280_4_, p_i46280_6_, p_i46280_8_, p_i46280_10_, p_i46280_12_);
        this.field_174847_a = p_i46280_14_;
        this.func_180435_a(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_i46280_14_));   //<----  breakpoint here
        this.particleGravity = p_i46280_14_.getBlock().blockParticleGravity;
        this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
        this.particleScale /= 2.0F;
    }

If the block model is right but the texture is wrong, you will need to dig deeper into the loading of your model.

ModelBakery.bakeModel is where it looks for your texture in the parsed list of textures at this line

   private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
    {
        TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle")));   // here
        SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);

 

You will need to add a conditional breakpoint (eg modelBlockIn.name.contains("bektor") == true) because this method is used by the vanilla blocks too and there are hundreds.

 

-TGG

 

Posted
  Quote

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

Try changing your model name in your blockstate file. You are now referencing to minecraft's chest model, so "normal": { "model": "yourmodel_id_lowercased:block_model_file_name" }

 

Posted
  On 1/14/2015 at 8:26 AM, vilu said:

  Quote

blockstates:

{
    "variants": {
        "normal": { "model": "minecraft:chest" }
    }
}

 

Try changing your model name in your blockstate file. You are now referencing to minecraft's chest model, so "normal": { "model": "yourmodel_id_lowercased:block_model_file_name" }

 

Well, but I want to use the chest model from minecraft, because I'm not interested in creating a new chest model.

 

  Quote

Hi

 

Well that's odd, I don't see an obvious problem.  Are you sure it's not working?  i.e. if you change particle to lapis blue, is your break block particles blue?

 

If not, I suggest a couple of things to try

First try a breakpoint in EntityDiggingFX to find out what texture your block is actually using

    protected EntityDiggingFX(World worldIn, double p_i46280_2_, double p_i46280_4_, double p_i46280_6_, double p_i46280_8_, double p_i46280_10_, double p_i46280_12_, IBlockState p_i46280_14_)
    {
        super(worldIn, p_i46280_2_, p_i46280_4_, p_i46280_6_, p_i46280_8_, p_i46280_10_, p_i46280_12_);
        this.field_174847_a = p_i46280_14_;
        this.func_180435_a(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_i46280_14_));   //<----  breakpoint here
        this.particleGravity = p_i46280_14_.getBlock().blockParticleGravity;
        this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
        this.particleScale /= 2.0F;
    }

If the block model is right but the texture is wrong, you will need to dig deeper into the loading of your model.

ModelBakery.bakeModel is where it looks for your texture in the parsed list of textures at this line

   private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
    {
        TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle")));   // here
        SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);

 

You will need to add a conditional breakpoint (eg modelBlockIn.name.contains("bektor") == true) because this method is used by the vanilla blocks too and there are hundreds.

 

-TGG

 

No, my break block particles are not blue, they are still using the "missing texture" texture from minecraft.

 

Ok, how can I set a breakpoint in eclipse? And the model is correct, but the particles are wrong.

 

Thats the output from eclipse without loading a world:

 

  Reveal hidden contents

 

 

So any idea?

Developer of Primeval Forest.

Posted

Hi

 

Is this the name of your chest?  If so, the problem appears to be that you haven't registered the models properly.

[19:30:40] [Client thread/WARN]: Unable to load variant: facing=east from primevalforest:lockedChest#facing=east

 

Show your block code and registration code?

 

You could try looking this example project for clues on how to properly register a block with variants

https://github.com/TheGreyGhost/MinecraftByExample

- see example 3 in particular

 

This link is very helpful on learning how to use the debugger, you'll wonder how you ever managed with out it...

http://www.vogella.com/tutorials/EclipseDebugging/article.html

 

-TGG

 

 

 

Posted

Ok.

 

Here is the code of the Client proxy:

 

  Reveal hidden contents

 

 

and the block code:

 

  Reveal hidden contents

 

 

(Don't forget, I have no model and texture created, all textures and models that this block is using are from the normal minecraft chest)

Developer of Primeval Forest.

Posted

Ah.  The problem appears to be that your blockstates is wrong.  It doesn't have the facing variants that it expects to see - you have given your block four facings but the blockstates file doesn't have any of them.

 

Did you look in the links I sent earlier?

 

You need a blockstates file something like

{
    "variants": {
           "facing=north": { "model": "minecraftbyexample:mbe03_block_variants_model_red"},
            "facing=east": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 90 },
           "facing=south": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 180 },
            "facing=west": { "model": "minecraftbyexample:mbe03_block_variants_model_red", "y": 270 },
    }
}

-TGG

Posted

Well, this doesn't help, too. The blockbreak particles are still not working and now I'm getting errors.

 

blockstates: (lockedChest.json)

{
    "variants": {
        "normal": { "model": "minecraft:chest" },
        "facing=north": { "model": "minecraft:chest"},
        "facing=east": { "model": "minecraft:chest", "y": 90 },
        "facing=south": { "model": "minecraft:chest", "y": 180 },
        "facing=west": { "model": "minecraft:chest", "y": 270 }
    }
}

 

and here the log from eclipse (because there is no error/crash log):

 

  Reveal hidden contents

 

Developer of Primeval Forest.

Posted

Ah.

 

I just went to look for the vanilla chest model - there isn't one.  It's drawn using a different rendertype so it has no blockmodel like most other blocks do.  The TileEntitySpecialRenderer renders it instead, so the lid animation can be done properly.

 

--> if you want a block texture for the chest you'll need to make them yourself.  You can find the texture sheet in

("textures/entity/chest/normal.png");

 

-TGG

 

 

 

 

  • 2 weeks later...
Posted

Sorry, that it took so long to reply here, but I had not much time.

 

So, my own block is rendered by the TileEntitySpecialRenderer, too:

 

 

  Reveal hidden contents

 

 

And there I put the texture path to the path of Minecraft. (I tried it with: "textures/entity/chest/normal.png" and with "minecraft:textures/entity/chest/normal.png".)

 

  • Block Texture: works
  • Container Texture: works
  • 3D-Inventory-Rendering: works
  • Block break particle: does not work

 

So any idea what to do to fix it, because I'm no longer really interested in updating my mod to 1.8.... (I have better stuff to do then that, stuff that makes more fun, like working on the Beta for 1.7.10 and on my own small Game)

Developer of Primeval Forest.

Posted

public class MyBlock extends BlockContainer {
  public MyBlock() {
    this.setTextureName("put something here");
  }
}

 

Block break particles are based off the BLOCK's texture.

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.

Posted
  On 1/31/2015 at 9:51 PM, Draco18s said:

public class MyBlock extends BlockContainer {
  public MyBlock() {
    this.setTextureName("put something here");
  }
}

 

Block break particles are based off the BLOCK's texture.

This is 1.8...

Maker of the Craft++ mod.

Posted

Oops, your right. I'm still pretty sure you need a block texture json to indicate the particle texture.

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.

Posted
  On 1/31/2015 at 7:24 PM, Bektor said:

Sorry, that it took so long to reply here, but I had not much time.

So any idea what to do to fix it, because I'm no longer really interested in updating my mod to 1.8.... (I have better stuff to do then that, stuff that makes more fun, like working on the Beta for 1.7.10 and on my own small Game)

Vanilla's chest gets the break texture through a filthy kludge

BlockModelShapes.getTexture(IBlockState state)
            if (block == Blocks.wall_sign || block == Blocks.standing_sign || block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.standing_banner || block == Blocks.wall_banner)
            {
                return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak");
            }
//.. etc...

 

You can't do that, so I think you need to make a block model for block/cube, give it a "particle": texture.  leave the other sides blank (create an empty texture for them). 

 

-TGG

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.