Jump to content

IForge Registry Entry


SUPERFREEK

Recommended Posts

Hello. I'm currently trying to import the music disc pigstep into the minecraft 1.12.2 version. But in the line:

event.getRegistry().registerAll((IForgeRegistryEntry).new Item[]{ (Item)(discPigstep = new ItemDiscPigstep("pigstep")) });

it keeps saying me two things:

1. When I hover above the IForgeRegistryEntry it says: Expression expected

2. When I hover above                 new Item[] { (Item)(discPigstep = new ItemDiscPigstep("pigstep")) });           it says                Inconvertible types; cannot cast 'net.minecraft.item.Item[]' to 'net.minecraftforge.registries.IForgeRegistryEntry'.

 

Can anybody help me please?

 

Here's the full code of that class:::

 

 

package com.superfreek.pigstep.common.items;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistryEntry;

@EventBusSubscriber
public class ItemHandler {
    public static ItemDiscPigstep discPigstep;

    @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().registerAll((IForgeRegistryEntry)new Item[] { (Item)(discPigstep = new ItemDiscPigstep("pigstep")) });
    }

    @SubscribeEvent
    public static void registerRender(ModelRegistryEvent event) {
        ModelLoader.setCustomModelResourceLocation((Item)discPigstep, 0, new ModelResourceLocation(discPigstep.getRegistryName(), "inventory"));
    }
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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