Jump to content

Recommended Posts

Posted (edited)

It was a bit hard to explain in the title but basically i wanted to add a recipe for a spawn egg for one of my mod's mobs, so i created a class that extended ItemMonsterPlacer. The custom spawn egg does appear in game and it does spawn my mob successfully, the issue im having is that it created a spawn egg with my texture and name added on to vanilla mobs. So under all the vanilla eggs would be a copy of all the vanilla eggs with the name "Fame Minion Blaze" for example, and those egg copies will spawn the mob that they are copied from, so the egg in the above mentioned example would spawn a blaze, its just that the name and texture of the egg are wrong. So my question is, is there something in ItemMonsterPlacer that i need to Override to get this to stop? Or am i possibly messing something else up. Now go easy on me, its been many years since ive tried to mod and ive never tried to do this in particular before, that being said, im also an idiot.

 

My custom spawn egg class: 

Spoiler

package com.varitekcibus.amazingfoodstuffs.objects.items;

import com.varitekcibus.amazingfoodstuffs.AmazingFoodStuffs;
import com.varitekcibus.amazingfoodstuffs.init.ItemInit;
import com.varitekcibus.amazingfoodstuffs.util.interfaces.IHasModel;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemMonsterPlacer;

public class ItemMobPlacers extends ItemMonsterPlacer implements IHasModel

{

    public ItemMobPlacers(String name, int id) 
    
    {
        
        setUnlocalizedName(name);
        setRegistryName(name);
        setCreativeTab(CreativeTabs.MISC);
        
        ItemInit.ITEMS.add(this);
        
    }
    
    @Override
    public void registerModels() 
    
    {
        
        AmazingFoodStuffs.proxy.registerItemRenderer(this,  0,  "inventory");
        
    }
    
    
    
    
}
 

Within my item initialization class, this is the entry for this item:

Spoiler

public static final Item FAME_MINION_EGG = new ItemMobPlacers("fame_minion_egg", Reference.ENTITY_FAME_MINION);

So if someone could tell me the stupid thing im doing, that would be great. Thanks.

 

P.S. Heres a pic of what it looks like in game for more reference.

eggs.png

Edited by VaritekCibus
Posted (edited)

could you post your itemInit class?

 

I believe that there is also a way to register your egg at the same time as registering your entity which could eliminate the problem

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
5 hours ago, diesieben07 said:

Why are you creating a custom spawn egg? Just use the one vanilla adds.

Well im trying to create a craftable egg, i figured i would need to create a new item that functioned as a "spawn egg" in order to give it a recipe. I might have been wrong in that assumption, vanilla doesnt have a precedent for creating craftable eggs so i wasnt sure exactly how that would be done.

 

9 hours ago, Cadiboo said:

could you post your itemInit class?

 

I believe that there is also a way to register your egg at the same time as registering your entity which could eliminate the problem

The whole ItemInit class is like 300 lines due to the amount of items in my mod, so in the interest of space, this is the structure:

Spoiler

package com.varitekcibus.amazingfoodstuffs.init;

import java.util.ArrayList;
import java.util.List;

import com.varitekcibus.amazingfoodstuffs.Reference;
import com.varitekcibus.amazingfoodstuffs.objects.food.ItemFoodBase;
import com.varitekcibus.amazingfoodstuffs.objects.items.ItemBase;
import com.varitekcibus.amazingfoodstuffs.objects.items.ItemMobPlacers;
import com.varitekcibus.amazingfoodstuffs.objects.tools.ToolBase;

import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemFood;
import net.minecraftforge.common.util.EnumHelper;

public class ItemInit {
    
    public static final List<Item> ITEMS = new ArrayList<Item>();

 

}

Then within that i register all the items with the same format as the example i gave in the first post.

Posted (edited)
49 minutes ago, diesieben07 said:

You can add a crafting recipe for a normal spawn egg just fine. You do not need to make your own item.

Hm, ok ignore my last reply, i guess i did assume incorrectly. Thank you.

Edit: it did indeed work, im mad at myself for not thinking of the nbt from the start. Thank you though diesieben.

Edited by VaritekCibus

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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