Jump to content

[1.16.5] Unable to summon custom entity


Avien

Recommended Posts

I'm having trouble making my entity be summoned and can't find a solution. It's based off of a normal Silverfish with the render of it using the code of the original to have the same look. 

MobEntity
https://pastebin.com/34LqbRFQ

MobRegistration

https://pastebin.com/RrdMBs0s

MobRenderer

https://pastebin.com/en6h49wT

MobModel

https://pastebin.com/KwAM6kmr

Error Log

https://pastebin.com/hF25X9pH

 

I appreciate any help I can get on this.

Link to comment
Share on other sites

Thank you for the help. I ended up adding it, but I'm still tinkering with it trying to make it work. I think the problem now relies in my MobRegistration. Here are also the new updated files.

Main

https://pastebin.com/U4D0XhEK

MobEntity

https://pastebin.com/KYV5fb5f

MobRegistration

https://pastebin.com/Rb44ZRdg

New Log Error (just in case)

https://pastebin.com/f8yRiyC7

 

If I end up finding a solution on my own then I will add a new reply and leave the code up for anyone else with the same problem.

Link to comment
Share on other sites

I understand about half of what you said. I'm guessing you mean since it's a void and not being called anywhere, that it won't do anything.  I'm trying to figure out where to call back to it in the Mob Registry so that it uses the attributes. I just don't know how to rewrite my Registry for it to work.

Link to comment
Share on other sites

Ok, so I added this to it. I'm unsure as to how to remove the static, unless you mean just remove the word static from the EntityAttributeCreationEvent.

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)

 

    @SubscribeEvent
    public static void entityAttributeCreationEvent(EntityAttributeCreationEvent event) {
    	LOGGER.info("Entity Attribute Event");
		event.put(WeirdMobEntity.TYPE, WeirdMobEntity.MAP);
	}

 

Link to comment
Share on other sites

Yes, I am new to this language I have a lot to learn and I'm willing to. I just can't learn through being told something I need examples, that's how my brain works. Anyway alright I'll just go and figure out how static works.

Link to comment
Share on other sites

2 hours ago, Avien said:

 


    @SubscribeEvent
    public static <---- void entityAttributeCreationEvent(EntityAttributeCreationEvent event) {
    	LOGGER.info("Entity Attribute Event");
		event.put(WeirdMobEntity.TYPE, WeirdMobEntity.MAP);
	}

 

Just remove the static modifier : p to make the method non-staticc

Link to comment
Share on other sites

Thank you. I've made the change and got rid of the @Mod.EventBusSubscriber at the top. As for adding it to the event bus I think its this section.

public CrystalMain() {
    	IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        MobRegistration.ENTITIES.register(bus);

        MinecraftForge.EVENT_BUS.register(this);
        
    }

So I tried adding this in it.

    public CrystalMain() {
    	IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        MobRegistration.ENTITIES.register(bus);

        MinecraftForge.EVENT_BUS.register(this);
        
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::entityAttributeCreationEvent); //This Part
    }

But I still am unable to summon it.

Error Log

https://pastebin.com/dtprYkG5

Link to comment
Share on other sites

I don't think it is being called. Here's everything I have so far.

Main

public class CrystalMain
{
    public static final Logger LOGGER = LogManager.getLogger();
    public static final String Mod_ID = "crystalcodex";
    public static final ItemGroup CRYSTAL_GROUP = new CrystalGroup("crystaltab");

    public CrystalMain() {
    	IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        MobRegistration.ENTITIES.register(bus);

        MinecraftForge.EVENT_BUS.register(this);
        
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::entityAttributeCreationEvent);
    }

    @SubscribeEvent
    public void entityAttributeCreationEvent(EntityAttributeCreationEvent event) {
    	LOGGER.info("Entity Attribute Event");
		event.put(WeirdMobEntity.TYPE, WeirdMobEntity.MAP);
	}

Mob Registration

public class MobRegistration {
	
	 public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, CrystalMain.Mod_ID);

	    public static final RegistryObject<EntityType<WeirdMobEntity>> WEIRD_MOB =
	            ENTITIES.register("weirdmobentity", () -> EntityType.Builder
	                    .<WeirdMobEntity>of(WeirdMobEntity::new, EntityClassification
	                    .CREATURE)
	                    .sized(0.9f, 0.9f )
	                    .build("weirdmobentity"));
}

Mob Entity

public class WeirdMobEntity  extends MonsterEntity{

	public static final String REG = "weirdmobentity";
	public static final EntityType<WeirdMobEntity> TYPE = EntityType.Builder.<WeirdMobEntity>of(WeirdMobEntity::new, EntityClassification.MISC)
			.sized(0.98F, 0.7F)
			.clientTrackingRange(8)
			.build(REG);
	public static final AttributeModifierMap MAP = AttributeModifierMap.builder().add(Attributes.MAX_HEALTH, 20.0)
			.add(Attributes.MOVEMENT_SPEED, 20.0)
			.add(Attributes.FOLLOW_RANGE, 20.0)
			.build();
	
	public WeirdMobEntity(EntityType<? extends MonsterEntity> type, World worldIn) {
        super(type, worldIn);
    }
}

 

Link to comment
Share on other sites

Ok, so I fixed the event handler problem. I'm going to see what I can do for the Entity type to fix it.

Main

