Jump to content

Recommended Posts

Posted

Hi!

 

I am in need of some help please.  I've completed a simple recipe mod now (SmeltCycle on curse), and am attempting something more complex.  I'm a software dev as a day job, although I haven't done much Java in a while.  Functionally, what I want to do is change some of the behavior when horses are bred (altering stats) - specifically, the createChild method on EntityHorse, I'd like to supplement that logic with my own.

 

So, I've created a new class EntityAdvancedHorse, which extends EntityHorse:

[spoiler=EntityAdvancedHorse]

package com.queennuffer.horsinaround;

 

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.passive.EntityHorse;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

 

public class EntityAdvancedHorse extends EntityHorse {

 

@Override

    public EntityAgeable createChild(EntityAgeable ageable){

EntityAgeable kid = super.createChild(ageable);

 

kid.setCustomNameTag("Child of " + this.getCustomNameTag() + " and " + ageable.getCustomNameTag());

return kid;   

    }

 

public EntityAdvancedHorse(EntityHorse copyFrom, World worldIn){

super(worldIn);

this.copyDataFromOld(copyFrom);   

}

 

public EntityAdvancedHorse(World worldIn) {

super(worldIn);

// TODO Auto-generated constructor stub

}

 

}

 

 

 

In preInit, I'm registering the entity:

EntityRegistry.registerModEntity(EntityAdvancedHorse.class, "AdvancedHorse", ID, this, 80, 3, true);

   

And then, in init, registering the renderer:

if(initEvent.getSide().isClient()){

  RenderingRegistry.registerEntityRenderingHandler(EntityAdvancedHorse.class,

    new RenderHorse(Minecraft.getMinecraft().getRenderManager(), new ModelHorse(), 0.5F));

}

 

I'm trapping the EntityJoinWorldEvent and replacing an EntityHorse with a new EntityAdvancedHorse:

[spoiler=replaceHorses]

@SubscribeEvent

public void replaceHorses(EntityJoinWorldEvent event){

    if(!event.world.isRemote){

          if (event.entity instanceof EntityHorse){

        EntityHorse theHorse = (EntityHorse) event.entity;

            EntityAdvancedHorse newHorse = new EntityAdvancedHorse(theHorse, event.world);

            newHorse.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);

            event.entity.setDead();

          }  

    }

}

 

 

 

The horses appear briefly, and then flash out of existence...my assumption is that the code is running, EntityAdvancedHorse is getting created but not rendering?  There's no error in stdout to indicate a problem occurred, but no visible horses either. 

 

Could someone please point me in the right direction?  I'm sure I've made some rookie mistakes here!

Geek girl and professional code wrangler, but new to Forge.

Posted

You are never spawning new horse.

 

event.world.spawnEntityInWorld(newHorse);

 

EDIT

Oh, that's not all. This way (you are doing), you will be spawning normal horse and advancedHorse, where normal one will simply die in 1 tick time.

 

Proper way of doing this is to cancel EntityJoinWorldEvent and inside it - perform "replacement" spawning.

 

Simple example:

@SubscribeEvent
public void onAttack(EntityJoinWorldEvent event)
{
// Checks
event.setCanceled(true);
// your code
}

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Oh wow I feel blonde.  Thanks!  I'll chuck both of those modifications in this evening, but that makes sense, so I'm sure will work. 

Geek girl and professional code wrangler, but new to Forge.

Posted

Sadly, this did not work, and the game now crashes, but I'm a little stumped as to why.

 

My EntityJoinWorldEvent now looks like this:

[spoiler=EntityJoinWorldEvent]

@SubscribeEvent
public void replaceHorses(EntityJoinWorldEvent event){ 
  if(!event.world.isRemote){
    if (event.entity instanceof EntityHorse && !(event.entity instanceof EntityAdvancedHorse)){
      EntityHorse theHorse = (EntityHorse) event.entity;
      EntityAdvancedHorse newHorse = new EntityAdvancedHorse(event.world);
      newHorse.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
      System.out.println("Makey advanced");
      event.world.spawnEntityInWorld(newHorse);
      event.setCanceled(true);
    }	  
  }
}

 

 

