#at different raw IDs (1284, 1285)
19 messages · Page 1 of 1 (latest)
You registered two items (or the same item twice) with the same id. Also, don't use minecraft as your namespace
i didn't tho????
Show your registering code
for items or blocks?
or do you mean this?
package powers.superpowers;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import powers.superpowers.block.ModBlocks;
import powers.superpowers.block.entity.ModBlockEntities;
import powers.superpowers.item.ModItemGroups;
import powers.superpowers.item.ModItems;
import powers.superpowers.screen.ModScreenHandlers;
public class Superpowers implements ModInitializer {
public static final String MOD_ID = "superpowers";
public static final Logger LOGGER = LoggerFactory.getLogger("MOD_ID");
@Override
public void onInitialize() {
ModItemGroups.registerItemGroups();
ModItems.registerModItems();
ModBlocks.registerModBlocks();
ModBlockEntities.registerBlockEntities();
ModScreenHandlers.registerScreenHandlers();
}
}
or this?
package powers.superpowers.item;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import powers.superpowers.Superpowers;
import net.minecraft.item.Item;
import net.minecraft.registry.Registry;
public class ModItems {
public static final Item HEART = registerItem("heart", new Item(new FabricItemSettings()));
public static final Item MOLTEN = registerItem("molten", new Item(new FabricItemSettings()));
public static final Item COMPRESSED = registerItem("compressed", new Item(new FabricItemSettings()));
public static final Item BROKENMOLTEN = registerItem("brokenmolten", new Item(new FabricItemSettings()));
public static final Item SILENCE_ITEM = registerItem("silence_item", new Item(new FabricItemSettings()));
private static void addItemsToIngredientTabItemGroup(FabricItemGroupEntries entries) {
entries.add(HEART);
}
private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, new Identifier(Superpowers.MOD_ID, name), item);
}
public static void registerModItems() {
Superpowers.LOGGER.info("Registering Mod items for " + Superpowers.MOD_ID);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(ModItems::addItemsToIngredientTabItemGroup);
}
}
- this
package powers.superpowers.item;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import powers.superpowers.Superpowers;
import net.minecraft.registry.Registries;
import powers.superpowers.block.ModBlocks;
public class ModItemGroups {
public static final ItemGroup HEART_GROUP = Registry.register(Registries.ITEM_GROUP,
new Identifier(Superpowers.MOD_ID, "heart"),
FabricItemGroup.builder().displayName(Text.translatable("itemgroup.heart"))
.icon(() -> new ItemStack(ModItems.HEART)).entries((displayContext, entries) -> {
entries.add(ModItems.HEART);
entries.add(ModItems.MOLTEN);
entries.add(ModBlocks.RESEARCH_TABLE);
entries.add(ModItems.COMPRESSED);
entries.add(ModBlocks.SILENCE_ORE);
entries.add(ModItems.SILENCE_ITEM);
}).build());
public static void registerItemGroups() {
Superpowers.LOGGER.info("Registering Item Groups for " + Superpowers.MOD_ID);
}
}
hello?
This seems correct. The error seems to point towards new Identifier(Superpowers.MOD_ID, name) having been wrong before
HUH?
It created ids in the form of minecraft:superpowers, which shouldn't happen. It should be superpowers:<item>
But the code you posted seems correct
maybe its the block code then because it states
package powers.superpowers.block;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import powers.superpowers.Superpowers;
public class ModBlocks {
public static final Block RESEARCH_TABLE = registerBlock("research_table",
new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.ANVIL)));
public static final Block SILENCE_ORE = registerBlock("silence_ore",
new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.OBSIDIAN), UniformIntProvider.create(2, 5)));
public static final Block SILENCE_BLOCK = registerBlock("silence_block",
new Block(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).sounds(BlockSoundGroup.METAL)));
private static Block registerBlock(String name, Block block) {
registerBlockItem(name, block);
return Registry.register(Registries.BLOCK, new Identifier(Superpowers.MOD_ID, name), block);
}
private static void registerBlockItem(String name, Block block) {
Registry.register(Registries.ITEM, new Identifier(Superpowers.MOD_ID),
new BlockItem(block, new FabricItemSettings()));
}
public static void registerModBlocks() {
Superpowers.LOGGER.info("Registering ModBlocks for " + Superpowers.MOD_ID);
}
}