Jump to content

shane020482

Members
  • Posts

    72
  • Joined

  • Last visited

Posts posted by shane020482

  1. Ok i see what you mean in the model json

    //this
    	"textures": {
    		"0": "cbm:blocks/steel",
    		"1": "cbm:blocks/steel2",
    		"particle": "cbm:blocks/steel"
    	},
    //becomes this
    	"textures": {
    		"0": "#0",
    		"1": "#1"
    	},

    and in the blockstate you add this to default

    "textures": {
          "0": "cbm:blocks/steel",
          "1": "cbm:blocks/steel2",
          "particle": "cbm:blocks/steel"
        }

     

  2. Yea im just not that good ? maybe one day. And yes i agreed with your Easy Registry class tho i may not use it now i will be one of those things ill go back to time and again to see what you are doing and slowly learn to create my own Easy Registry. Thats how iv been learning start with a basic tutorial to learn the basics of a MC version then look at other mods that are doing what i want to do, find a method that i like and learn to create my own based off of it.

  3. 1. I never calmed it to be the best way or that it was correct just that it worked. ?

    2.I thought you meant writing the function per block, yes you do need the function in each base class but thats it.

    3.Just goes to show theirs more than one way to skin a cat.

    4.My old mod should shows i dont like copy past i like to explore and see what all is possible. Whether right or wrong i learn and that to me is the most important part .

    5.I think we should rename this thread to How many ways are there to Register Blocks 

  4. Its fine after sleeping on it i think im going to do it like i did in the past and register in the base class

    https://github.com/Shane2482/Deadly-World-1.10/blob/master/src/main/java/shane2482/deadlyworld/blocks/base/blockbase.java 

    that is if i can figure out how to do that in 1.12. And even if i dont use enums if i use Forge Blocktates ill still need to create blockstates for all of my blocks but i wont need the models.

  5. 1 minute ago, Draco18s said:

    You're just blindly copying things. That isn't going to DO anything by itself.

    The point was "you need to do these things <link to a function that does these things>" not "Copy-paste my code, cross your fingers, and run it."

     

    The one function that you didn't know what it did... all it does is what you were already doing.

    sry for not being clearer what i was trying to do was get the full code in one place so i could see what i needed to do to make this work for me and thats where i get lost. i myself dont like copy pasting i always modified to to fit my needs

  6. chasing things down and this is what iv got so far and im still lost. Im not a complete noob to java or MC code but i am self taught and this may just be outside my grasp

    public void _registerBlockWithCustomItem(Block block, ItemBlock iBlock, String registryname) 
    	{
    		StateMapperBase b = new DefaultStateMapper();
    		BlockStateContainer bsc = block.getBlockState();
    		ImmutableList<IBlockState> values = bsc.getValidStates();
    		for(IBlockState state : values) 
    		{
    			String str = b.getPropertyString(state.getProperties());
    			_registerBlockItemModelForMeta(block, block.getMetaFromState(state), str);
    		}
    	}
    	
    	
    	
    	
    	private void _registerBlockItemModelForMeta(Block block, int metadata, String variant) {
    		final Item item = blockItems.get(block);
    		if (item != null) {
    			_registerItemModelForMeta(item, metadata, variant);
    		}
    	}
    
    
    
    	private void _registerItemModelForMeta(Item item, int metadata, String variant) {
    		ModelResourceLocation res = new ModelResourceLocation(item.getRegistryName(), variant);
    		_registerItemModelForMeta(item, metadata, res);
    	}
    
    	private void _registerItemModelForMeta(Item item, int metadata, ModelResourceLocation modelResourceLocation) {
    		modelsToReg.add(new ModelRegistryObj(item, metadata, modelResourceLocation));
    	}
    
    	protected static class ModelRegistryObj {
    		final Item item;
    		final int meta;
    		final ModelResourceLocation resource;
    		
    		public ModelRegistryObj(Item i, int m, ModelResourceLocation loc) {
    			item = i;
    			meta = m;
    			resource = loc;
    		}
    	}

     

  7. 2 minutes ago, Cadiboo said:

    ... your still going to need the same amount of block state models

    have a look at BlockResourceBlock in my mod

    https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/block/BlockResourceBlock.java

    and how I have multiple variants with only one class

    https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/init/Blocks.java

    Yea i was afraid of that im already using that method for blocks that dont have variants. i was just hoping to use Forge Blockstate to cover block models item models and blockstates for up to 16 blocks with just one blockstate. But if i cant get Forge to work then i guess ill just have to suck it up.

    Thanks for the advice anyways 

  8. 3 minutes ago, Draco18s said:

    See this?

    
    new ModelResourceLocation(new ResourceLocation(Reference.MOD_ID, fileName), "inventory"));

     

    Make it this:

    
    new ModelResourceLocation(item.getRegistryName(), "inventory"));

    That only works with blocks that dont have meta and the method calls for block not item. And yes iv tried block.getRegistryName() it doesnt work ether. This method worked fine on older versions i just cant find what has changed. Even looking at the non meta block method the change was from itemstack to item so not a big change there.

  9. this is the code i used to get that error and iv tried several other naming methods as well

    
    	@SubscribeEvent
    	public static void registerRenders(ModelRegistryEvent event) 
    	{
    		registerRender(ItemBlockEnum.getItemFromBlock(block_steel));
    		for (int i = 0; i < metalType.values().length; i++) {
    	
    			registerRender(block_steel, i, "block_steel_" + metalType.values()[i].getName());
    			
    		}
    	}
    	
    	private static void registerRender(Block block, int meta, String fileName) {
    		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta,
    				new ModelResourceLocation(new ResourceLocation(Reference.MOD_ID, fileName), "inventory"));
    		
    	}

     

  10. 6 minutes ago, Draco18s said:

    Caused by: java.io.FileNotFoundException: cbm:models/item/block_steel_steel.json

    i thought the point of Forge Blockstate "inventory": [{}],  was to provide that info. And yes iv used it as well as removed it from my blockstate and it changes nothing.

  11. Thats what im doing for both blocks with and without meta

    public static void registerRender(Item item) 
    	{
    		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    	}
    
    	public static void registerRender(Block block, int meta, Item item) 
    	{
    		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    	}

     

  12. is there a reason that the following doesn't work for item blocks in 1.12 blocks show fine but item is a null model and texture

    {
        "forge_marker": 1,
        "defaults": {
            "transform": "forge:default-block",
            "model": "cube_all",
            "textures": {"all": "cbm:blocks/block_test"}
        },
        "variants": {
            "normal": [{}],
            "inventory": [{}]
        }
    }

     

×
×
  • Create New...

Important Information

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