When entering my world, the game crashes with the following stack trace:

[spoiler=Stack trace]

[06:52:51] [main/INFO] [FML]: Forge Mod Loader version 8.99.0.1405 for Minecraft 1.8 loading
[06:52:51] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows XP:x86:5.1, installed at C:\Program Files\Java\jre1.8.0_45
[06:52:51] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[06:52:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[06:52:51] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[06:52:51] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[06:52:51] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[06:52:51] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[06:52:51] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[06:52:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[06:52:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[06:52:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[06:52:52] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[06:52:56] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[06:52:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[06:52:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[06:52:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[06:52:56] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[06:52:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[06:52:56] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[06:52:57] [Client thread/INFO]: Setting user: QueenNuffer
[06:52:59] [Client thread/INFO]: LWJGL Version: 2.9.1
[06:53:00] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:224]: ---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 6/11/15 6:53 AM
Description: Loading screen debug info

java.lang.Throwable
at net.minecraftforge.fml.client.SplashProgress.start(SplashProgress.java:223)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:195)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:446)
at net.minecraft.client.Minecraft.run(Minecraft.java:356)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows XP (x86) version 5.1
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode, sharing), Oracle Corporation
Memory: 61930704 bytes (59 MB) / 127631360 bytes (121 MB) up to 259522560 bytes (247 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 347.25' Renderer: 'GeForce GT 630/PCIe/SSE2'
[06:53:00] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[06:53:00] [Client thread/INFO] [FML]: MinecraftForge v11.14.1.1405 Initialized
[06:53:00] [Client thread/INFO] [FML]: Replaced 204 ore recipies
[06:53:00] [Client thread/INFO] [FML]: Preloading CrashReport classes
[06:53:00] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[06:53:00] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[06:53:00] [Client thread/INFO] [FML]: Searching G:\ForgeDev\Mods\HorsinAround\mods for mods
[06:53:01] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[06:53:01] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, HorsinAround] at CLIENT
[06:53:01] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, HorsinAround] at SERVER
[06:53:02] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Horsin' Around
[06:53:02] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[06:53:02] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations
[06:53:02] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[06:53:02] [Client thread/INFO] [FML]: Applying holder lookups
[06:53:02] [Client thread/INFO] [FML]: Holder lookups applied
[06:53:05] [sound Library Loader/INFO]: Starting up SoundSystem...
[06:53:05] [Thread-9/INFO]: Initializing LWJGL OpenAL
[06:53:05] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[06:53:07] [Thread-9/INFO]: OpenAL initialized.
[06:53:07] [sound Library Loader/INFO]: Sound engine started
[06:53:10] [Client thread/INFO]: Created: 512x512 textures-atlas
[06:53:10] [Client thread/ERROR] [FML]: Model definition for location horsinaround:PaddedLeather#inventory not found
[06:53:10] [Client thread/ERROR] [FML]: Model definition for location horsinaround:staticator#inventory not found
[06:53:10] [Client thread/ERROR] [FML]: Model definition for location horsinaround:ToffeeApple#inventory not found
[06:53:10] [Client thread/ERROR] [FML]: Model definition for location horsinaround:CookedZombieFlesh#inventory not found
[06:53:11] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[06:53:11] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Horsin' Around
[06:53:11] [Client thread/INFO]: SoundSystem shutting down...
[06:53:11] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[06:53:11] [sound Library Loader/INFO]: Starting up SoundSystem...
[06:53:12] [Thread-11/INFO]: Initializing LWJGL OpenAL
[06:53:12] [Thread-11/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[06:53:12] [Thread-11/INFO]: OpenAL initialized.
[06:53:12] [sound Library Loader/INFO]: Sound engine started
[06:53:16] [Client thread/INFO]: Created: 512x512 textures-atlas
[06:53:16] [Client thread/ERROR] [FML]: Model definition for location horsinaround:PaddedLeather#inventory not found
[06:53:16] [Client thread/ERROR] [FML]: Model definition for location horsinaround:staticator#inventory not found
[06:53:16] [Client thread/ERROR] [FML]: Model definition for location horsinaround:ToffeeApple#inventory not found
[06:53:16] [Client thread/ERROR] [FML]: Model definition for location horsinaround:CookedZombieFlesh#inventory not found
[06:53:22] [server thread/INFO]: Starting integrated minecraft server version 1.8
[06:53:22] [server thread/INFO]: Generating keypair
[06:53:22] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance
[06:53:22] [server thread/INFO] [FML]: Applying holder lookups
[06:53:22] [server thread/INFO] [FML]: Holder lookups applied
[06:53:22] [server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1415cef)
[06:53:22] [server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1415cef)
[06:53:22] [server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1415cef)
[06:53:22] [server thread/INFO]: Preparing start region for level 0
[06:53:23] [server thread/INFO] [sTDOUT]: [com.queennuffer.horsinaround.BreedManager:replaceHorses:37]: Makey advanced
[06:53:23] [server thread/ERROR]: Encountered an unexpected exception
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(Unknown Source) ~[?:1.8.0_45]
at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.8.0_45]
at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection$WrappedIterator.next(AbstractMapBasedMultimap.java:486) ~[guava-17.0.jar:?]
at net.minecraft.util.ClassInheritanceMultiMap$2.computeNext(ClassInheritanceMultiMap.java:125) ~[forgeSrc-1.8-11.14.1.1405.jar:?]
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) ~[guava-17.0.jar:?]
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) ~[guava-17.0.jar:?]
at net.minecraft.world.World.loadEntities(World.java:3372) ~[World.class:?]
at net.minecraft.world.chunk.Chunk.onChunkLoad(Chunk.java:1017) ~[Chunk.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:46) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) ~[AsynchronousExecutor.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) ~[AsynchronousExecutor.class:?]
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) ~[ChunkIOExecutor.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:133) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:108) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:343) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:113) ~[integratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:130) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:500) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
[06:53:23] [server thread/ERROR]: This crash report has been saved to: G:\ForgeDev\Mods\HorsinAround\.\crash-reports\crash-2015-06-11_06.53.23-server.txt
[06:53:23] [server thread/INFO] [FML]: Applying holder lookups
[06:53:23] [server thread/INFO] [FML]: Holder lookups applied
[06:53:23] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.
[06:53:24] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: ---- Minecraft Crash Report ----
// I feel sad now 

