Jump to content

[1.7.2] LivingHurtEvent


Guest Abrynos

Recommended Posts

Guest Abrynos

Hey guys!

 

I wanted to make a sword out of enderpearls that teleports the mob (or player) wich gets damage randomly through the world (not more than 15 blocks away). I have already used my event handler for some other things, but i can't find a way to do this, so i would be grateful if you could help me

 

 

Link to comment
Share on other sites

Guest Abrynos

Ok i made this. Eclipse doesn't give me an error, but if i want to start minecraft it still crashes on startup.

 

@SubscribeEvent
public void hurtEvent(LivingHurtEvent event, EntityPlayer player){
if(event.source.getEntity() != null){
if(event.source.getEntity() == player){
Item current = player.getCurrentEquippedItem().getItem();
Item ender = ToolDefiner.toolEnderSchwert;
if(current == ender){
event.entity.setPosition(event.entity.posX + Math.random(), event.entity.posY + Math.random(), event.entity.posZ + Math.random());
}
}
}
}[/Code]

 

 

 

[21:16:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker

[21:16:16] [main/INFO] [FML]: Forge Mod Loader version 7.2.156.1060 for Minecraft 1.7.2 loading

[21:16:16] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_65, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

[21:16:16] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[21:16:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[21:16:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[21:16:16] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[21:16:17] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/Sebastian/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!

[21:16:17] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!

[21:16:17] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/Sebastian/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it

[21:16:17] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[21:16:17] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[21:16:17] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

[21:16:18] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[21:16:20] [main/INFO]: Setting user: Player988

[21:16:22] [Client thread/INFO]: LWJGL Version: 2.9.0

[21:16:23] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[21:16:23] [Client thread/INFO] [FML]: MinecraftForge v10.12.1.1060 Initialized

[21:16:24] [Client thread/INFO] [FML]: Replaced 141 ore recipies

[21:16:24] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[21:16:24] [Client thread/INFO] [FML]: Searching C:\Users\Sebastian\Desktop\Forge\eclipse\mods for mods

[21:16:27] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!

[21:16:30] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[21:16:30] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Abrynos

[21:16:31] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

[21:16:33] [sound Library Loader/INFO]: Sound engine started

[21:16:41] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[21:16:42] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[21:16:42] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue

[21:16:42] [Client thread/ERROR] [FML]:

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{7.2.156.1060} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.12.1.1060} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized

Abrynos{1.0} [Abrynos] (bin) Unloaded->Constructed->Pre-initialized->Errored

[21:16:42] [Client thread/ERROR] [FML]: The following problems were captured during this phase

[21:16:42] [Client thread/ERROR] [FML]: Caught exception from Abrynos

java.lang.IllegalArgumentException: Method public void com.Abrynos.Handler.AbrEventHandler.hurtEvent(net.minecraftforge.event.entity.living.LivingHurtEvent,net.minecraft.entity.player.EntityPlayer) has @SubscribeEvent annotation, but requires 2 arguments.  Event handler methods must require a single argument.

at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:59) ~[EventBus.class:?]

at com.Abrynos.Registries.AbrGameRegistry.registerHandlers(AbrGameRegistry.java:41) ~[AbrGameRegistry.class:?]

at com.Abrynos.MainRegistry.init(MainRegistry.java:101) ~[MainRegistry.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) ~[LoadController.class:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) ~[LoadController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:677) [Loader.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:583) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:890) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

---- Minecraft Crash Report ----

// Don't do that.

 

Time: 03.09.14 21:16

Description: Initializing game

 

java.lang.IllegalArgumentException: Method public void com.Abrynos.Handler.AbrEventHandler.hurtEvent(net.minecraftforge.event.entity.living.LivingHurtEvent,net.minecraft.entity.player.EntityPlayer) has @SubscribeEvent annotation, but requires 2 arguments.  Event handler methods must require a single argument.

at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:59)

at com.Abrynos.Registries.AbrGameRegistry.registerHandlers(AbrGameRegistry.java:41)

at com.Abrynos.MainRegistry.init(MainRegistry.java:101)

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:677)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)

at net.minecraft.client.Minecraft.run(Minecraft.java:890)

at net.minecraft.client.main.Main.main(Main.java:112)

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:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:59)

at com.Abrynos.Registries.AbrGameRegistry.registerHandlers(AbrGameRegistry.java:41)

