Balloons are cool :)

This commit is contained in:
Aidan C. Brady 2014-01-08 14:56:54 -05:00
parent 54b4e75bc2
commit 2600f8fe81
4 changed files with 21 additions and 7 deletions

View file

@ -44,7 +44,7 @@ public class RenderBalloon extends Render
y -= RenderManager.renderPosY; y -= RenderManager.renderPosY;
z -= RenderManager.renderPosZ; z -= RenderManager.renderPosZ;
y += 3; y += (balloon.latchedEntity.height/2) + 2.2F;
} }
render(((EntityBalloon)entity).color, x, y, z); render(((EntityBalloon)entity).color, x, y, z);

View file

@ -5,6 +5,7 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;

View file

@ -68,7 +68,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
this(entity.worldObj); this(entity.worldObj);
latchedEntity = entity; latchedEntity = entity;
setPosition(latchedEntity.posX, latchedEntity.posY + 3F, latchedEntity.posZ); setPosition(latchedEntity.posX, latchedEntity.posY + (latchedEntity.height/2) + 2.2F, latchedEntity.posZ);
prevPosX = posX; prevPosX = posX;
prevPosY = posY; prevPosY = posY;
@ -198,7 +198,20 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
else if(latchedEntity != null && latchedEntity.getHealth() > 0) else if(latchedEntity != null && latchedEntity.getHealth() > 0)
{ {
int floor = getFloor(latchedEntity); int floor = getFloor(latchedEntity);
setPosition(posX = latchedEntity.posX, posY = latchedEntity.posY + 3F, posZ = latchedEntity.posZ);
if(latchedEntity.posY-(floor+1) < -0.1)
{
latchedEntity.motionY = Math.max(0.04, latchedEntity.motionY*1.015);
}
else if(latchedEntity.posY-(floor+1) > 0.1)
{
latchedEntity.motionY = Math.min(-0.04, latchedEntity.motionY*1.015);
}
else {
latchedEntity.motionY = 0;
}
setPosition(latchedEntity.posX, latchedEntity.posY + (latchedEntity.height/2) + 2.2F, latchedEntity.posZ);
} }
} }
@ -210,9 +223,9 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
for(int i = yPos; i > 0; i--) for(int i = yPos; i > 0; i--)
{ {
if(!worldObj.isAirBlock(xPos, i, zPos)) if(i < 256 && !worldObj.isAirBlock(xPos, i, zPos))
{ {
return i; return i+1;
} }
} }

View file

@ -55,10 +55,10 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
{ {
super(world); super(world);
setSize(0.5F, 0.5F); setSize(0.3F, 0.3F);
getNavigator().setAvoidsWater(true); getNavigator().setAvoidsWater(true);
tasks.addTask(1, new RobitAIPickup(this, 1.0F)); tasks.addTask(1, new RobitAIPickup(this, 1.0F));
tasks.addTask(2, new RobitAIFollow(this, 1.0F, 10.0F, 2.0F)); tasks.addTask(2, new RobitAIFollow(this, 1.0F, 10.0F, 2.0F));
tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));