Time: 6/11/15 6:53 AM
Description: Exception in server tick loop

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection$WrappedIterator.next(AbstractMapBasedMultimap.java:486)
at net.minecraft.util.ClassInheritanceMultiMap$2.computeNext(ClassInheritanceMultiMap.java:125)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at net.minecraft.world.World.loadEntities(World.java:3372)
at net.minecraft.world.chunk.Chunk.onChunkLoad(Chunk.java:1017)
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:46)
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)
at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:133)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:108)
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:343)
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:113)
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:130)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:500)
at java.lang.Thread.run(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows XP (x86) version 5.1
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode, sharing), Oracle Corporation
Memory: 77899184 bytes (74 MB) / 208257024 bytes (198 MB) up to 259522560 bytes (247 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.99.0.1405 Minecraft Forge 11.14.1.1405 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
FML{8.99.0.1405} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1405.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
Forge{11.14.1.1405} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1405.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
HorsinAround{1.0} [Horsin' Around] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available
Loaded coremods (and transformers): 
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[06:53:24] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-06-11_06.53.23-server.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

 

Things I've tried:

- Adding the spawnEntityInWorld to the server's scheduled tasks as a new Runnable (thinking maybe it was a threading issue).  Same effect.

- Making newHorse an instance of EntityPig, just to rule out being an issue with my class.  Same effect.

 

Any pointers please?

Geek girl and professional code wrangler, but new to Forge.

Posted

Hmm, welp - this works for me:

@SubscribeEvent
public void onEntityJoined(EntityJoinWorldEvent event)
{
if (event.entity instanceof EntityEgg)
{
	event.setCanceled(true);
	EntityCreeper lol = new EntityCreeper(event.world);
	lol.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
	event.world.spawnEntityInWorld(lol);
}
}

 

Try this EXACT code - it has to work. (EDIT: You can also add !world.isRemote - doesn't matter (in this case, it's an example)).

 

What might be wrong:

- You are using wrong event bus (should be Forge).

- Something's wrong with your constructor

- I don't know.

- Error is totally elsewhere (weird crash is weird) EDIT

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Ok...that works, and when I throw an egg, I get a creeper.  However I then changed it to:

 

@SubscribeEvent
public void onEntityJoined(EntityJoinWorldEvent event)
{
	if (event.entity instanceof EntityCreeper)
	{
		event.setCanceled(true);
		EntityPig lol = new EntityPig(event.world);
		lol.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
		event.world.spawnEntityInWorld(lol);
	}
}

 

This has the same issue as before.  Could there be some timing issue here that in the case of the EntityEgg, that code's not getting called when I first enter the world, but in the case of replace creepers with pigs, it's running at world enter? 

 

This is my code for the event bus:

MinecraftForge.EVENT_BUS.register(new BreedManager());

 

 

Geek girl and professional code wrangler, but new to Forge.

Posted

Indeed.

I belive you/we just discovered glitch in event (or at least unexpected turn).

I did some testing, seems like thee crash occurs when game tries to load entity-to-remove from memory (NBT).

 

Explanation:

If you would run totally new world - all the new EntityHorse (and others) are constructed and joining world for the first time. That means there is no NBT-loading for them and event will work (test it - it will work on new world).

Problem occurs if you would have world in which there was EntityHorse alredy spawned (at least once) and which woud try to actually load its NBT data when joinind the world. In that case game crashes.

 

I'll be damned, but for me it's at least bad, if not horrible.

I placed breakpoints and for me it crashed on

World.class

           if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false;

            this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_);
            this.loadedEntityList.add(p_72838_1_);
            this.onEntityAdded(p_72838_1_);
            return true;
        }
    }

    public void onEntityAdded(Entity p_72923_1_)
    {
        for (int i = 0; i < this.worldAccesses.size(); ++i)
        {
            ((IWorldAccess)this.worldAccesses.get(i)).onEntityAdded(p_72923_1_);  // crash occured here, on second loop (i = 1), when creeper was added to world, event was canceled and i spawned pig.
        }
    }

 