at com.Abrynos.MainRegistry.init(MainRegistry.java:101)

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:677)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:890)

at net.minecraft.client.main.Main.main(Main.java:112)

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:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_65, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 940018064 bytes (896 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.01-pre FML v7.2.156.1060 Minecraft Forge 10.12.1.1060 4 mods loaded, 4 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{7.2.156.1060} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.12.1.1060} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized

Abrynos{1.0} [Abrynos] (bin) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: Intel® HD Graphics 4000 GL version 3.3.0 - Build 8.15.10.2712, Intel

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: Deutsch (Deutschland)

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

Anisotropic Filtering: Off (1)

#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Sebastian\Desktop\Forge\eclipse\.\crash-reports\crash-2014-09-03_21.16.42-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

 

Link to comment
Share on other sites

Guest Abrynos

ok i got it working. But it only teleports the creeper i'm using for the tests in one direction instead of in one of four. Here's my code:

 

@SubscribeEvent
public void hurtEvent(LivingHurtEvent event){
if(event.source.getEntity() != null){
if(event.source.getEntity() instanceof EntityPlayer){
EntityPlayer pl = (EntityPlayer)event.source.getEntity();
if(pl.getCurrentEquippedItem().getItem() == ToolDefiner.toolEnderSchwert){
int k = 5;
for(int i = 0; i < 100; i++){
k = (int)Math.random();
i = i - 1;
if(k < 4){
i = 101;
}
}
if(k == 0){
event.entity.setPosition(event.entity.posX + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posY + 3 + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posZ + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random());
}
else if(k == 1){
event.entity.setPosition(event.entity.posX + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posY + 3 + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posZ - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random());
}
else if(k == 2){
event.entity.setPosition(event.entity.posX - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random(), event.entity.posY + 3 + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posZ + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random() + Math.random());
}
else if(k == 3){
event.entity.setPosition(event.entity.posX - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random(), event.entity.posY + 3 + Math.random() + Math.random() + Math.random() + Math.random() + Math.random(), event.entity.posZ - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random() - Math.random());
}
}
}
}
}[/Code]

Link to comment
Share on other sites

Guest Abrynos

did it just before you wrote this.

it works with this, but i want to have particles where the mob was standing before.

