diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2021-03-10 18:21:44 +0100 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2021-03-10 18:21:44 +0100 |
commit | f03e907ac73d92bfaf5948e1cae7848675439497 (patch) | |
tree | 194d69bd2c9e62813da4c74e49ba7ab968c79bc6 /src/main/java/gregtech/common/entities | |
parent | 2d7fe3783011c605a90cf48c04bb575e0e75a72b (diff) | |
download | GT5-Unofficial-f03e907ac73d92bfaf5948e1cae7848675439497.tar.gz GT5-Unofficial-f03e907ac73d92bfaf5948e1cae7848675439497.tar.bz2 GT5-Unofficial-f03e907ac73d92bfaf5948e1cae7848675439497.zip |
Refactor World Events
World events have way to many parameters, so the code gets unreadable, this commit fixes that behavior.
Diffstat (limited to 'src/main/java/gregtech/common/entities')
-rw-r--r-- | src/main/java/gregtech/common/entities/GT_Entity_Arrow.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index d655a75c99..65fe475360 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -241,9 +242,16 @@ public class GT_Entity_Arrow extends EntityArrow { } } } + PositionedWorldEvent<String> events = new PositionedWorldEvent<>(this.worldObj); if (getIsCritical()) { + events.setThing("crit"); for (int i = 0; i < 4; i++) { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + events.setPosition( + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D + ); + events.spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ); } } this.posX += this.motionX; @@ -266,8 +274,10 @@ public class GT_Entity_Arrow extends EntityArrow { this.rotationYaw = (this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F); float tFrictionMultiplier = 0.99F; if (isInWater()) { + events.setThing("bubble"); + events.setPosition(this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D); for (int l = 0; l < 4; l++) { - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ); + events.spawnParticle(this.motionX, this.motionY, this.motionZ); } tFrictionMultiplier = 0.8F; } |