EDIT

Some of Forge pros - could you guys look into it?

 

EDIT 2

More directly:

Error doesn't occur when creeper is canceled, but when second replacement entity calls "event.world.spawnEntityInWorld(lol);" (using code from prev post).

 

It can obviously be my lack of knowledge about spawning code. How else would you spawn entity replacement if not like I proposed?

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Well, that's worse than if it was just my own bad coding LOL!

 

Is there anything I can do to work around that?  Could I somehow pre-create the NBT data so that it doesn't choke?

Geek girl and professional code wrangler, but new to Forge.

  • 2 weeks later...
Posted

So, I've been trying to work a way around this, perhaps with another event.  I decided to use the EnteringChunk event and replace then.  Doing this:

 

@SubscribeEvent
public void monitorChunk(EnteringChunk event){
	if(event.entity instanceof EntityHorse && !(event.entity instanceof EntityAdvancedHorse)){
		World theWorld = event.entity.getEntityWorld();
		theWorld.spawnEntityInWorld( new EntityAdvancedHorse( (EntityHorse)event.entity, theWorld) );
		theWorld.removeEntity(event.entity);
	}
}

 

The new horse is created (my constructor places it in the same place as the old one), however, I end up with a "ghost" horse as well that just stands there looking stupid and is not able to be interacted with/killed/collided with.  It eventually disappears when you leave the world and return again.

 

Any idea what I'm doing wrong?  I tried the same code with a cow, and ended up with an unusable cow?

Geek girl and professional code wrangler, but new to Forge.

Posted

You can't use removeEntity - it removes entity, not kills it, therefore server removes it from world but client doesn't know it died - that is your ghost horse probably.

 

You could instead of passing whole oldHorse into newHorse constructor, try only coordinates. Idk really.

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Sorry, I should have elaborated more on what I tried, my bad.

 

I did try setting entity.setDead() - same effect.

 

