Jump to content

Recommended Posts

Posted

So i made a .json file for a block from my cray fish model creator and well I ran into a problem

I was trying to make a lantern and all the textures render correctly but this is what happened :

 

https://www.dropbox.com/s/8eiit310q9488x6/Screen%20Shot%202017-01-03%20at%2019.11.59.png?dl=0

https://www.dropbox.com/s/xo0gx3mdvklshce/Screen%20Shot%202017-01-03%20at%2019.12.16.png?dl=0

https://www.dropbox.com/s/jykpge0ftvb3zun/Screen%20Shot%202017-01-03%20at%2019.12.37.png?dl=0

 

Here is the .json file code, I put the .json file in the models/block folder

{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "0": "blocks/log_oak",
        "1": "blocks/cobblestone",
        "2": "blocks/nether_brick"
    },
    "elements": [
        {
            "name": "Wood",
            "from": [ 5.0, 15.0, 4.0 ], 
            "to": [ 12.0, 16.0, 12.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 8.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 8.0 ] }
            }
        },
        {
            "name": "Wood1",
            "from": [ 6.0, 13.0, 7.0 ], 
            "to": [ 7.0, 15.0, 9.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] }
            }
        },
        {
            "name": "Wood2",
            "from": [ 10.0, 13.0, 7.0 ], 
            "to": [ 11.0, 15.0, 9.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] }
            }
        },
        {
            "name": "Wood3",
            "from": [ 6.0, 12.0, 7.0 ], 
            "to": [ 11.0, 13.0, 9.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 2.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 2.0 ] }
            }
        },
        {
            "name": "Stone1",
            "from": [ 8.0, 13.0, 3.0 ], 
            "to": [ 9.0, 14.0, 13.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 10.0 ] }
            }
        },
        {
            "name": "Stone2",
            "from": [ 8.0, 11.0, 3.0 ], 
            "to": [ 9.0, 13.0, 4.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Stone3",
            "from": [ 8.0, 11.0, 12.0 ], 
            "to": [ 9.0, 13.0, 13.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Nether1",
            "from": [ 1.0, 10.0, 1.0 ], 
            "to": [ 15.0, 11.0, 15.0 ], 
            "faces": {
                "north": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "east": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "south": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "west": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "up": { "texture": "#2", "uv": [ 1.0, 1.0, 14.0, 14.0 ] },
                "down": { "texture": "#2", "uv": [ 1.0, 1.0, 14.0, 14.0 ] }
            }
        },
        {
            "name": "StoneStand1",
            "from": [ 2.0, 1.0, 2.0 ], 
            "to": [ 4.0, 10.0, 4.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        },
        {
            "name": "Nether2",
            "from": [ 1.0, 0.0, 1.0 ], 
            "to": [ 15.0, 1.0, 15.0 ], 
            "faces": {
                "north": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "east": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "south": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "west": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
                "up": { "texture": "#2", "uv": [ 1.0, 1.0, 14.0, 14.0 ] },
                "down": { "texture": "#2", "uv": [ 1.0, 1.0, 14.0, 14.0 ] }
            }
        },
        {
            "name": "StoneStand2",
            "from": [ 2.0, 1.0, 12.0 ], 
            "to": [ 4.0, 10.0, 14.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        },
        {
            "name": "StoneStand3",
            "from": [ 12.0, 1.0, 12.0 ], 
            "to": [ 14.0, 10.0, 14.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        },
        {
            "name": "StoneStand4",
            "from": [ 12.0, 1.0, 2.0 ], 
            "to": [ 14.0, 10.0, 4.0 ], 
            "faces": {
                "north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 9.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        }
    ]
}

 

This is the item class

 

package notlukas.mod.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import notlukas.mod.ref;

public class blockHeartLantern extends Block {

public blockHeartLantern(String unlocalizedName, String registryName) {
	super(Material.ROCK);
	this.setUnlocalizedName(unlocalizedName);
	this.setRegistryName(new ResourceLocation(ref.MODID, registryName));
	this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	this.setLightLevel(10.0F);
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	return Item.getItemFromBlock(this);


}

}

Posted

Do you know what overriding a method means in Java? The class

Block

contains two methods, named

isFullCube

and

isOpaqueCube

. In your subclass, you need to override those methods. Both return a boolean and take an

IBlockState

as a parameter. All you need the methods to do is return false.

Posted

Hi, so i've done the piece of code and it works, the X-ray thing isn't there anymore

Although every time I break it the purple and black particles come out? is there a way to change this?

Posted

Yep, you just need to set the particle texture in your model file. In the textures section, add a line

"particle": "[texture]",

and replace [texture] with the path to the texture you want the particles to have.

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.