aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/entities
diff options
context:
space:
mode:
authorPrometheus0000 <prometheus0000000@gmail.com>2021-03-13 13:01:00 -0500
committerGitHub <noreply@github.com>2021-03-13 13:01:00 -0500
commit64ecbdcfc179ffbe7a00500081abee4959c690af (patch)
tree7a8909f423dcf299cd52149af3fe80fb2ce8f2f6 /src/main/java/gregtech/common/entities
parent450d4c0df507f1927bd7a0929c736238d7d8e90e (diff)
parent49d201accb39af30ede9169077f21e07aef22243 (diff)
downloadGT5-Unofficial-64ecbdcfc179ffbe7a00500081abee4959c690af.tar.gz
GT5-Unofficial-64ecbdcfc179ffbe7a00500081abee4959c690af.tar.bz2
GT5-Unofficial-64ecbdcfc179ffbe7a00500081abee4959c690af.zip
Merge pull request #26 from GTNewHorizons/experimental
update
Diffstat (limited to 'src/main/java/gregtech/common/entities')
-rw-r--r--src/main/java/gregtech/common/entities/GT_Entity_Arrow.java27
1 files changed, 21 insertions, 6 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..2983a6580c 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.WorldSpawnedEventBuilder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment;
@@ -241,10 +242,19 @@ public class GT_Entity_Arrow extends EntityArrow {
}
}
}
+ WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder()
+ .setWorld(this.worldObj);
+
if (getIsCritical()) {
- 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.setIdentifier("crit")
+ .setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ)
+ .<WorldSpawnedEventBuilder.ParticleEventBuilder>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
+ ).run()
+ );
}
this.posX += this.motionX;
this.posY += this.motionY;
@@ -266,9 +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()) {
- 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.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()) {