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

Minecraft 1.17 Spawn Egg Problem

Jeremy Quann

Recommended Posts

Whenever I installed my very first 1.17 mod.

The spawning of the entity as well as it's spawn egg didn't show up.

Here's the code to explain why:

package com.gohkenytp.coyote.common.items;

import java.util.*;

import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.core.BlockSource;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.Direction;
import net.minecraftforge.common.util.Lazy;
import net.minecraftforge.common.util.NonNullSupplier;

import net.minecraft.world.entity.EntityType;

import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
import net.minecraftforge.fmllegacy.RegistryObject;

public class CoyoteEgg extends SpawnEggItem {

    protected static final List<CoyoteEgg> UNADDED_EGGS = new ArrayList<CoyoteEgg>();
    private final Lazy<? extends EntityType<?>> entityTypeSupplier;

    public CoyoteEgg(final NonNullSupplier<? extends EntityType<?>> entityTypeSupplier, final int primaryColour,
                      final int secondaryColour, final Item.Properties properties) {
        super(null, primaryColour, secondaryColour, properties);
        this.entityTypeSupplier = Lazy.of(entityTypeSupplier::get);

    public CoyoteEgg(final RegistryObject<? extends EntityType<?>> entityTypeSupplier, final int primaryColour,
                      final int secondaryColour, final Item.Properties properties) {
        super(null, primaryColour, secondaryColour, properties);
        this.entityTypeSupplier = Lazy.of(entityTypeSupplier::get);

    public static void regSpawnEggs() {
        final Map<EntityType<?>, SpawnEggItem> EGGS = ObfuscationReflectionHelper.getPrivateValue(SpawnEggItem.class,
                null, "field_195987_b");
        DefaultDispenseItemBehavior dispenseBehaviour = new DefaultDispenseItemBehavior() {
            protected ItemStack execute(BlockSource source, ItemStack stack) {
                Direction direction = source.getBlockState().getValue(DispenserBlock.FACING);
                EntityType<?> type = ((SpawnEggItem) stack.getItem()).getType(stack.getTag());
                type.spawn(source.getLevel(), stack, null, source.getPos().relative(direction),
                        MobSpawnType.DISPENSER, direction != Direction.UP, false);
                return stack;

        for (final SpawnEggItem spawnEgg : UNADDED_EGGS) {
            EGGS.put(spawnEgg.getType(null), spawnEgg);
            DispenserBlock.registerBehavior(spawnEgg, dispenseBehaviour);

    public EntityType<?> getType(CompoundTag nbt) {
        return this.entityTypeSupplier.get();



Link to comment
Share on other sites

I got the SpawnEgg set already and I figured it out. Until I came across this:

Type parameter 'com.gohkenytp.coyote.common.entities.CoyoteEntity' is not within its bound; should extend 'net.minecraft.world.entity.animal.Wolf'

I need help with this immediately!

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.

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.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I don't know what you used to post the log here, but next time please upload the log to a paste site, this is horrible to look at with all the formatting removed One of your server configs is failing to load properly, if you have not modified it delete ironfurnaces-server.toml
    • Did you download the server-specific files for the pack or did you copy the mods from the client and hope?
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • [18:32:34] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Configuration file .\saves\New World (2)\serverconfig\forge-server.toml is not correct. Correcting [18:32:34] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key server was corrected from null to its default, SimpleCommentedConfig:{   Using that code and before I get that. And my mob still don't work.
    • Hey, I'm new to the forge data generators and was trying to get them up and running. At the moments they aren't crashing or anything but they also don't seem to be generating any data, as far as I can tell they're set up correctly and I've tried both runClient and runData and as far as I can tell they neither loaded the models correctly into the game nor output them in any files I can see. I have no real idea what I'm doing though. so I have my main data generator class that looks a bit like this: @Mod.EventBusSubscriber(modid = GaiaTerrainMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class GaiaDataManager { @SubscribeEvent public static void gatherData(final GatherDataEvent event) { GaiaTerrainMod.LOGGER.info("gathering data!"); DataGenerator generate = event.getGenerator(); ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); generate.addProvider(new GaiaBlockStateGenerator(generate,existingFileHelper)); generate.addProvider(new GaiaItemModelGenerator(generate, existingFileHelper)); GaiaBlockTagGenerator blockTags = new GaiaBlockTagGenerator(generate, existingFileHelper); generate.addProvider(blockTags); generate.addProvider(new GaiaItemTagGenerator(generate, blockTags, existingFileHelper)); generate.addProvider(new GaiaLootTableGenerator(generate)); generate.addProvider(new GaiaRecipeGenerator(generate)); GaiaTerrainMod.LOGGER.info("gathered data!"); } } originally it didn't have the "@Mod.EventBusSubscriber(modid = GaiaTerrainM..." line at the top and instead was only invoked through a line in the GaiaTerrainMod constructor that looked like this: public GaiaTerrainMod() { IEventBus registry_bus = FMLJavaModLoadingContext.get().getModEventBus(); registry_bus.addListener(this::setup); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(GaiaDataManager.class); ModWoodTypes.init(); ModBlocks.BLOCKS.register(registry_bus); ModItems.ITEMS.register(registry_bus); GaiaBiomeSelector.initBiomeMappings(); } as you can see at the start and end of my gatherData function I have logs and when I hit "runData" they fired and I could see them as the last 2 things outputted by the console, however in GaiaBlockStateGenerator, the first data provider added to my data generator, I also put 2 logs at the start and end of the overriden registerStatesAndModels() function. These never fired, I assume they should after my gatherData logs fired. Not sure though, as far as i can tell the issue should be somewhere in these files (unless it's somewhere weird), again I'm not getting any crashes or errors just a plain old, doesn't do the thing I want it to which clearly indicates I've done something dumb somewhere.
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

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