mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 15:42:19 -07:00
Update to Minecraft 1.13-pre7
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/server/ItemStack.java
|
||||
+++ b/net/minecraft/server/ItemStack.java
|
||||
@@ -6,6 +6,19 @@
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -16,6 +16,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.datafixers.Dynamic;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+
|
||||
@@ -19,291 +20,211 @@
|
||||
+
|
||||
public final class ItemStack {
|
||||
|
||||
public static final ItemStack a = new ItemStack((Item) null);
|
||||
@@ -42,32 +55,74 @@
|
||||
this(item, i, 0);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public ItemStack(Item item, int i, int j) {
|
||||
+ this(item, i, j, true);
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack(Item item, int i, int j, boolean convert) {
|
||||
+ // CraftBukkit end
|
||||
this.item = item;
|
||||
this.damage = j;
|
||||
this.count = i;
|
||||
+ // CraftBukkit start - Pass to setData to do filtering
|
||||
+ if (MinecraftServer.getServer() != null) {
|
||||
+ this.setData(j);
|
||||
+ }
|
||||
+ if (convert) {
|
||||
+ this.convertStack();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.damage < 0) {
|
||||
- this.damage = 0;
|
||||
+ // this.damage = 0; // CraftBukkit - remove this.
|
||||
}
|
||||
|
||||
this.F();
|
||||
private static final Logger c = LogManager.getLogger();
|
||||
@@ -50,25 +64,43 @@
|
||||
this.E();
|
||||
}
|
||||
|
||||
+ // Called to run this stack through the data converter to handle older storage methods and serialized items
|
||||
+ public void convertStack() {
|
||||
+ if (MinecraftServer.getServer() != null) {
|
||||
+ // Don't convert beds - both the old and new data values are valid
|
||||
+ // Conversion would make getting white beds (data value 0) impossible
|
||||
+ if (this.item == Items.BED) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ NBTTagCompound savedStack = new NBTTagCompound();
|
||||
+ this.save(savedStack);
|
||||
+ MinecraftServer.getServer().dataConverterManager.a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
|
||||
+ MinecraftServer.getServer().dataConverterManager.update(DataConverterTypes.ITEM_STACK, new Dynamic(DynamicOpsNBT.a, savedStack), -1, CraftMagicNumbers.DATA_VERSION);
|
||||
+ this.load(savedStack);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private void F() {
|
||||
+ if (this.g && this == ItemStack.a) throw new AssertionError("TRAP"); // CraftBukkit
|
||||
this.g = this.isEmpty();
|
||||
private void E() {
|
||||
+ if (this.h && this == ItemStack.a) throw new AssertionError("TRAP"); // CraftBukkit
|
||||
this.h = false;
|
||||
this.h = this.isEmpty();
|
||||
}
|
||||
|
||||
- public ItemStack(NBTTagCompound nbttagcompound) {
|
||||
- private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ // CraftBukkit - break into own method
|
||||
+ public void load(NBTTagCompound nbttagcompound) {
|
||||
this.item = Item.b(nbttagcompound.getString("id"));
|
||||
+ private void load(NBTTagCompound nbttagcompound) {
|
||||
Item item = (Item) Item.REGISTRY.get(new MinecraftKey(nbttagcompound.getString("id")));
|
||||
|
||||
this.item = item == null ? Items.AIR : item;
|
||||
this.count = nbttagcompound.getByte("Count");
|
||||
- this.damage = Math.max(0, nbttagcompound.getShort("Damage"));
|
||||
+ // CraftBukkit start - Route through setData for filtering
|
||||
+ // this.damage = Math.max(0, nbttagcompound.getShort("Damage"));
|
||||
+ this.setData(nbttagcompound.getShort("Damage"));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (nbttagcompound.hasKeyOfType("tag", 10)) {
|
||||
- this.tag = nbttagcompound.getCompound("tag");
|
||||
- this.getItem().a(nbttagcompound);
|
||||
+ // CraftBukkit start - make defensive copy as this data may be coming from the save thread
|
||||
+ this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
|
||||
if (this.item != null) {
|
||||
- this.item.a(nbttagcompound);
|
||||
+ this.item.a(this.tag);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ this.getItem().a(this.tag);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.getItem().usesDurability()) {
|
||||
this.setDamage(this.getDamage());
|
||||
}
|
||||
+ }
|
||||
|
||||
+ public ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ this.load(nbttagcompound);
|
||||
+ // CraftBukkit end
|
||||
this.F();
|
||||
this.E();
|
||||
}
|
||||
|
||||
@@ -94,11 +149,138 @@
|
||||
@@ -98,7 +130,7 @@
|
||||
return this.h ? Items.AIR : this.item;
|
||||
}
|
||||
|
||||
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
+ // CraftBukkit start - handle all block place event logic here
|
||||
+ int oldData = this.getData();
|
||||
+ int oldCount = this.getCount();
|
||||
- public EnumInteractionResult placeItem(ItemActionContext itemactioncontext) {
|
||||
+ public EnumInteractionResult placeItem(ItemActionContext itemactioncontext, EnumHand enumhand) { // CraftBukkit - add hand
|
||||
EntityHuman entityhuman = itemactioncontext.getEntity();
|
||||
BlockPosition blockposition = itemactioncontext.getClickPosition();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
|
||||
@@ -106,12 +138,124 @@
|
||||
if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().E(), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
+ // CraftBukkit start - handle all block place event logic here
|
||||
+ int oldCount = this.getCount();
|
||||
+ World world = itemactioncontext.getWorld();
|
||||
+
|
||||
+ if (!(this.getItem() instanceof ItemBucket)) { // if not bucket
|
||||
+ world.captureBlockStates = true;
|
||||
+ // special case bonemeal
|
||||
+ if (this.getItem() instanceof ItemDye && this.getData() == 15) {
|
||||
+ Block block = world.getType(blockposition).getBlock();
|
||||
+ if (block == Blocks.SAPLING || block instanceof BlockMushroom) {
|
||||
+ world.captureTreeGeneration = true;
|
||||
+ if (!(this.getItem() instanceof ItemBucket)) { // if not bucket
|
||||
+ world.captureBlockStates = true;
|
||||
+ // special case bonemeal
|
||||
+ if (this.getItem() == Items.BONE_MEAL) {
|
||||
+ Block block = world.getType(blockposition).getBlock();
|
||||
+ if (block instanceof BlockSapling || block instanceof BlockMushroom) {
|
||||
+ world.captureTreeGeneration = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
EnumInteractionResult enuminteractionresult = this.getItem().a(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2);
|
||||
+ int newData = this.getData();
|
||||
+ int newCount = this.getCount();
|
||||
+ this.setCount(oldCount);
|
||||
+ this.setData(oldData);
|
||||
+ world.captureBlockStates = false;
|
||||
+ if (enuminteractionresult == EnumInteractionResult.SUCCESS && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) {
|
||||
Item item = this.getItem();
|
||||
EnumInteractionResult enuminteractionresult = item.a(itemactioncontext);
|
||||
+ int newCount = this.getCount();
|
||||
+ this.setCount(oldCount);
|
||||
+ world.captureBlockStates = false;
|
||||
+ if (enuminteractionresult == EnumInteractionResult.SUCCESS && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) {
|
||||
+ world.captureTreeGeneration = false;
|
||||
+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent event = null;
|
||||
+ if (treeType != null) {
|
||||
+ boolean isBonemeal = getItem() == Items.BONE_MEAL;
|
||||
+ event = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event == null || !event.isCancelled()) {
|
||||
+ // Change the stack to its new contents if it hasn't been tampered with.
|
||||
+ if (this.getCount() == oldCount) {
|
||||
+ this.setCount(newCount);
|
||||
+ }
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return enuminteractionresult;
|
||||
+ }
|
||||
+ world.captureTreeGeneration = false;
|
||||
+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent event = null;
|
||||
+ if (treeType != null) {
|
||||
+ boolean isBonemeal = getItem() == Items.DYE && oldData == 15;
|
||||
+ event = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event == null || !event.isCancelled()) {
|
||||
+ // Change the stack to its new contents if it hasn't been tampered with.
|
||||
+ if (this.getCount() == oldCount && this.getData() == oldData) {
|
||||
+ this.setData(newData);
|
||||
+ this.setCount(newCount);
|
||||
+ }
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return enuminteractionresult;
|
||||
+ }
|
||||
+ world.captureTreeGeneration = false;
|
||||
|
||||
if (enuminteractionresult == EnumInteractionResult.SUCCESS) {
|
||||
- entityhuman.b(StatisticList.b(this.item));
|
||||
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = null;
|
||||
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ if (blocks.size() > 1) {
|
||||
+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ } else if (blocks.size() == 1) {
|
||||
+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ }
|
||||
+
|
||||
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||
+ enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
|
||||
+ // PAIL: Remove this when MC-99075 fixed
|
||||
+ placeEvent.getPlayer().updateInventory();
|
||||
+ // revert back all captured blocks
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true, false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Change the stack to its new contents if it hasn't been tampered with.
|
||||
+ if (this.getCount() == oldCount && this.getData() == oldData) {
|
||||
+ this.setData(newData);
|
||||
+ this.setCount(newCount);
|
||||
if (entityhuman != null && enuminteractionresult == EnumInteractionResult.SUCCESS) {
|
||||
- entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = null;
|
||||
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ if (blocks.size() > 1) {
|
||||
+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ } else if (blocks.size() == 1) {
|
||||
+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ }
|
||||
+
|
||||
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
|
||||
+ world.setTileEntity(e.getKey(), e.getValue());
|
||||
+ }
|
||||
+
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ int x = blockstate.getX();
|
||||
+ int y = blockstate.getY();
|
||||
+ int z = blockstate.getZ();
|
||||
+ int updateFlag = ((CraftBlockState) blockstate).getFlag();
|
||||
+ org.bukkit.Material mat = blockstate.getType();
|
||||
+ Block oldBlock = CraftMagicNumbers.getBlock(mat);
|
||||
+ BlockPosition newblockposition = new BlockPosition(x, y, z);
|
||||
+ IBlockData block = world.getType(newblockposition);
|
||||
+
|
||||
+ if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically
|
||||
+ block.getBlock().onPlace(world, newblockposition, block);
|
||||
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||
+ enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
|
||||
+ // PAIL: Remove this when MC-99075 fixed
|
||||
+ placeEvent.getPlayer().updateInventory();
|
||||
+ // revert back all captured blocks
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true, false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Change the stack to its new contents if it hasn't been tampered with.
|
||||
+ if (this.getCount() == oldCount) {
|
||||
+ this.setCount(newCount);
|
||||
+ }
|
||||
+
|
||||
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock.getBlockData(), block, updateFlag); // send null chunk as chunk.k() returns false by this point
|
||||
+ }
|
||||
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
|
||||
+ world.setTileEntity(e.getKey(), e.getValue());
|
||||
+ }
|
||||
+
|
||||
+ // Special case juke boxes as they update their tile entity. Copied from ItemRecord.
|
||||
+ // PAIL: checkme on updates.
|
||||
+ if (this.item instanceof ItemRecord) {
|
||||
+ ((BlockJukeBox) Blocks.JUKEBOX).a(world, blockposition, world.getType(blockposition), this);
|
||||
+ world.a((EntityHuman) null, 1010, blockposition, Item.getId(this.item));
|
||||
+ this.subtract(1);
|
||||
+ entityhuman.b(StatisticList.Z);
|
||||
+ }
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ int x = blockstate.getX();
|
||||
+ int y = blockstate.getY();
|
||||
+ int z = blockstate.getZ();
|
||||
+ int updateFlag = ((CraftBlockState) blockstate).getFlag();
|
||||
+ IBlockData oldBlock = ((CraftBlockState) blockstate).getHandle();
|
||||
+ BlockPosition newblockposition = new BlockPosition(x, y, z);
|
||||
+ IBlockData block = world.getType(newblockposition);
|
||||
+
|
||||
+ if (this.item == Items.SKULL) { // Special case skulls to allow wither spawns to be cancelled
|
||||
+ BlockPosition bp = blockposition;
|
||||
+ if (!world.getType(blockposition).getBlock().a(world, blockposition)) {
|
||||
+ if (!world.getType(blockposition).getMaterial().isBuildable()) {
|
||||
+ bp = null;
|
||||
+ } else {
|
||||
+ bp = bp.shift(enumdirection);
|
||||
+ if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically
|
||||
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock);
|
||||
+ }
|
||||
+
|
||||
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag); // send null chunk as chunk.k() returns false by this point
|
||||
+ }
|
||||
+ if (bp != null) {
|
||||
+ TileEntity te = world.getTileEntity(bp);
|
||||
+
|
||||
+ // Special case juke boxes as they update their tile entity. Copied from ItemRecord.
|
||||
+ // PAIL: checkme on updates.
|
||||
+ if (this.item instanceof ItemRecord) {
|
||||
+ ((BlockJukeBox) Blocks.JUKEBOX).a(world, blockposition, world.getType(blockposition), this);
|
||||
+ world.a((EntityHuman) null, 1010, blockposition, Item.getId(this.item));
|
||||
+ this.subtract(1);
|
||||
+ entityhuman.a(StatisticList.PLAY_RECORD);
|
||||
+ }
|
||||
+
|
||||
+ if (this.item == Items.WITHER_SKELETON_SKULL) { // Special case skulls to allow wither spawns to be cancelled
|
||||
+ TileEntity te = world.getTileEntity(blockposition);
|
||||
+ if (te instanceof TileEntitySkull) {
|
||||
+ Blocks.SKULL.a(world, bp, (TileEntitySkull) te);
|
||||
+ BlockWitherSkull.a(world, blockposition, (TileEntitySkull) te);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-1288 - play sound stripped from ItemBlock
|
||||
+ if (this.item instanceof ItemBlock) {
|
||||
+ SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().getStepSound();
|
||||
+ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F);
|
||||
+ }
|
||||
+ // SPIGOT-1288 - play sound stripped from ItemBlock
|
||||
+ if (this.item instanceof ItemBlock) {
|
||||
+ SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().getStepSound();
|
||||
+ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F);
|
||||
+ }
|
||||
+
|
||||
+ entityhuman.b(StatisticList.b(this.item));
|
||||
+ }
|
||||
}
|
||||
+ world.capturedTileEntities.clear();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ // CraftBukkit end
|
||||
+ entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
+ }
|
||||
}
|
||||
+ world.capturedTileEntities.clear();
|
||||
+ world.capturedBlockStates.clear();
|
||||
+ // CraftBukkit end
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -122,7 +304,7 @@
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -135,7 +279,7 @@
|
||||
nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
||||
nbttagcompound.setByte("Count", (byte) this.count);
|
||||
nbttagcompound.setShort("Damage", (short) this.damage);
|
||||
if (this.tag != null) {
|
||||
- nbttagcompound.set("tag", this.tag);
|
||||
+ nbttagcompound.set("tag", this.tag.clone()); // CraftBukkit - make defensive copy, data is going to another thread
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
@@ -157,11 +339,30 @@
|
||||
}
|
||||
|
||||
public void setData(int i) {
|
||||
+ // CraftBukkit start - Filter out data for items that shouldn't have it
|
||||
+ // The crafting system uses this value for a special purpose so we have to allow it
|
||||
+ if (i == 32767) {
|
||||
+ this.damage = i;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Is this a block?
|
||||
+ if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) != Blocks.AIR) {
|
||||
+ // If vanilla doesn't use data on it don't allow any
|
||||
+ if (!(this.usesData() || this.getItem().usesDurability())) {
|
||||
+ i = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Filter invalid plant data
|
||||
+ if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) == Blocks.DOUBLE_PLANT && (i > 5 || i < 0)) {
|
||||
+ i = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.damage = i;
|
||||
if (this.damage < 0) {
|
||||
- this.damage = 0;
|
||||
+ // this.damage = 0; // CraftBukkit - remove this.
|
||||
}
|
||||
-
|
||||
}
|
||||
|
||||
public int k() {
|
||||
@@ -202,6 +403,11 @@
|
||||
if (this.f()) {
|
||||
@@ -213,6 +357,11 @@
|
||||
if (this.isDamaged(i, entityliving.getRandom(), entityliving instanceof EntityPlayer ? (EntityPlayer) entityliving : null)) {
|
||||
entityliving.b(this);
|
||||
entityliving.c(this);
|
||||
Item item = this.getItem();
|
||||
+ // CraftBukkit start - Check for item breaking
|
||||
+ if (this.count == 1 && entityliving instanceof EntityHuman) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.subtract(1);
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
@@ -243,7 +449,7 @@
|
||||
}
|
||||
|
||||
public ItemStack cloneItemStack() {
|
||||
- ItemStack itemstack = new ItemStack(this.item, this.count, this.damage);
|
||||
+ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage, false); // CraftBukkit
|
||||
|
||||
itemstack.d(this.D());
|
||||
if (this.tag != null) {
|
||||
@@ -464,6 +670,14 @@
|
||||
@@ -480,6 +629,14 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
@@ -315,19 +236,20 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.hasTag()) {
|
||||
this.tag = new NBTTagCompound();
|
||||
}
|
||||
@@ -513,6 +727,12 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
this.getOrCreateTag().setInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -522,6 +679,13 @@
|
||||
nbttaglist.add((NBTBase) nbttagcompound);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Deprecated
|
||||
+ public void setItem(Item item) {
|
||||
+ this.item = item;
|
||||
+ this.setData(this.getData()); // CraftBukkit - Set data again to ensure it is filtered properly
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public IChatBaseComponent C() {
|
||||
ChatComponentText chatcomponenttext = new ChatComponentText(this.getName());
|
||||
public IChatBaseComponent A() {
|
||||
IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).addSibling(this.getName());
|
||||
|
||||
|
Reference in New Issue
Block a user