/// <summary> /// Scatters all the contents of a container, used when the player dies. /// </summary> private void scatterContainerContents(World world, ContainerData containerData) { ItemStack[] items = containerData.getRawItemArray(); for (int i = 0; i < items.Length; i++) { ItemStack stack = items[i]; if (stack != null) { this.world.spawnItem(items[i], this.transform.position, EntityItem.randomRotation(), EntityItem.randomForce(1.5f)); items[i] = null; } } }
private void dropAsItem() { this.world.spawnItem(new ItemStack(this.block, this.meta), this.transform.position, EntityItem.randomRotation(), EntityItem.randomForce(1f)); this.world.killEntity(this); }