Fixed issue with enchantments reseting under certain conditions
Dieser Commit ist enthalten in:
Ursprung
139ad8c34a
Commit
894ab9f949
@ -37,6 +37,7 @@ import org.bukkit.block.Biome;
|
|||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.Difficulty;
|
import org.bukkit.Difficulty;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
|
|
||||||
public class CraftWorld implements World {
|
public class CraftWorld implements World {
|
||||||
private final WorldServer world;
|
private final WorldServer world;
|
||||||
@ -290,12 +291,8 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) {
|
public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) {
|
||||||
net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(
|
CraftItemStack clone = new CraftItemStack(item);
|
||||||
item.getTypeId(),
|
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), clone.getHandle());
|
||||||
item.getAmount(),
|
|
||||||
item.getDurability()
|
|
||||||
);
|
|
||||||
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
|
|
||||||
entity.pickupDelay = 10;
|
entity.pickupDelay = 10;
|
||||||
world.addEntity(entity);
|
world.addEntity(entity);
|
||||||
// TODO this is inconsistent with how Entity.getBukkitEntity() works.
|
// TODO this is inconsistent with how Entity.getBukkitEntity() works.
|
||||||
|
@ -26,6 +26,7 @@ public class CraftItemStack extends ItemStack {
|
|||||||
|
|
||||||
public CraftItemStack(ItemStack item) {
|
public CraftItemStack(ItemStack item) {
|
||||||
this(item.getTypeId(), item.getAmount(), item.getDurability());
|
this(item.getTypeId(), item.getAmount(), item.getDurability());
|
||||||
|
addEnchantments(item.getEnchantments());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'Overwritten' constructors from ItemStack, yay for Java sucking */
|
/* 'Overwritten' constructors from ItemStack, yay for Java sucking */
|
||||||
@ -202,4 +203,8 @@ public class CraftItemStack extends ItemStack {
|
|||||||
|
|
||||||
tag.a("ench", (NBTBase)list);
|
tag.a("ench", (NBTBase)list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public net.minecraft.server.ItemStack getHandle() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren