Jump to content

Recommended Posts

Posted

Hi,

 

I need to cancel or make ineffective the onLivingUpdate() event of a specific Entity ... in order to make the Entity totally immobile.

 

Thank in advance.

 

PS: I tried to set the "motion" properties but the entity seems however trying to walk...

Posted

LivingUpdateEvent is cancelable.

 

how? ... I refer to a vanilla entity ...

 

Subscribe to the event

 

event.setCanceled(true)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

 

Subscribe to the event

 

event.setCanceled(true)

 

I found this code:

@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) throws InterruptedException {
}

 

But I need to get the current player that is grabbing it ... It would be perfect if i can set a "grabber-id" variable on the entity with which to obtain the player.. or How can i do it?

Posted

 

Subscribe to the event

 

event.setCanceled(true)

 

I found this code:

   @SubscribeEvent
   public void onEntityUpdate(LivingUpdateEvent event) throws InterruptedException {
   }

 

But I need to get the current player that is grabbing it ... It would be perfect if i can set a "grabber-id" variable on the entity with which to obtain the player.. or How can i do it?

First off, remove that throws declaration, Second, look up data watchers.

Maker of the Craft++ mod.

Posted

No, you can't use data watchers for this.

To attach data to an entity you need IExtendedEntityProperties.

 

And If I use an existing vanilla variable like "timeUntilPortal" = X while I'm grabbing the entity? where "X" = unusual number ...

Posted

NBT maybe?

To save NBT into a player you would need IExtendedEntityProperties

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Posted

Why IExtendedEntityProperties? If it's a small amount of NBT you can do something like

 

		NBTTagCompound persistentData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
		persistentData.setString("last_location", loc.toString());
		player.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, persistentData);

 

That's something I got from my code after reading iChun's Hats mod code, Unless I missed a huge part of it, that seems to work.

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

    • Hey guys, I'm trying to use the simple planes mod https://www.curseforge.com/minecraft/mc-mods/simple-planes with a nuclear bombs mod https://www.curseforge.com/minecraft/mc-mods/nuclear-bombs . The simple planes mod has a cargo plane that can drop tnt, and i want it to work with the nuclear bombs. I added this JSON file from chatGPT to the payloads folder in simple planes (because the nukes couldn't even get stored in the plane in the first place), but this only allows the nuke to drop but doesn't explode: https://mclo.gs/3uEQIX2 . This nuke mod requires a redstone signal and then manual activation, which makes this tougher i imagine. If someone could write me a code for the payload folder for simpleplanes, something that even tampers with the nuke mod, or any general suggestions that would be great!  Many Thanks
    • https://paste.ee/p/Qai73Cbt  that is crash file link  
    • I'm trying to make an addon mod for lycanite mobs and I got in the game. I ran the command to summon in my mob and it said unable to summon object i tried and tried again and it never worked and then someone told me that it was probably because I never added a registry for my addon mod, so how do I do that?
    • hi have 218 mods in modpack in Modrinth and it keeps crashing, so are there any incompatibilities? debug.log  
    • Hello, this is the first time I've created a mod for Minecraft and my mod is for an entity that plays in your world. I've survived several tutorials and documentation, but I still can't do what I want to do. Can you tell me why I'm getting this error? Everything looks good. no ? Forge for 1.21.4 changelist : https://gist.github.com/ChampionAsh5357/d895a7b1a34341e19c80870720f9880f Repos Github for my mod : https://github.com/Maxime66410/TheFakePlayer Last Log : https://gist.github.com/Maxime66410/246f983f2d791469ae87a77825527da9   Caused by: java.lang.NullPointerException: Registry Object not present: thefakeplayer:fake_player_entity at TRANSFORMER/[email protected]/net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:193) ~[forge-1.21.4-54.1.3_mapped_official_1.21.4-recomp.jar%231!/:?] at TRANSFORMER/[email protected]/org.furranystudio.thefakeplayer.Events.ClientModEvents.entityAttributes(ClientModEvents.java:27) ~[main/:?] at TRANSFORMER/[email protected]/org.furranystudio.thefakeplayer.Events.__ClientModEvents_entityAttributes_EntityAttributeCreationEvent.invoke(.dynamic) ~[main/:?] at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:46) ~[eventbus-6.2.27.jar:?] at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-6.2.27.jar:?] at SECURE-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:288) ~[eventbus-6.2.27.jar:?] at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:184) ~[javafmllanguage-1.21.4-54.1.3.jar:54.1.3]     SOLUTION :  ModEntities.ENTITIES.register(modEventBus); -> public Thefakeplayer(FMLJavaModLoadingContext context) https://docs.minecraftforge.net/en/1.21.x/concepts/registries/ https://github.com/MinecraftForge/MinecraftForge/blob/1.21.x/src/main/java/net/minecraftforge/registries/DeferredRegister.java  
  • Topics

×
×
  • Create New...

Important Information

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