diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/EntityClassGroup.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/EntityClassGroup.java index 2b458213a..3d5bdba3d 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/EntityClassGroup.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/entity/EntityClassGroup.java @@ -91,9 +91,9 @@ public static class NoDragonClassGroup extends EntityClassGroup { public static final NoDragonClassGroup BOAT_SHULKER_LIKE_COLLISION; //aka entities that other entities will do block-like collisions with when moving static { - String remapped_isCollidable = PlatformMappingInformation.INSTANCE.mapMethodName("intermediary", "net.minecraft.class_1297", "method_30948", "()Z", "canBeCollidedWith"); + String remapped_canBeCollidedWith = PlatformMappingInformation.INSTANCE.mapMethodName("intermediary", "net.minecraft.class_1297", "method_30948", "()Z", "canBeCollidedWith"); BOAT_SHULKER_LIKE_COLLISION = new NoDragonClassGroup( - (Class entityClass) -> ReflectionUtil.hasMethodOverride(entityClass, Entity.class, true, remapped_isCollidable)); + (Class entityClass) -> ReflectionUtil.hasMethodOverride(entityClass, Entity.class, true, remapped_canBeCollidedWith)); if ((!BOAT_SHULKER_LIKE_COLLISION.contains(Shulker.class))) { throw new AssertionError(); diff --git a/common/src/main/java/net/caffeinemc/mods/lithium/common/world/WorldHelper.java b/common/src/main/java/net/caffeinemc/mods/lithium/common/world/WorldHelper.java index 8e1de5b4a..199d1d694 100644 --- a/common/src/main/java/net/caffeinemc/mods/lithium/common/world/WorldHelper.java +++ b/common/src/main/java/net/caffeinemc/mods/lithium/common/world/WorldHelper.java @@ -45,7 +45,7 @@ public static List getEntitiesForCollision(EntityGetter entityView, AABB EntitySectionStorage cache = getEntityCacheOrNull(world); if (cache != null) { Profiler.get().incrementCounter("getEntities"); - return getEntitiesOfClassGroup(cache, collidingEntity, EntityClassGroup.NoDragonClassGroup.BOAT_SHULKER_LIKE_COLLISION, box); + return getEntitiesOfClassGroup(cache, collidingEntity, EntityClassGroup.NoDragonClassGroup.BOAT_SHULKER_LIKE_COLLISION, box, null); } } //use vanilla code in case the shortcut is not applicable @@ -53,19 +53,19 @@ public static List getEntitiesForCollision(EntityGetter entityView, AABB return entityView.getEntities(collidingEntity, box); } - public static List getOtherEntitiesForCollision(EntityGetter entityView, AABB box, @Nullable Entity collidingEntity, Predicate entityPredicate) { + public static List getOtherEntitiesForCollision(EntityGetter entityView, AABB box, @Nullable Entity collidingEntity, Predicate entityFilter) { if (!CUSTOM_TYPE_FILTERABLE_LIST_DISABLED && entityView instanceof Level world) { if (collidingEntity == null || !EntityClassGroup.CUSTOM_COLLIDE_LIKE_MINECART_BOAT_WINDCHARGE.contains(collidingEntity.getClass())) { EntitySectionStorage cache = getEntityCacheOrNull(world); if (cache != null) { Profiler.get().incrementCounter("getEntities"); - return getEntitiesOfClassGroup(cache, collidingEntity, EntityClassGroup.NoDragonClassGroup.BOAT_SHULKER_LIKE_COLLISION, box); + return getEntitiesOfClassGroup(cache, collidingEntity, EntityClassGroup.NoDragonClassGroup.BOAT_SHULKER_LIKE_COLLISION, box, entityFilter); } } } //use vanilla code in case the shortcut is not applicable // due to the reference entity implementing special collision or the mixin being disabled in the config - return entityView.getEntities(collidingEntity, box, entityPredicate); + return entityView.getEntities(collidingEntity, box, entityFilter); } @@ -81,7 +81,7 @@ public static EntitySectionStorage getEntityCacheOrNull(Level world) { return null; } - public static List getEntitiesOfClassGroup(EntitySectionStorage cache, Entity collidingEntity, EntityClassGroup.NoDragonClassGroup entityClassGroup, AABB box) { + public static List getEntitiesOfClassGroup(EntitySectionStorage cache, Entity collidingEntity, EntityClassGroup.NoDragonClassGroup entityClassGroup, AABB box, Predicate entityFilter) { ArrayList entities = new ArrayList<>(); cache.forEachAccessibleNonEmptySection(box, section -> { //noinspection unchecked @@ -90,7 +90,7 @@ public static List getEntitiesOfClassGroup(EntitySectionStorage Collection entitiesOfType = ((ClassGroupFilterableList) allEntities).lithium$getAllOfGroupType(entityClassGroup); if (!entitiesOfType.isEmpty()) { for (Entity entity : entitiesOfType) { - if (entity.getBoundingBox().intersects(box) && !entity.isSpectator() && entity != collidingEntity) { + if (entity.getBoundingBox().intersects(box) && !entity.isSpectator() && entity != collidingEntity && (entityFilter == null || entityFilter.test(entity))) { //skip the dragon piece check without issues by only allowing EntityClassGroup.NoDragonClassGroup as type entities.add(entity); }