diff --git a/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java index 98f7509d..3f0e5f3e 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/PhysicsBodyProjectileEntity.java @@ -13,6 +13,7 @@ import net.minecraft.entity.MovementType; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.PersistentProjectileEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; @@ -32,6 +33,8 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl private static final TrackedData ITEM = DataTracker.registerData(PhysicsBodyProjectileEntity.class, TrackedDataHandlerRegistry.ITEM_STACK); private static final TrackedData BOUNCY = DataTracker.registerData(PhysicsBodyProjectileEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + private int inWaterTime; + public PhysicsBodyProjectileEntity(EntityType type, World world) { super(type, world); } @@ -85,6 +88,28 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl setVelocity(vel.multiply(0.3)); addVelocity(0, -0.025, 0); } + + if (isBouncy() && isInsideWaterOrBubbleColumn()) { + setVelocity(getVelocity().multiply(0.3).add(0, 0.05125, 0)); + inWaterTime++; + } else { + inWaterTime = 0; + } + } + + @Override + public void onPlayerCollision(PlayerEntity player) { + + if (world.isClient || isNoClip() || shake > 0) { + return; + } + + if (inWaterTime <= 0) { + super.onPlayerCollision(player); + } else if (tryPickup(player)) { + player.sendPickup(this, 1); + discard(); + } } @Override