• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello, I'm back with another recipe and data gen problem, so basically I have a hammer item, and 2 ingots, they turn into plates (of their type), I've done that all ready and it works fine, now my problem is that the hammer doesn't seem to get damaged (because I got no idea how), here's my code : HammerItem: (just incase I've done something wrong here!) public class HammerItem extends Item { private static final Random RAND = new Random(); public HammerItem() { super(new Item.Properties() .group(MorePlates.ITEMGROUP) .maxStackSize(1) .setNoRepair()); } @Override public boolean hasContainerItem(ItemStack stack) { return true; } @Override public int getMaxDamage(ItemStack stack) { return Config.GENERAL.DURABILITY_HAMMER.get(); } @Override public int getDamage(ItemStack stack) { return !stack.hasTag() ? getMaxDamage(stack) : stack.getOrCreateTag().getInt("Damage"); } @Nonnull @Override public ItemStack getContainerItem(@Nonnull ItemStack stack) { ItemStack container = stack.copy(); if(container.attemptDamageItem(1, RAND, null)) { return ItemStack.EMPTY; } else { return container; } } @Override public boolean isEnchantable(@Nonnull ItemStack stack) { return true; } @Override public int getItemEnchantability() { return 14; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return enchantment == Enchantments.UNBREAKING || enchantment == Enchantments.MENDING; } }   And here's my recipe bit Item PLATE = ForgeRegistries.ITEMS.getValue(new ResourceLocation(MorePlates.MODID, material.toString() + "_plate")); Ingredient INGOT = Ingredient.fromTag(ItemTags.createOptional(material.getTag())); ConditionalRecipe.builder() .addCondition( and( new BooleanCondition(() -> Config.GENERAL.PLATE_RECIPES.get(), BooleanCondition.Type.ENABLE_PLATE.get()), itemExists(MorePlates.MODID, material.toString() + "_plate") ) ) .addRecipe( ShapedRecipeBuilder.shapedRecipe(PLATE) .patternLine("H") .patternLine("I") .patternLine("I") .key('H', ForgeRegistries.ITEMS.getValue(new ResourceLocation(MorePlates.MODID, "hammer"))) .key('I', INGOT) .setGroup("") .addCriterion("has_item", hasItem(ForgeRegistries.ITEMS.getValue(new ResourceLocation(MorePlates.MODID, "hammer")))) ::build ) .build(consumer, new ResourceLocation(MorePlates.MODID, material.toString() + "_plate")); Thanks in regards!
    • Of course that won't work, since ifPresent() returns void. Why not put all code that needs access to your capability in the consumer in ifPresent()?   Basic Java stuff like this is best to know before going into modding, which is why I would strongly encourage you to take a few weeks off modding and take that time to learn the basics of Java. 
    • bumb   If nobody can tell my how to connect to a server, then forge is dead to me.
    • It hasn't been solved! As noone answered I abandoned the project hahhah, but now that you have the same issue we can maybe get someone to help us! 
  • Topics

  • Who's Online (See full list)