100 lines
4.1 KiB
Diff
100 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
Date: Sun, 9 May 2021 18:35:05 -0500
|
|
Subject: [PATCH] Pufferfish Make EntityCollisionContext a live representation
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java
|
|
index 88a4a72bb390947dc17e5da09a99b2d1b3ac4621..284c76ddb9724b44bb2e93f590685c728e843e6d 100644
|
|
--- a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java
|
|
+++ b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java
|
|
@@ -17,50 +17,69 @@ public class EntityCollisionContext implements CollisionContext {
|
|
return defaultValue;
|
|
}
|
|
};
|
|
- private final boolean descending;
|
|
- private final double entityBottom;
|
|
- private final ItemStack heldItem;
|
|
- private final Predicate<FluidState> canStandOnFluid;
|
|
+ // Pufferfish start - remove these and pray no plugin uses them
|
|
+ // private final boolean descending;
|
|
+ // private final double entityBottom;
|
|
+ // private final ItemStack heldItem;
|
|
+ // private final Predicate<FluidState> canStandOnFluid;
|
|
+ // Pufferfish end
|
|
@Nullable
|
|
private final Entity entity;
|
|
|
|
protected EntityCollisionContext(boolean descending, double minY, ItemStack heldItem, Predicate<FluidState> walkOnFluidPredicate, @Nullable Entity entity) {
|
|
- this.descending = descending;
|
|
- this.entityBottom = minY;
|
|
- this.heldItem = heldItem;
|
|
- this.canStandOnFluid = walkOnFluidPredicate;
|
|
+ // Pufferfish start - remove these
|
|
+ // this.descending = descending;
|
|
+ // this.entityBottom = minY;
|
|
+ // this.heldItem = heldItem;
|
|
+ // this.canStandOnFluid = walkOnFluidPredicate;
|
|
+ // Pufferfish end
|
|
this.entity = entity;
|
|
}
|
|
|
|
@Deprecated
|
|
protected EntityCollisionContext(Entity entity) {
|
|
- this(
|
|
- entity.isDescending(),
|
|
- entity.getY(),
|
|
- entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY,
|
|
- entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false,
|
|
- entity
|
|
- );
|
|
+ // Pufferfish start - remove this
|
|
+ // this(
|
|
+ // entity.isDescending(),
|
|
+ // entity.getY(),
|
|
+ // entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY,
|
|
+ // entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false,
|
|
+ // entity
|
|
+ // );
|
|
+ // Pufferfish end
|
|
+ this.entity = entity;
|
|
}
|
|
|
|
@Override
|
|
public boolean isHoldingItem(Item item) {
|
|
- return this.heldItem.is(item);
|
|
+ // Pufferfish start
|
|
+ Entity entity = this.entity;
|
|
+ if (entity instanceof LivingEntity livingEntity) {
|
|
+ return livingEntity.getMainHandItem().is(item);
|
|
+ }
|
|
+ return ItemStack.EMPTY.is(item);
|
|
+ // Pufferfish end
|
|
}
|
|
|
|
@Override
|
|
public boolean canStandOnFluid(FluidState stateAbove, FluidState state) {
|
|
- return this.canStandOnFluid.test(state) && !stateAbove.getType().isSame(state.getType());
|
|
+ // Pufferfish start
|
|
+ Entity entity = this.entity;
|
|
+ if (entity instanceof LivingEntity livingEntity) {
|
|
+ return livingEntity.canStandOnFluid(state) && !stateAbove.getType().isSame(state.getType());
|
|
+ }
|
|
+ return false;
|
|
+ // Pufferfish end
|
|
}
|
|
|
|
@Override
|
|
public boolean isDescending() {
|
|
- return this.descending;
|
|
+ return this.entity != null && this.entity.isDescending(); // Pufferfish
|
|
}
|
|
|
|
@Override
|
|
public boolean isAbove(VoxelShape shape, BlockPos pos, boolean defaultValue) {
|
|
- return this.entityBottom > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F;
|
|
+ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; // Pufferfish
|
|
}
|
|
|
|
@Nullable
|