Skip to content

Commit

Permalink
Try to add destroyed boat to player inventory instead of dropping as …
Browse files Browse the repository at this point in the history
…item, fixing Flaxbeard#157
  • Loading branch information
Flaxbeard committed May 6, 2020
1 parent 3ccb11d commit 7961df1
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -200,7 +201,20 @@ else if (!this.world.isRemote && !this.isDead)
stack.setTagCompound(new NBTTagCompound());
item.setContainedItems(stack, contained);
writeTank(stack.getTagCompound(), true);
this.entityDropItem(stack, 0F);

if (source.getImmediateSource() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) source.getImmediateSource();
if (!player.addItemStackToInventory(stack))
{
EntityItem entityitem = new EntityItem(this.world, player.posX, player.posY, player.posZ, stack);
world.spawnEntity(entityitem);
}
}
else
{
this.entityDropItem(stack, 0F);
}
}

this.setDead();
Expand Down

0 comments on commit 7961df1

Please sign in to comment.