@@ -0,0 +1,1288 @@
+package cd4017be.indlog.tileentity;%0A%0Aimport cd4017be.lib.tileentity.BaseTileEntity;%0Aimport net.minecraft.entity.Entity;%0Aimport net.minecraft.util.EnumFacing;%0Aimport net.minecraft.util.math.AxisAlignedBB;%0Aimport net.minecraft.util.math.BlockPos;%0Aimport net.minecraftforge.common.capabilities.Capability;%0A%0A/**%0A * %0A * @author cd4017be%0A */%0Apublic class EntityInterface extends BaseTileEntity %7B%0A%0A%09public static int INTERVAL;%0A%0A%09private Entity entity;%0A%09private long lastCheck;%0A%0A%09private void getEntity(Capability%3C?%3E cap, EnumFacing side) %7B%0A%09%09long t = world.getTotalWorldTime();%0A%09%09if (t - lastCheck %3E= INTERVAL) %7B%0A%09%09%09lastCheck = t;%0A%09%09%09entity = null;%0A%09%09%09BlockPos pos = this.pos.offset(getOrientation().front);%0A%09%09%09for (Entity e : world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)))) %7B%0A%09%09%09%09if (entity == null %7C%7C e.hasCapability(cap, side))%0A%09%09%09%09%09entity = e;%0A%09%09%09%7D%0A%09%09%7D else if (entity != null && entity.isDead) entity = null;%0A%09%7D%0A%0A%09@Override%0A%09public boolean hasCapability(Capability%3C?%3E cap, EnumFacing side) %7B%0A%09%09getEntity(cap, side);%0A%09%09return entity != null && entity.hasCapability(cap, side);%0A%09%7D%0A%0A%09@Override%0A%09public %3CT%3E T getCapability(Capability%3CT%3E cap, EnumFacing side) %7B%0A%09%09getEntity(cap, side);%0A%09%09return entity == null ? null : entity.getCapability(cap, side);%0A%09%7D%0A%0A%7D%0A

create TileEntity for new feature: entity interface