mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 15:46:01 +00:00
Start work on balloon entity base raytrace
This commit is contained in:
1 parent
ddae9ed34b
commit
54b4e75bc2
1 file changed
+19
@@ -11,6 +11,7 @@ import net.minecraft.client.particle.EntityReddustFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -196,10 +197,28 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
|
||||
}
|
||||
else if(latchedEntity != null && latchedEntity.getHealth() > 0)
|
||||
{
|
||||
int floor = getFloor(latchedEntity);
|
||||
setPosition(posX = latchedEntity.posX, posY = latchedEntity.posY + 3F, posZ = latchedEntity.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
private int getFloor(EntityLivingBase entity)
|
||||
{
|
||||
int xPos = MathHelper.floor_double(entity.posX);
|
||||
int yPos = MathHelper.floor_double(entity.posY);
|
||||
int zPos = MathHelper.floor_double(entity.posZ);
|
||||
|
||||
for(int i = yPos; i > 0; i--)
|
||||
{
|
||||
if(!worldObj.isAirBlock(xPos, i, zPos))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void findCachedEntity()
|
||||
{
|
||||
for(Object obj : worldObj.loadedEntityList)
|
||||
|
||||
Reference in new issue
Block a user