public class CrystalMain
{
    public static final Logger LOGGER = LogManager.getLogger();
    public static final String Mod_ID = "crystalcodex";
    public static final ItemGroup CRYSTAL_GROUP = new CrystalGroup("crystaltab");

    public CrystalMain() {
    	IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        MobRegistration.ENTITIES.register(bus);
        
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::entityAttributeCreationEvent);
    }

	public void entityAttributeCreationEvent(EntityAttributeCreationEvent event) {
    	LOGGER.info("Entity Attribute Event");
		event.put(WeirdMobEntity.TYPE, WeirdMobEntity.MAP);
	}
    

Entity 

public class WeirdMobEntity  extends MonsterEntity{

	public static final String REG = "weirdmobentity";
	public static final EntityType<WeirdMobEntity> TYPE = EntityType.Builder.<WeirdMobEntity>of(WeirdMobEntity::new, EntityClassification.MISC)
			.sized(0.98F, 0.7F)
			.clientTrackingRange(8) //<--Problem area
			.build(REG);
	public static final AttributeModifierMap MAP = AttributeModifierMap.builder().add(Attributes.MAX_HEALTH, 20.0)
			.add(Attributes.MOVEMENT_SPEED, 20.0)
			.add(Attributes.FOLLOW_RANGE, 20.0)
			.build();
	
	public WeirdMobEntity(EntityType<? extends MonsterEntity> type, World worldIn) {
        super(type, worldIn);
    }
}

 

Edited by Avien
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.
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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ASIABET adalah pilihan terbaik bagi Anda yang mencari slot gacor hari ini dengan server Rusia dan jackpot menggiurkan. Berikut adalah beberapa alasan mengapa Anda harus memilih ASIABET: Slot Gacor Hari Ini Kami menyajikan koleksi slot gacor terbaik yang diperbarui setiap hari. Dengan fitur-fitur unggulan dan peluang kemenangan yang tinggi, Anda akan merasakan pengalaman bermain yang tak terlupakan setiap kali Anda memutar gulungan. Server Rusia yang Handal Kami menggunakan server Rusia yang handal dan stabil untuk memastikan kelancaran dan keadilan dalam setiap putaran permainan. Anda dapat bermain dengan nyaman tanpa khawatir tentang gangguan atau lag. Jackpot Menggiurkan Nikmati kesempatan untuk memenangkan jackpot menggiurkan yang dapat mengubah hidup Anda secara instan. Dengan hadiah-hadiah besar yang ditawarkan, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar.
    • Sonic77 adalah pilihan tepat bagi Anda yang menginginkan pengalaman bermain slot yang unggul dengan akun pro Swiss terbaik. Berikut adalah beberapa alasan mengapa Anda harus memilih Sonic77: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik dari provider terkemuka. Dengan fitur-fitur unggulan dan peluang kemenangan yang tinggi, Anda akan merasakan pengalaman bermain yang tak terlupakan. Akun Pro Swiss Berkualitas Kami menawarkan akun pro Swiss yang berkualitas dan terpercaya. Dengan akun ini, Anda dapat menikmati berbagai keuntungan eksklusif dan fasilitas premium yang tidak tersedia untuk akun reguler.
    • SV388 SITUS RESMI SABUNG AYAM 2024   Temukan situs resmi untuk sabung ayam terpercaya di tahun 2024 dengan SV388! Dengan layanan terbaik dan pengalaman bertaruh yang tak tertandingi, SV388 adalah tempat terbaik untuk pecinta sabung ayam. Daftar sekarang untuk mengakses arena sabung ayam yang menarik dan nikmati kesempatan besar untuk meraih kemenangan. Jelajahi sensasi taruhan yang tak terlupakan di tahun ini dengan SV388! [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]   JURAGANSLOT88 SITUS JUDI SLOT ONLINE TERPERCAYA 2024 Jelajahi pengalaman judi slot online terpercaya di tahun 2024 dengan JuraganSlot88! Sebagai salah satu situs terkemuka, JuraganSlot88 menawarkan berbagai pilihan permainan slot yang menarik dengan layanan terbaik dan keamanan yang terjamin. Daftar sekarang untuk mengakses sensasi taruhan yang tak terlupakan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan JuraganSlot88 [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
    • Slot Bank MEGA atau Daftar slot Bank MEGA bisa anda lakukan pada situs WINNING303 kapanpun dan dimanapun, Bermodalkan Hp saja anda bisa mengakses chat ke agen kami selama 24 jam full. keuntungan bergabung bersama kami di WINNING303 adalah anda akan mendapatkan bonus 100% khusus member baru yang bergabung dan deposit. Tidak perlu banyak, 5 ribu rupiah saja anda sudah bisa bermain bersama kami di WINNING303 . Tunggu apa lagi ? Segera Klik DAFTAR dan anda akan jadi Jutawan dalam semalam.
    • ladangtoto situs resmi ladangtoto situs terpercaya 2024   Temukan situs resmi dan terpercaya untuk tahun 2024 di LadangToto! Dengan layanan terbaik dan keamanan yang terjamin, LadangToto adalah pilihan utama untuk penggemar judi online. Daftar sekarang untuk mengakses berbagai jenis permainan taruhan, termasuk togel, kasino, dan banyak lagi. Jelajahi sensasi taruhan yang tak terlupakan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan LadangToto!" [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
  • Topics

×
×
  • Create New...

Important Information

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