@SubscribeEvent
public void hurtEvent(LivingHurtEvent event){
	if(event.source.getEntity() != null){
		if(event.source.getEntity() instanceof EntityPlayer){
			EntityPlayer pl = (EntityPlayer)event.source.getEntity();
			if(pl.getCurrentEquippedItem().getItem() == ToolDefiner.toolEnderSchwert){
				long seed = ((int)event.entity.posX & 255) | (((int)event.entity.posY & 255) <<  | ((int)event.entity.posZ << 16);
				Random random = new Random(seed);
				int k = random.nextInt(4);
				int plusX = random.nextInt(6);
				int pluxY = random.nextInt(4);
				int plusZ = random.nextInt(6);

				if(k == 0){
					event.entity.setPosition(event.entity.posX + plusX, event.entity.posY + 3 + pluxY, event.entity.posZ + plusZ);
				}
				else if(k == 1){
					event.entity.setPosition(event.entity.posX + plusX, event.entity.posY + 3 + pluxY, event.entity.posZ - plusZ);
				}
				else if(k == 2){
					event.entity.setPosition(event.entity.posX - plusX, event.entity.posY + 3 + pluxY, event.entity.posZ + plusZ);
				}
				else if(k == 3){
					event.entity.setPosition(event.entity.posX - plusX, event.entity.posY + 3 + pluxY, event.entity.posZ - plusZ);
				}
			}
		}	
	}
}

 

sadly it doesn't work with

					World world = World;


				double x = event.entity.posX;
				double y = event.entity.posY;
		        double z = event.entity.posZ;

		        world.spawnParticle("portal", x, y, z, 0.0D, 0.0D, 0.0D);

Link to comment
Share on other sites

You might want to think about terrain here too, since your teleport could put the mob under ground or inside other terrain (nearby cliffs or lava pools).

However, this is all you need.

event.entity.setPosition(event.entity.posX -10.0D + World.rand.nextDouble() * 20.0D, event.entity.posY - 3.0D + world.rand.nextDouble() * 6.0D, event.entity.posZ - 10.0D + World.rand.nextDouble() * 20.0D);

Noter that the entity will not change facing. The will still be pointed in the same direction they were pointed, unless you use setPositionAndRotation instead.

 

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

    • Slot depo 5k merupakan situs slot depo 5k yang menyediakan slot minimal deposit 5rb atau 5k via dana yang super gacor, dimana para pemain hanya butuh modal depo sebesar 5k untuk bisa bermain di link slot gacor thailand terbaru tahun 2024 yang gampang menang ini.   DAFTAR & LOGIN AKUN PRO SLOT DEPO 5K ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit 3000 adalah situs slot deposit 3000 via dana yang super gacor dimana para pemain dijamin garansi wd hari ini juga hanya dengan modal receh berupa deposit sebesar 3000 baik via dana, ovo, gopay maupun linkaja untuk para pemain pengguna e-wallet di seluruh Indonesia.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT 3000 ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • OLXTOTO: Menikmati Sensasi Bermain Togel dan Slot dengan Aman dan Mengasyikkan Dunia perjudian daring terus berkembang dengan cepat, dan salah satu situs yang telah menonjol dalam pasar adalah OLXTOTO. Sebagai platform resmi untuk permainan togel dan slot, OLXTOTO telah memenangkan kepercayaan banyak pemain dengan menyediakan pengalaman bermain yang aman, adil, dan mengasyikkan. DAFTAR OLXTOTO DISINI Keamanan Sebagai Prioritas Utama Salah satu aspek utama yang membuat OLXTOTO begitu menonjol adalah komitmennya terhadap keamanan pemain. Dengan menggunakan teknologi enkripsi terkini, situs ini memastikan bahwa semua informasi pribadi dan keuangan para pemain tetap aman dan terlindungi dari akses yang tidak sah. Beragam Permainan yang Menarik Di OLXTOTO, pemain dapat menemukan beragam permainan yang menarik untuk dinikmati. Mulai dari permainan klasik seperti togel hingga slot modern dengan fitur-fitur inovatif, ada sesuatu untuk setiap selera dan preferensi. Grafik yang memukau dan efek suara yang mengagumkan menambah keseruan setiap putaran. Peluang Menang yang Tinggi Salah satu hal yang paling menarik bagi para pemain adalah peluang menang yang tinggi yang ditawarkan oleh OLXTOTO. Dengan pembayaran yang adil dan peluang yang setara bagi semua pemain, setiap taruhan memberikan kesempatan nyata untuk memenangkan hadiah besar. Layanan Pelanggan yang Responsif Tim layanan pelanggan OLXTOTO siap membantu para pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Dengan layanan yang ramah dan responsif, pemain dapat yakin bahwa mereka akan mendapatkan bantuan yang mereka butuhkan dengan cepat dan efisien. Kesimpulan OLXTOTO telah membuktikan dirinya sebagai salah satu situs terbaik untuk penggemar togel dan slot online. Dengan fokus pada keamanan, beragam permainan yang menarik, peluang menang yang tinggi, dan layanan pelanggan yang luar biasa, tidak mengherankan bahwa situs ini telah menjadi pilihan utama bagi banyak pemain. Jadi, jika Anda mencari pengalaman bermain yang aman, adil, dan mengasyikkan, jangan ragu untuk bergabung dengan OLXTOTO hari ini dan rasakan sensasi kemenangan!
    • Slot deposit dana adalah situs slot deposit dana yang juga menerima dari e-wallet lain seperti deposit via dana, ovo, gopay & linkaja terlengkap saat ini, sehingga para pemain yang tidak memiliki rekening bank lokal bisa tetap bermain slot dan terbantu dengan adanya fitur tersebut.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit dana adalah situs slot deposit dana minimal 5000 yang dijamin garansi super gacor dan gampang menang, dimana para pemain yang tidak memiliki rekening bank lokal tetap dalam bermain slot dengan melakukan deposit dana serta e-wallet lainnya seperti ovo, gopay maupun linkaja lengkap. Agar para pecinta slot di seluruh Indonesia tetap dapat menikmati permainan tanpa halangan apapun khususnya metode deposit, dimana ketersediaan cara deposit saat ini yang lebih beragam tentunya sangat membantu para pecinta slot.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
  • Topics

×
×
  • Create New...

Important Information

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