If I simply do setDead OR removeEntity, without trying to create a new one, the entity does just disappear.  So, I feel like I'm doing something wrong in my spawnInWorld, but no idea what.  Also the reason I tried using a cow, to rule out my class.

 

The constructor that takes old horse in, is just to ensure that the new horse gets set to the same type, age, variant, etc.  And position.  I did also try just using the vanilla constructor with no copy from horse - same deal.  I'm really stumped! :(

Geek girl and professional code wrangler, but new to Forge.

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

    • Replace rubidium with embeddium: https://www.curseforge.com/minecraft/mc-mods/embeddium/files/5681725  
    • Hm, I have no idea I have no idea which program you use, but in the console, try grep -r "\${mod_id}" src/main/resources to find the usages of this key
    • Looking for a massive discount while shopping online? With the Temu coupon code $100 off, you can unlock incredible savings on your favorite products. The exclusive acu729640 Temu coupon code is here to offer maximum benefits to all shoppers across the USA, Canada, and European countries. Whether you're a first-time buyer or a returning customer, this Temu coupon $100 off and Temu 100 off coupon code is your golden ticket to unbeatable deals. What Is The Coupon Code For Temu $100 Off? The best part about our coupon is that it's valid for everyone! Whether you're new to Temu or an existing customer, you can enjoy amazing benefits using the Temu coupon $100 off and $100 off Temu coupon. acu729640 – Get a flat $100 off instantly on your next order. acu729640 – Enjoy a $100 coupon pack with multiple use opportunities. acu729640 – Avail a $100 flat discount for new customers on their first purchase. acu729640 – Existing users can apply this code to receive an extra $100 promo discount. acu729640 – Perfect for shoppers in the USA/Canada looking to save big with a $100 coupon. Temu Coupon Code $100 Off For New Users In 2025 New to Temu? You're in luck because the Temu coupon $100 off and Temu coupon code $100 off are offering unmatched deals just for you. acu729640 – Get a flat $100 discount as a welcome gift. acu729640 – Receive a $100 coupon bundle curated specifically for new users. acu729640 – Enjoy up to $100 coupon benefits for multiple purchases. acu729640 – Benefit from free shipping to over 68 countries. acu729640 – Score an extra 30% off on any purchase as a first-time user. How To Redeem The Temu Coupon $100 Off For New Customers? To activate the Temu $100 coupon and Temu $100 off coupon code for new users, follow these easy steps: Download the Temu app or visit their official website. Create your new account using a valid email address. Browse through the wide range of products and add your favorites to the cart. At checkout, enter the coupon code acu729640. The $100 discount will be instantly applied to your total. Temu Coupon $100 Off For Existing Customers Already a Temu customer? Great! The Temu $100 coupon codes for existing users and Temu coupon $100 off for existing customers free shipping are still valid for you. acu729640 – Redeem a $100 extra discount on any existing account. acu729640 – Unlock a $100 coupon bundle usable across multiple purchases. acu729640 – Get a free gift and enjoy express shipping across the USA and Canada. acu729640 – Save an extra 30% even on discounted products. acu729640 – Take advantage of free shipping to 68 global destinations. How To Use The Temu Coupon Code $100 Off For Existing Customers? To use the Temu coupon code $100 off and Temu coupon $100 off code, follow these steps: Open the Temu app or log in to your existing account on the website. Shop your favorite items and proceed to checkout. Input the code acu729640 in the promo code box. Confirm your order and see the $100 discount applied instantly. Latest Temu Coupon $100 Off First Order Make your first order count with our powerful promo code! The Temu coupon code $100 off first order, Temu coupon code first order, and Temu coupon code $100 off first time user offer unbeatable value. acu729640 – Flat $100 discount on your first order. acu729640 – Access to a $100 Temu coupon code as a first-time buyer. acu729640 – Enjoy up to $100 in coupons for repeated use. acu729640 – Get free global shipping to 68 countries. acu729640 – Bonus 30% off any product for new users. How To Find The Temu Coupon Code $100 Off? Looking for the Temu coupon $100 off or the Temu coupon $100 off Reddit discussions? Here's how you can find verified codes: Sign up for Temu’s newsletter to get access to exclusive and verified promo codes. Follow Temu on their social media pages like Instagram, Facebook, and Twitter for real-time updates on new discounts. Trusted coupon-sharing websites also provide the latest working Temu codes, including our very own acu729640. Is Temu $100 Off Coupon Legit? Worried whether this deal is real? Yes, the Temu $100 Off Coupon Legit and Temu 100 off coupon legit status is fully confirmed. Our Temu coupon code acu729640 is 100% legitimate, tested, and verified. It’s valid for both new and existing customers, worldwide, and does not have an expiration date. How Does Temu $100 Off Coupon Work? The Temu coupon code $100 off first-time user and Temu coupon codes 100 off provide direct value through instant cart discounts. When you apply the coupon code acu729640 at checkout, the system deducts $100 from your total. Whether you're a new user or a returning one, this code adjusts automatically based on your account type and shopping cart value. How To Earn Temu $100 Coupons As A New Customer? The best way to get the Temu coupon code $100 off and 100 off Temu coupon code is by signing up as a new customer on Temu. Once your account is created, use our promo code acu729640 to unlock a $100 coupon bundle, including a first-time order bonus, repeat usage coupons, and exclusive deals for new members. What Are The Advantages Of Using The Temu Coupon $100 Off? Here are the main benefits of using our Temu coupon code 100 off and Temu coupon code $100 off: $100 discount on your first order. $100 coupon bundle for multiple uses. 70% discount on popular items. Extra 30% off for existing Temu customers. Up to 90% off on selected products. Free gift for new users. Free delivery to 68 countries. Temu $100 Discount Code And Free Gift For New And Existing Customers The Temu $100 off coupon code and $100 off Temu coupon code also come with exclusive perks. acu729640 – Get $100 discount for your first order. acu729640 – Enjoy an additional 30% off on any item. acu729640 – Receive a free gift as a new Temu user. acu729640 – Unlock up to 70% discounts on your favorite items. acu729640 – Free gift with free shipping in 68 countries, including the USA and UK. Pros And Cons Of Using The Temu Coupon Code $100 Off This Month Here are the main Temu coupon $100 off code and Temu 100 off coupon pros and cons: Pros: Massive $100 discount on your first order. Works for both new and returning users. No minimum purchase requirement. Valid across 68 countries. Includes free shipping and extra discounts. Cons: Limited availability during high demand. Cannot be combined with some other special promo campaigns. Terms And Conditions Of Using The Temu Coupon $100 Off In 2025 Here are the Temu coupon code $100 off free shipping and latest Temu coupon code $100 off terms and conditions: Coupon code acu729640 is valid worldwide. No expiration date – use it anytime. No minimum purchase required. Available for both new and existing users. Free shipping is applicable to 68 countries. Final Note: Use The Latest Temu Coupon Code $100 Off We encourage you to use the Temu coupon code $100 off to make the most of your online shopping. Apply it today to enjoy the biggest discounts and rewards on Temu. The Temu coupon $100 off is your chance to enjoy premium deals with zero hassle. Don’t miss this verified offer that saves both time and money. FAQs Of Temu $100 Off Coupon What is the Temu $100 off coupon code? The Temu $100 off coupon code is acu729640, which gives users a flat $100 discount, free shipping, and other benefits on the Temu app and website. It works globally. Can existing users use the Temu $100 coupon? Yes, existing users can also use the acu729640 code to get a $100 discount, a coupon bundle, and exclusive deals on selected items. Is the Temu $100 off coupon legit? Absolutely. Our coupon code acu729640 is 100% tested, verified, and has no expiration date. It works for both new and old users worldwide. Can I get free shipping with the Temu coupon code? Yes, the Temu $100 off coupon also includes free shipping to 68 countries, including the USA, Canada, UK, and many European nations. How do I apply the Temu coupon code $100 off? Simply enter the code acu729640 at checkout on the Temu app or website, and the discount will be automatically applied to your cart.  
    • New users at Temu receive a $100 discount on orders over $100 Use the code [aci789589] during checkout to get Temu Coupon Code $100 off For New Users. Yes, Temu offers $100 off coupon code “aci789589” for first-time users. Temu 100% Off coupon code "aci789589" will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu offers $100 off coupon code “aci789589” for first-time users. You can get a$100 bonus plus 30% off any purchase at Temu with the$100 Coupon Bundle at Temu if you sign up with the referral code [aci789589] and make a first purchase of$50 or more. The Temu $100 Off coupon code (aci789589) will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Yes Temu offers $100 Off Coupon Code “aci789589” for First Time Users. Yes, Temu offers $100 off coupon code {aci789589} for first-time users. You can get a $100 bonus plus 100% off any purchase at Temu with the $100 Coupon Bundle if you sign up with the referral code [aci789589] and make a first purchase of $100 or more. If you are who wish to join Temu, then you should use this exclusive Temu coupon code $100 off (aci789589) and get $100 off on your purchase with Temu. You can get a $100 discount with Temu coupon code {aci789589}. This exclusive offer is for existing customers and can be used for a $100 reduction on your total purchase. Enter coupon code {aci789589} at checkout to avail of the discount. You can use the code {aci789589} to get a $100 off Temu coupon as a new customer. Apply this Temu coupon code $100 off (aci789589) to get a $100 discount on your shopping with Temu. If you’re a first-time user and looking for a Temu coupon code $100 first time user(aci789589) then using this code will give you a flat $100 Off and a 90% discount on your Temu shopping. Temu $100% Off Coupon Code "aci789589" will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Temu coupon code$100off-{aci789589} Temu coupon code -{aci789589} Temu coupon code$50 off-{aci789589} Temu Coupon code [aci789589] for existing users can get up to 50% discount on product during checkout. Temu Coupon Codes for Existing Customers-aci789589 Temu values its loyal customers and offers various promo codes, including the Legit Temu Coupon Code (aci789589]) or (aci789589), which existing users can use. This ensures that repeat shoppers can also benefit from significant discounts on their purchases. Keep an eye out for special promotions and offers that are periodically available to enhance your shopping experience.
    • New users at Temu receive a $100 discount on orders over $100 Use the code [aci789589] during checkout to get Temu Coupon Code $100 off For New Users. Yes, Temu offers $100 off coupon code “aci789589” for first-time users. Temu 100% Off coupon code "aci789589" will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu offers $100 off coupon code “aci789589” for first-time users. You can get a$100 bonus plus 30% off any purchase at Temu with the$100 Coupon Bundle at Temu if you sign up with the referral code [aci789589] and make a first purchase of$50 or more. The Temu $100 Off coupon code (aci789589) will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Yes Temu offers $100 Off Coupon Code “aci789589” for First Time Users. Yes, Temu offers $100 off coupon code {aci789589} for first-time users. You can get a $100 bonus plus 100% off any purchase at Temu with the $100 Coupon Bundle if you sign up with the referral code [aci789589] and make a first purchase of $100 or more. If you are who wish to join Temu, then you should use this exclusive Temu coupon code $100 off (aci789589) and get $100 off on your purchase with Temu. You can get a $100 discount with Temu coupon code {aci789589}. This exclusive offer is for existing customers and can be used for a $100 reduction on your total purchase. Enter coupon code {aci789589} at checkout to avail of the discount. You can use the code {aci789589} to get a $100 off Temu coupon as a new customer. Apply this Temu coupon code $100 off (aci789589) to get a $100 discount on your shopping with Temu. If you’re a first-time user and looking for a Temu coupon code $100 first time user(aci789589) then using this code will give you a flat $100 Off and a 90% discount on your Temu shopping. Temu $100% Off Coupon Code "aci789589" will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Temu coupon code$100off-{aci789589} Temu coupon code -{aci789589} Temu coupon code$50 off-{aci789589} Temu Coupon code [aci789589] for existing users can get up to 50% discount on product during checkout. Temu Coupon Codes for Existing Customers-aci789589 Temu values its loyal customers and offers various promo codes, including the Legit Temu Coupon Code (aci789589]) or (aci789589), which existing users can use. This ensures that repeat shoppers can also benefit from significant discounts on their purchases. Keep an eye out for special promotions and offers that are periodically available to enhance your shopping experience.
  • Topics

×
×
  • Create New...

Important Information

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