import com.google.common.base.Predicate;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import org.spongepowered.asm.mixin.*;
import javax.annotation.Nullable;
import java.util.List;
@Mixin(value = Chunk.class)
public abstract class MixinChunk {
@Shadow
@Final
private ClassInheritanceMultiMap[] entityLists;
/**
* [url=home.php?mod=space&uid=1231151]@author[/url] soys
*/
@Overwrite
public void getEntitiesWithinAABBForEntity(@Nullable Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate filter) {
int i = MathHelper.floor((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
int j = MathHelper.floor((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.clamp(i, 0, this.entityLists.length - 1);
j = MathHelper.clamp(j, 0, this.entityLists.length - 1);
for (int k = i; k
{
if (!this.entityLists[k].isEmpty())
{
for (Entity entity : this.entityLists[k])
{
if(entity instanceof EntityPlayer) {
System.out.println("test:1");
}
if (entity.getEntityBoundingBox().intersects(aabb) && entity != entityIn)
{
if (filter == null || filter.apply(entity))
{
listToFill.add(entity);
}
Entity[] aentity = entity.getParts();
if (aentity != null)
{
for (Entity entity1 : aentity)
{
if (entity1 != entityIn && entity1.getEntityBoundingBox().intersects(aabb) && (filter == null || filter.apply(entity1)))
{
listToFill.add(entity1);
}
}
}
}
}
}
}
}
}复制代码
执行后出现意外错误:
报错内容链接:https://netcut.cn/p/c276dc78e7802d8b复制代码
项目代码链接:
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import org.spongepowered.asm.mixin.*;
import javax.annotation.Nullable;
import java.util.List;
@Mixin(value = Chunk.class)
public abstract class MixinChunk {
@Shadow
@Final
private ClassInheritanceMultiMap[] entityLists;
/**
* [url=home.php?mod=space&uid=1231151]@author[/url] soys
*/
@Overwrite
public void getEntitiesWithinAABBForEntity(@Nullable Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate filter) {
int i = MathHelper.floor((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
int j = MathHelper.floor((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.clamp(i, 0, this.entityLists.length - 1);
j = MathHelper.clamp(j, 0, this.entityLists.length - 1);
for (int k = i; k
{
if (!this.entityLists[k].isEmpty())
{
for (Entity entity : this.entityLists[k])
{
if(entity instanceof EntityPlayer) {
System.out.println("test:1");
}
if (entity.getEntityBoundingBox().intersects(aabb) && entity != entityIn)
{
if (filter == null || filter.apply(entity))
{
listToFill.add(entity);
}
Entity[] aentity = entity.getParts();
if (aentity != null)
{
for (Entity entity1 : aentity)
{
if (entity1 != entityIn && entity1.getEntityBoundingBox().intersects(aabb) && (filter == null || filter.apply(entity1)))
{
listToFill.add(entity1);
}
}
}
}
}
}
}
}
}复制代码
执行后出现意外错误:
报错内容链接:https://netcut.cn/p/c276dc78e7802d8b复制代码
项目代码链接: