@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBucket.java
|
||||
+++ b/net/minecraft/world/item/ItemBucket.java
|
||||
@@ -30,6 +30,16 @@
|
||||
@@ -29,6 +29,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public class ItemBucket extends Item implements DispensibleContainerItem {
|
||||
|
||||
public final FluidType content;
|
||||
@@ -60,6 +70,17 @@
|
||||
@@ -59,6 +69,17 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
||||
@@ -35,7 +35,7 @@
|
||||
ItemStack itemstack1 = ifluidsource.pickupBlock(world, blockposition, iblockdata);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
@@ -68,7 +89,7 @@
|
||||
@@ -67,7 +88,7 @@
|
||||
entityhuman.playSound(soundeffect, 1.0F, 1.0F);
|
||||
});
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.FLUID_PICKUP, blockposition);
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
if (!world.isClientSide) {
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
@@ -83,7 +104,7 @@
|
||||
@@ -82,7 +103,7 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.content == FluidTypes.WATER ? blockposition : blockposition1;
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
this.checkExtraContent(entityhuman, world, itemstack, blockposition2);
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition2, itemstack);
|
||||
@@ -110,6 +131,12 @@
|
||||
@@ -109,6 +130,12 @@
|
||||
|
||||
@Override
|
||||
public boolean emptyContents(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
@@ -66,7 +66,7 @@
|
||||
if (!(this.content instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -119,8 +146,18 @@
|
||||
@@ -117,8 +144,18 @@
|
||||
boolean flag = iblockdata.canBeReplaced(this.content);
|
||||
boolean flag1 = iblockdata.isAir() || flag || block instanceof IFluidContainer && ((IFluidContainer) block).canPlaceLiquid(world, blockposition, iblockdata, this.content);
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/world/item/ItemDye.java
|
||||
+++ b/net/minecraft/world/item/ItemDye.java
|
||||
@@ -11,6 +11,8 @@
|
||||
import net.minecraft.world.entity.animal.EntitySheep;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.entity.TileEntitySign;
|
||||
|
||||
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
||||
+
|
||||
public class ItemDye extends Item {
|
||||
public class ItemDye extends Item implements SignApplicator {
|
||||
|
||||
private static final Map<EnumColor, ItemDye> ITEM_BY_COLOR = Maps.newEnumMap(EnumColor.class);
|
||||
@@ -30,7 +32,17 @@
|
||||
@@ -32,7 +34,17 @@
|
||||
if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.dyeColor) {
|
||||
entitysheep.level.playSound(entityhuman, (Entity) entitysheep, SoundEffects.DYE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
if (!entityhuman.level.isClientSide) {
|
||||
entitysheep.level().playSound(entityhuman, (Entity) entitysheep, SoundEffects.DYE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
if (!entityhuman.level().isClientSide) {
|
||||
- entitysheep.setColor(this.dyeColor);
|
||||
+ // CraftBukkit start
|
||||
+ byte bColor = (byte) this.dyeColor.getId();
|
||||
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor), (org.bukkit.entity.Player) entityhuman.getBukkitEntity());
|
||||
+ entitysheep.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ entitysheep.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
+ // CraftBukkit end
|
||||
world.addFreshEntity(entityendercrystal);
|
||||
world.gameEvent((Entity) itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition1);
|
||||
EnderDragonBattle enderdragonbattle = ((WorldServer) world).dragonFight();
|
||||
EnderDragonBattle enderdragonbattle = ((WorldServer) world).getDragonFight();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemMonsterEgg.java
|
||||
+++ b/net/minecraft/world/item/ItemMonsterEgg.java
|
||||
@@ -186,7 +186,7 @@
|
||||
@@ -185,7 +185,7 @@
|
||||
return Optional.empty();
|
||||
} else {
|
||||
((EntityInsentient) object).moveTo(vec3d.x(), vec3d.y(), vec3d.z(), 0.0F, 0.0F);
|
||||
@@ -9,7 +9,7 @@
|
||||
if (itemstack.hasCustomHoverName()) {
|
||||
((EntityInsentient) object).setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
@@ -195,7 +195,7 @@
|
||||
@@ -194,7 +194,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemSign.java
|
||||
+++ b/net/minecraft/world/item/ItemSign.java
|
||||
@@ -11,6 +11,8 @@
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
public class ItemSign extends ItemBlockWallable {
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
public ItemSign(Item.Info item_info, Block block, Block block1) {
|
||||
super(block, block1, item_info, EnumDirection.DOWN);
|
||||
}
|
||||
@@ -20,7 +22,10 @@
|
||||
boolean flag = super.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata);
|
||||
@@ -35,7 +37,10 @@
|
||||
if (block instanceof BlockSign) {
|
||||
BlockSign blocksign = (BlockSign) block;
|
||||
|
||||
if (!world.isClientSide && !flag && entityhuman != null) {
|
||||
- entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(blockposition));
|
||||
+ // CraftBukkit start - SPIGOT-4678
|
||||
+ // entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(blockposition));
|
||||
+ ItemSign.openSign = blockposition;
|
||||
+ // CraftBukkit end
|
||||
- blocksign.openTextEdit(entityhuman, tileentitysign, true);
|
||||
+ // CraftBukkit start - SPIGOT-4678
|
||||
+ // blocksign.openTextEdit(entityhuman, tileentitysign, true);
|
||||
+ ItemSign.openSign = blockposition;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -75,6 +75,42 @@
|
||||
@@ -76,6 +76,43 @@
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
+import net.minecraft.world.level.block.BlockBed;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import net.minecraft.world.level.block.BlockSapling;
|
||||
+import net.minecraft.world.level.block.BlockSign;
|
||||
+import net.minecraft.world.level.block.BlockTileEntity;
|
||||
+import net.minecraft.world.level.block.BlockWitherSkull;
|
||||
+import net.minecraft.world.level.block.SoundEffectType;
|
||||
@@ -43,10 +44,11 @@
|
||||
public final class ItemStack {
|
||||
|
||||
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -151,16 +187,30 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
@@ -151,11 +188,24 @@
|
||||
this.item = null;
|
||||
}
|
||||
|
||||
- private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ // Called to run this stack through the data converter to handle older storage methods and serialized items
|
||||
+ public void convertStack(int version) {
|
||||
+ if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion()) {
|
||||
@@ -57,13 +59,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private void updateEmptyCacheFlag() {
|
||||
+ if (this.emptyCacheFlag && this == ItemStack.EMPTY) throw new AssertionError("TRAP"); // CraftBukkit
|
||||
this.emptyCacheFlag = false;
|
||||
this.emptyCacheFlag = this.isEmpty();
|
||||
}
|
||||
|
||||
- private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ // CraftBukkit - break into own method
|
||||
+ private void load(NBTTagCompound nbttagcompound) {
|
||||
this.item = (Item) BuiltInRegistries.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
|
||||
@@ -76,19 +71,19 @@
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -168,6 +218,11 @@
|
||||
this.setDamageValue(this.getDamageValue());
|
||||
}
|
||||
@@ -165,6 +215,11 @@
|
||||
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ this.load(nbttagcompound);
|
||||
+ // CraftBukkit end
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -225,7 +280,7 @@
|
||||
+ }
|
||||
+
|
||||
public static ItemStack of(NBTTagCompound nbttagcompound) {
|
||||
try {
|
||||
return new ItemStack(nbttagcompound);
|
||||
@@ -229,7 +284,7 @@
|
||||
return this.getItem().builtInRegistryHolder().tags();
|
||||
}
|
||||
|
||||
@@ -97,7 +92,7 @@
|
||||
EntityHuman entityhuman = itemactioncontext.getPlayer();
|
||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
|
||||
@@ -233,12 +288,182 @@
|
||||
@@ -237,12 +292,186 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(Registries.BLOCK), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
@@ -231,8 +226,8 @@
|
||||
+
|
||||
+ if (this.item == Items.WITHER_SKELETON_SKULL) { // Special case skulls to allow wither spawns to be cancelled
|
||||
+ BlockPosition bp = blockposition;
|
||||
+ if (!world.getBlockState(blockposition).getMaterial().isReplaceable()) {
|
||||
+ if (!world.getBlockState(blockposition).getMaterial().isSolid()) {
|
||||
+ if (!world.getBlockState(blockposition).canBeReplaced()) {
|
||||
+ if (!world.getBlockState(blockposition).isSolid()) {
|
||||
+ bp = null;
|
||||
+ } else {
|
||||
+ bp = bp.relative(itemactioncontext.getClickedFace());
|
||||
@@ -249,7 +244,11 @@
|
||||
+ // SPIGOT-4678
|
||||
+ if (this.item instanceof ItemSign && ItemSign.openSign != null) {
|
||||
+ try {
|
||||
+ entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(ItemSign.openSign));
|
||||
+ if (world.getBlockEntity(blockposition) instanceof TileEntitySign tileentitysign) {
|
||||
+ if (world.getBlockState(blockposition).getBlock() instanceof BlockSign blocksign) {
|
||||
+ blocksign.openTextEdit(entityhuman, tileentitysign, true);
|
||||
+ }
|
||||
+ }
|
||||
+ } finally {
|
||||
+ ItemSign.openSign = null;
|
||||
+ }
|
||||
@@ -281,7 +280,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -319,6 +544,21 @@
|
||||
@@ -323,6 +552,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@@ -303,7 +302,7 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -340,6 +580,11 @@
|
||||
@@ -344,6 +588,11 @@
|
||||
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
@@ -315,7 +314,7 @@
|
||||
|
||||
this.shrink(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -494,6 +739,17 @@
|
||||
@@ -492,6 +741,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@@ -333,7 +332,7 @@
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -864,6 +1120,12 @@
|
||||
@@ -862,6 +1122,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
@@ -346,7 +345,7 @@
|
||||
this.getOrCreateTag().putInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -913,6 +1175,13 @@
|
||||
@@ -911,6 +1177,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
--- a/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
|
||||
@@ -11,6 +11,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftSmithingRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
/** @deprecated */
|
||||
@Deprecated(forRemoval = true)
|
||||
public class LegacyUpgradeRecipe implements SmithingRecipe {
|
||||
@@ -86,6 +94,17 @@
|
||||
});
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+
|
||||
+ return recipe;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static class a implements RecipeSerializer<LegacyUpgradeRecipe> {
|
||||
|
||||
public a() {}
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (exact) {
|
||||
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.tagMatches(itemstack, itemstack1)) {
|
||||
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.isSameItemSameTags(itemstack, itemstack1)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
+++ b/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
@@ -56,8 +56,11 @@
|
||||
@@ -55,8 +55,11 @@
|
||||
IBlockData iblockdata2 = world.getBlockState(blockposition1);
|
||||
|
||||
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.getValue(BlockFluids.LEVEL) == 0 && iblockdata.canSurvive(world, blockposition1) && world.isUnobstructed(iblockdata, blockposition1, VoxelShapeCollision.empty())) {
|
||||
if (iblockdata2 == BlockIceFrost.meltsInto() && iblockdata.canSurvive(world, blockposition1) && world.isUnobstructed(iblockdata, blockposition1, VoxelShapeCollision.empty())) {
|
||||
- world.setBlockAndUpdate(blockposition1, iblockdata);
|
||||
- world.scheduleTick(blockposition1, Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
|
||||
|
||||
@@ -32,15 +32,15 @@
|
||||
|
||||
public MerchantRecipe(NBTTagCompound nbttagcompound) {
|
||||
this.rewardExp = true;
|
||||
@@ -78,6 +96,7 @@
|
||||
@@ -81,6 +99,7 @@
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
int i = this.baseCostA.getCount();
|
||||
+ if (i <= 0) return ItemStack.EMPTY; // CraftBukkit - SPIGOT-5476
|
||||
int j = Math.max(0, MathHelper.floor((float) (i * this.demand) * this.priceMultiplier));
|
||||
|
||||
public ItemStack getCostA() {
|
||||
int i = this.baseCostA.getCount();
|
||||
+ if (i <= 0) return ItemStack.EMPTY; // CraftBukkit - SPIGOT-5476
|
||||
ItemStack itemstack = this.baseCostA.copy();
|
||||
int j = Math.max(0, MathHelper.floor((float) (i * this.demand) * this.priceMultiplier));
|
||||
|
||||
@@ -199,7 +218,11 @@
|
||||
return this.baseCostA.copyWithCount(MathHelper.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getItem().getMaxStackSize()));
|
||||
@@ -201,7 +220,11 @@
|
||||
if (!this.satisfiedBy(itemstack, itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user