diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2021-03-11 17:43:44 +0100 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2021-03-11 17:43:44 +0100 |
commit | b359d79f77bb3efd6433c845af0a948975651b9a (patch) | |
tree | 66dc56504634159891358ebd6d9a9520c3e2c50b /src/main/java/gregtech/common/entities | |
parent | e735bc65230bdbf1324d3bd2c9b8602d43bb9050 (diff) | |
download | GT5-Unofficial-b359d79f77bb3efd6433c845af0a948975651b9a.tar.gz GT5-Unofficial-b359d79f77bb3efd6433c845af0a948975651b9a.tar.bz2 GT5-Unofficial-b359d79f77bb3efd6433c845af0a948975651b9a.zip |
Implemented Builder Pattern
Diffstat (limited to 'src/main/java/gregtech/common/entities')
-rw-r--r-- | src/main/java/gregtech/common/entities/GT_Entity_Arrow.java | 35 |
1 files changed, 21 insertions, 14 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 b9973e91fc..bc8b918af1 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -4,7 +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 gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -242,13 +242,19 @@ public class GT_Entity_Arrow extends EntityArrow { } } } - PositionedWorldEvent<String> events = new PositionedWorldEvent<>(this.worldObj); + WorldSpawnedEventBuilder.ParticleEventBuilder events = (WorldSpawnedEventBuilder.ParticleEventBuilder) + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setWorld(this.worldObj); if (getIsCritical()) { - events.setThing("crit").times(4, (x, i) -> x.setPosition( - this.posX + this.motionX * i / 4.0D, - this.posY + this.motionY * i / 4.0D, - this.posZ + this.motionZ * i / 4.0D - ).spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ)); + events.setIdentifier("crit") + .<WorldSpawnedEventBuilder.ParticleEventBuilder>times(4, (x, i) -> + x.setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) + .setPosition( + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D + ).run() + ); } this.posX += this.motionX; this.posY += this.motionY; @@ -270,13 +276,14 @@ 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") - .setPosition( - this.posX - this.motionX * 0.25D, - this.posY - this.motionY * 0.25D, - this.posZ - this.motionZ * 0.25D - ).times(4, x -> x.spawnParticle(this.motionX, this.motionY, this.motionZ)); - + events.setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) + .setIdentifier("bubble") + .setPosition( + this.posX - this.motionX * 0.25D, + this.posY - this.motionY * 0.25D, + this.posZ - this.motionZ * 0.25D + ) + .times(4, Runnable::run); tFrictionMultiplier = 0.8F; } if (isWet()) { |