Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] Unsewing Workbench - problem with block texturing/recipe


WickedWilliWonka
 Share

Recommended Posts

Greetings!

I'm pretty new to Java and therefore modding with Forge. Although I have some coding experience I'm currently running into some issues I haven't been able to fix yet. I consulted the search and the docs. Before I start, let me give you a quick overview of what I'm trying to achieve with my mod.

Goal

  • The mod adds an unsewing workbench into the game where the player puts in any leather armor item and receives back around 1/2 of leather that has been used for crafting same item
  • Instead of having players need to install the mod locally, I'd like to make it run on my server and provide it to all players 


Issues

  • The blockitem renders with the correct textures, but the block itself only renders with the default minecraft texture (added screenshot below)
  • The recipe does not work

 


My code so far, concerning the texture issue

assets/unsewmod/blockstates/unsew_block.json
 

{
  "forge_marker": 1,
  "defaults": {
 	    "textures": {
	      "up": "unsewmod:block/unsew_block_up",
	      "down": "unsewmod:block/unsew_block_down",
	      "east": "unsewmod:block/unsew_block_east",
	      "west": "unsewmod:block/unsew_block_west",
	      "north": "unsewmod:block/unsew_block_north",
	      "south": "unsewmod:block/unsew_block_south"
	    },
	    "model": "block/cube",
	    "uvlock": false
  }
  "variants": {[]}
}


assets/unsewmod/models/block/unsew_block.json
 

{
    "parent": "block/cube",
    "textures": {
            "up": "unsewmod:block/unsew_block_up",
	    "down": "unsewmod:block/unsew_block_down",
	    "east": "unsewmod:block/unsew_block_east",
	    "west": "unsewmod:block/unsew_block_west",
	    "north": "unsewmod:block/unsew_block_north",
	    "south": "unsewmod:block/unsew_block_south"    
    }
}


assets/unsewmod/models/item/unsew_block.json
 

{
    "parent": "unsewmod:block/unsew_block"
}

I've been consulting the docs about this but somehow I'm doing something wrong, although inheriting from block:cube should do the trick as I understand. I also added a variant instead of a default, but I cannot make minecraft load my textures for the block. The item somehow knows what textures to load, but I don't get it why the block does not.


My code so far, concerning the recipe issue


assets/unsewmod/recipes/unsew_block.json
 

{
	"type": "minecraft:crafting_shaped",
	"pattern": [
		"X#X",
		"XXX",
		"XXX"
	],
	"key": {
		"#": {
			"item": "minecraft:shears"
			},
		"X": [
                {
                  "item": "minecraft:planks",
                  "data": 0
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 1
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 2
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 3
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 4
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 5
                  }
		]
	},
	"result": {
		"item": "unsewmod:unsew_block",
		"count": 1
	}
}

I tried several stuff here, instead of using data I tried minecraft:acacia_wood_planks etc, but I get the impression that somehow my recipe isn't being loaded automatically although it should as stated in the docs? I get no error messages in Eclipse's console, only this: [minecraft/RecipeManager]: Loaded 6 recipes

Just for completion, here's my classes

UnsewMod.java

 

package wickedsmods.unsewmod;

import net.minecraftforge.fml.common.Mod;

@Mod(value = UnsewMod.MODID)
public class UnsewMod {
	
	public static final String MODID = "unsewmod";

}

ModBlocks.java
 

package wickedsmods.unsewmod;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;

@Mod.EventBusSubscriber(modid = UnsewMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@ObjectHolder(UnsewMod.MODID)
public class ModBlocks {

    public static final Block unsew_block = null;
    
    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event) {
        event.getRegistry().registerAll(

            new Block(Block.Properties.create(Material.WOOD).hardnessAndResistance(1).harvestLevel(1).harvestTool(ToolType.AXE)).setRegistryName(UnsewMod.MODID, "unsew_block")

        );
    }
    
}

ModItems.java
 

package wickedsmods.unsewmod;

import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;

@Mod.EventBusSubscriber(modid = UnsewMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@ObjectHolder(UnsewMod.MODID)
public class ModItems {

    //public static final Item unsew_item = null;

    @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().registerAll(

            //new Item(new Item.Properties()).setRegistryName(UnsewMod.MODID, "unsew_item"),
            new BlockItem(ModBlocks.unsew_block, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(ModBlocks.unsew_block.getRegistryName())

        );
    }

}


Thank you very much for reading all through this. In case I left something important out, please let me know. If you have any link for more detailed docs, please post them. I know that 1.14.4 is still beta and therefore buggy and subject to changes.




 

2019-09-10_11.47.19.png

Edited by WickedWilliWonka
typo
Link to comment
Share on other sites

5 hours ago, diesieben07 said:

Adding new blocks to the game requires the mod to be installed on client and server. There is no way around this.

Thanks.

I've managed to fix the texture issue, the json was malformed. I also put way too much stuff into it. It now looks like this.

assets/unsewmod/blockstates/unsew_block.json
 

{
	"variants": {
		"": {
			"model": "unsewmod:block/unsew_block"
		}
	}
}

I still haven't fixed the recipe issue. I've checked that json as well, but it is valid.

 

Any ideas?
 

Link to comment
Share on other sites

It might be valid JSON, but this is not a valid recipe ingredient:

           "X": [
                  {
                  "item": "minecraft:planks",
                  "data": 0
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 1
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 2
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 3
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 4
                  },
                  {
                  "item": "minecraft:planks",
                  "data": 5
                  }
		]

1) metadata doesn't exist any more

2) you have specified an array of 6 items instead of a single object

Edited by Draco18s

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.

Link to comment
Share on other sites

9 hours ago, WickedWilliWonka said:

assets/unsewmod/recipes/unsew_block.json

This is not the appropriate location for recipes anymore. They go in data/modid/recipe.json

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

17 hours ago, Draco18s said:

 

1) metadata doesn't exist any more

2) you have specified an array of 6 items instead of a single object

I removed the metadata but kept the array as I want any kind of planks work for the recipe. Or is there some sort of wildcard?
 

16 hours ago, Animefan8888 said:

This is not the appropriate location for recipes anymore. They go in data/modid/recipe.json

Thanks, with that additional info I got the recipe working now.

Link to comment
Share on other sites

1 hour ago, WickedWilliWonka said:

as I want any kind of planks work for the recipe

Its called tags. You want it to be usable with any plank, including mod added planks, use tags. That's why tags exist.

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.

Link to comment
Share on other sites

59 minutes ago, Draco18s said:

Its called tags. You want it to be usable with any plank, including mod added planks, use tags. That's why tags exist.

Thanks, tags are pretty useful. Now here's the final recipe:
 

{
	"type": "minecraft:crafting_shaped",
	"pattern": [
		"aba",
		"dcd",
		"eee"
	],
	"key": {
		"a": {
			"item": "minecraft:iron_ingot"
		},
		"b": {
			"item": "minecraft:shears"
		},
		"c": {
			"item": "minecraft:redstone"
		},
		"d": {
			"tag": "minecraft:planks"
		},
		"e":  {
			"tag": "minecraft:logs"
		}
	},
	"result": {
		"item": "unsewmod:unsew_block",
		"count": 1
	}
}

 

Link to comment
Share on other sites

There's also tags for ingots, but I don't think modders really create new iron ingots. Also, I generally make my recipes use letters that are somewhat identifiable to what the item is.

So instead of "aba" I'd do "iSi" (ingot, shears, ingot; no special meaning between lower and upper case here). But that's purely cosmetic.

Edited by Draco18s

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.

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.