Fixed parachutes.
This commit is contained in:
parent
44efcdeb92
commit
921cc02833
|
@ -150,13 +150,13 @@ public class EntityParachute extends Entity implements IEntityAdditionalSpawnDat
|
|||
@Override
|
||||
public void writeSpawnData(ByteBuf buffer) {
|
||||
buffer.writeBoolean(this.isGoldenParachute);
|
||||
buffer.writeInt(this.ridingPlayer == null ? 0 : this.ridingPlayer.getEntityId());
|
||||
buffer.writeInt(this.ridingPlayer.getEntityId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf buffer) {
|
||||
this.isGoldenParachute = buffer.readBoolean();
|
||||
this.ridingPlayer = buffer.readInt() == 0 ? null : (EntityPlayer) this.worldObj.getEntityByID(buffer.readInt());
|
||||
this.ridingPlayer = (EntityPlayer) this.worldObj.getEntityByID(buffer.readInt());
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,8 @@ import java.util.Arrays;
|
|||
import java.util.UUID;
|
||||
|
||||
import com.legacy.aether.Aether;
|
||||
import com.legacy.aether.entities.passive.mountable.EntityParachute;
|
||||
import com.legacy.aether.items.ItemsAether;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -126,6 +128,11 @@ public class PlayerAether implements IPlayerAether {
|
|||
this.getEntity().fallDistance = 0.0F;
|
||||
}
|
||||
|
||||
if (this.getEntity().motionY < -2F)
|
||||
{
|
||||
this.activateParachute();
|
||||
}
|
||||
|
||||
if (!this.getEntity().onGround) {
|
||||
this.wingSinage += 0.75F;
|
||||
} else {
|
||||
|
@ -259,6 +266,38 @@ public class PlayerAether implements IPlayerAether {
|
|||
}
|
||||
}
|
||||
|
||||
private void activateParachute()
|
||||
{
|
||||
EntityParachute parachute = null;
|
||||
|
||||
if(this.getEntity().inventory.hasItemStack(new ItemStack(ItemsAether.cloud_parachute)))
|
||||
{
|
||||
parachute = new EntityParachute(this.getEntity().worldObj, this.getEntity(), false);
|
||||
parachute.setPosition(this.getEntity().posX, this.getEntity().posY, this.getEntity().posZ);
|
||||
this.getEntity().worldObj.spawnEntityInWorld(parachute);
|
||||
this.getEntity().inventory.consumeInventoryItem(ItemsAether.cloud_parachute);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.getEntity().inventory.hasItemStack(new ItemStack(ItemsAether.golden_parachute)))
|
||||
{
|
||||
for(int i = 0; i < this.getEntity().inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemstack = this.getEntity().inventory.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() == ItemsAether.golden_parachute)
|
||||
{
|
||||
itemstack.damageItem(1, this.getEntity());
|
||||
parachute = new EntityParachute(this.getEntity().worldObj, this.getEntity(), true);
|
||||
parachute.setPosition(this.getEntity().posX, this.getEntity().posY, this.getEntity().posZ);
|
||||
this.getEntity().inventory.setInventorySlotContents(i, itemstack);
|
||||
this.getEntity().worldObj.spawnEntityInWorld(parachute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInsideBlock(Block block) {
|
||||
AxisAlignedBB boundingBox = this.getEntity().boundingBox;
|
||||
int i = MathHelper.floor_double(boundingBox.minX);
|
||||
|
|
Loading…
Reference in a new issue