仅允许投射物交互OBB
This commit is contained in:
parent
740b4154b9
commit
d6619f3295
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.mixins;
|
||||||
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
||||||
import com.atsuishio.superbwarfare.tools.OBB;
|
import com.atsuishio.superbwarfare.tools.OBB;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -25,6 +26,8 @@ public abstract class LevelMixin {
|
||||||
@Inject(method = "getEntities(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;Ljava/util/function/Predicate;)Ljava/util/List;",
|
@Inject(method = "getEntities(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;Ljava/util/function/Predicate;)Ljava/util/List;",
|
||||||
at = @At("RETURN"))
|
at = @At("RETURN"))
|
||||||
public void getEntities(Entity pEntity, AABB pBoundingBox, Predicate<? super Entity> pPredicate, CallbackInfoReturnable<List<Entity>> cir) {
|
public void getEntities(Entity pEntity, AABB pBoundingBox, Predicate<? super Entity> pPredicate, CallbackInfoReturnable<List<Entity>> cir) {
|
||||||
|
if (!(pEntity instanceof Projectile)) return;
|
||||||
|
|
||||||
StreamSupport.stream(this.getEntities().getAll().spliterator(), false).filter(e -> e instanceof OBBEntity && pPredicate.test(e))
|
StreamSupport.stream(this.getEntities().getAll().spliterator(), false).filter(e -> e instanceof OBBEntity && pPredicate.test(e))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
for (OBB obb : ((OBBEntity) entity).getOBBs()) {
|
for (OBB obb : ((OBBEntity) entity).getOBBs()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue