Jump to content

Recommended Posts

Posted

Your block class must extend "BlockDirectional" as far as I can see from this point.

Between being a Gamer, a Furry, and a Modder who one day wants to go into Game Dev., time is an absolute waste. ~SirBassington

Posted

Show how you register your block and it's model and the full paths to your json files.

Here is how my blocks class :

package com.mateus.Morestuff.init;

import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockPotato;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

import com.mateus.Morestuff.blocks.AlfaceCrops;
import com.mateus.Morestuff.blocks.Cortador;
import com.mateus.Morestuff.blocks.Lampa;



public class MBlocks {

public static Block cortador;

public static void init() {
	cortador = new Cortador();
}

public static void register(){
	registerBlock(cortador);
}

private static void registerBlock(Block block){
	GameRegistry.register(block);
	ItemBlock item = new ItemBlock(block);
	item.setRegistryName(block.getRegistryName());
	GameRegistry.register(item);
}

public static void registerRenders(){
	registerRender(cortador);
}

public static void registerRender(Block block){
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}

}

And the place where i register the unlocalizedname and registryname :

public static enum MateusBlocks {
	CORTADOR("cortador", "Cortador");

	private String registryName;
	private String unlocalizedName;
	MateusBlocks(String unlocalizedName, String registryName) {
	this.unlocalizedName = unlocalizedName;
	this.registryName = registryName;
}
  
public String getUnlocalizedName() {
	return unlocalizedName;
}
public String getRegistryName() {
	return registryName;
}
}

The block model ? didnt i showed it ,

well here is itagain

{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "0": "modii:blocks/cortador",
        "1": "modii:blocks/cortador_lado"
    },
    "display": {
        "gui": {
            "rotation": [ 30, 225, 0 ],
            "translation": [ 0, 0, 0],
            "scale":[ 0.625, 0.625, 0.625 ]
        },
        "ground": {
            "rotation": [ 0, 0, 0 ],
            "translation": [ 0, 3, 0],
            "scale":[ 0.25, 0.25, 0.25 ]
        },
        "fixed": {
            "rotation": [ 0, 0, 0 ],
            "translation": [ 0, 0, 0],
            "scale":[ 0.5, 0.5, 0.5 ]
        },
        "thirdperson_righthand": {
            "rotation": [ 75, 45, 0 ],
            "translation": [ 0, 2.5, 0],
            "scale": [ 0.375, 0.375, 0.375 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, 45, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 0.40, 0.40, 0.40 ]
        },
        "firstperson_lefthand": {
            "rotation": [ 0, 225, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 0.40, 0.40, 0.40 ]
        }
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 0.0, 0.0, 0.0 ], 
            "to": [ 16.0, 16.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "west": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }
            }
        }
    ]
}

my model location :

assets/modii/models/block/cortador.json

my blockstate location :

assets/modii/blockstates/Cortador.json

Posted

BlockState

{
    "parent": "block/orientable",
    "textures": {
        "top": "modii:blocks/cortador_lado",
        "side": "modii:blocks/cortador_lado",
        "front": "modii:blocks/cortador"
    }
}

Class

package com.mateus.Morestuff.blocks;

import javax.annotation.Nullable;

import com.google.common.base.Predicate;
import com.mateus.Morestuff.IdDoMod;
import com.mateus.Morestuff.init.MTabs;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class Cortador extends Block {

public Cortador() {
	super(Material.ANVIL);
	setUnlocalizedName(IdDoMod.MateusBlocks.CORTADOR.getUnlocalizedName());
	setRegistryName(IdDoMod.MateusBlocks.CORTADOR.getRegistryName());
	setCreativeTab(MTabs.tabMateus);
}
}

Posted

That's a model file, not a blockstates file.

Oh sorry  :-[ they have almost the same names so i messed it up

but here it is

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

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.