@@ -11,4 +11,4 @@
|
||||
+ // CraftBukkit end
|
||||
worldserver.addFreshEntityWithPassengers(entityarmorstand);
|
||||
world.playSound((EntityHuman) null, entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), SoundEffects.ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F);
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, (Entity) entityarmorstand);
|
||||
entityarmorstand.gameEvent(GameEvent.ENTITY_PLACE, itemactioncontext.getPlayer());
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
IBlockData iblockdata = this.getPlacementState(blockactioncontext1);
|
||||
+ // CraftBukkit start - special case for handling block placement with water lilies and snow buckets
|
||||
+ org.bukkit.block.BlockState blockstate = null;
|
||||
+ if (this instanceof ItemWaterLily || this instanceof SolidBucketItem) {
|
||||
+ if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) {
|
||||
+ blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
- world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
|
||||
+ // world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
|
||||
world.gameEvent(entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(entityhuman, iblockdata1));
|
||||
- if (entityhuman == null || !entityhuman.getAbilities().instabuild) {
|
||||
+ if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBoat.java
|
||||
+++ b/net/minecraft/world/item/ItemBoat.java
|
||||
@@ -56,6 +56,13 @@
|
||||
@@ -58,6 +58,13 @@
|
||||
}
|
||||
|
||||
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
@@ -11,10 +11,10 @@
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getLocation().x, movingobjectpositionblock.getLocation().y, movingobjectpositionblock.getLocation().z);
|
||||
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock);
|
||||
|
||||
entityboat.setType(this.type);
|
||||
@@ -64,7 +71,15 @@
|
||||
@@ -66,7 +73,15 @@
|
||||
return InteractionResultWrapper.fail(itemstack);
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
@@ -28,6 +28,6 @@
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.gameEvent(entityhuman, GameEvent.ENTITY_PLACE, new BlockPosition(movingobjectpositionblock.getLocation()));
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBucket.java
|
||||
+++ b/net/minecraft/world/item/ItemBucket.java
|
||||
@@ -29,6 +29,16 @@
|
||||
@@ -30,6 +30,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;
|
||||
@@ -59,6 +69,17 @@
|
||||
@@ -60,6 +70,17 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
||||
@@ -35,16 +35,16 @@
|
||||
ItemStack itemstack1 = ifluidsource.pickupBlock(world, blockposition, iblockdata);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
@@ -67,7 +88,7 @@
|
||||
@@ -68,7 +89,7 @@
|
||||
entityhuman.playSound(soundeffect, 1.0F, 1.0F);
|
||||
});
|
||||
world.gameEvent(entityhuman, GameEvent.FLUID_PICKUP, blockposition);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.FLUID_PICKUP, blockposition);
|
||||
- ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1);
|
||||
+ ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
if (!world.isClientSide) {
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
@@ -82,7 +103,7 @@
|
||||
@@ -83,7 +104,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);
|
||||
@@ -109,6 +130,11 @@
|
||||
@@ -110,6 +131,11 @@
|
||||
|
||||
@Override
|
||||
public boolean emptyContents(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
@@ -65,7 +65,7 @@
|
||||
if (!(this.content instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -118,8 +144,18 @@
|
||||
@@ -119,8 +145,18 @@
|
||||
boolean flag = iblockdata.canBeReplaced(this.content);
|
||||
boolean flag1 = iblockdata.isAir() || flag || block instanceof IFluidContainer && ((IFluidContainer) block).canPlaceLiquid(world, blockposition, iblockdata, this.content);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/item/ItemChorusFruit.java
|
||||
+++ b/net/minecraft/world/item/ItemChorusFruit.java
|
||||
@@ -34,7 +34,16 @@
|
||||
entityliving.stopRiding();
|
||||
}
|
||||
@@ -39,7 +39,16 @@
|
||||
|
||||
Vec3D vec3d = entityliving.position();
|
||||
|
||||
- if (entityliving.randomTeleport(d3, d4, d5, true)) {
|
||||
+ // CraftBukkit start - handle canceled status of teleport event
|
||||
@@ -15,6 +15,6 @@
|
||||
+
|
||||
+ if (status.get()) {
|
||||
+ // CraftBukkit end
|
||||
world.gameEvent(GameEvent.TELEPORT, vec3d, GameEvent.a.of((Entity) entityliving));
|
||||
SoundEffect soundeffect = entityliving instanceof EntityFox ? SoundEffects.FOX_TELEPORT : SoundEffects.CHORUS_FRUIT_TELEPORT;
|
||||
|
||||
world.playSound((EntityHuman) null, d0, d1, d2, soundeffect, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemCrossbow.java
|
||||
+++ b/net/minecraft/world/item/ItemCrossbow.java
|
||||
@@ -114,6 +114,10 @@
|
||||
@@ -112,6 +112,10 @@
|
||||
if (itemstack1.isEmpty() && flag) {
|
||||
itemstack1 = new ItemStack(Items.ARROW);
|
||||
itemstack2 = itemstack1.copy();
|
||||
@@ -11,7 +11,7 @@
|
||||
}
|
||||
|
||||
if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) {
|
||||
@@ -238,11 +242,27 @@
|
||||
@@ -236,11 +240,27 @@
|
||||
vector3fa.transform(quaternion);
|
||||
((IProjectile) object).shoot((double) vector3fa.x(), (double) vector3fa.y(), (double) vector3fa.z(), f1, f2);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package net.minecraft.world.item;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -97,7 +98,7 @@
|
||||
@@ -96,7 +97,7 @@
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> IBlockData cycleState(IBlockData iblockdata, IBlockState<T> iblockstate, boolean flag) {
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.addFreshEntity(entityendercrystal);
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition1);
|
||||
world.gameEvent((Entity) itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition1);
|
||||
EnderDragonBattle enderdragonbattle = ((WorldServer) world).dragonFight();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/item/ItemEnderEye.java
|
||||
+++ b/net/minecraft/world/item/ItemEnderEye.java
|
||||
@@ -86,7 +86,11 @@
|
||||
|
||||
@@ -89,7 +89,11 @@
|
||||
entityendersignal.setItem(itemstack);
|
||||
entityendersignal.signalTo(blockposition);
|
||||
world.gameEvent(GameEvent.PROJECTILE_SHOOT, entityendersignal.position(), GameEvent.a.of((Entity) entityhuman));
|
||||
- world.addFreshEntity(entityendersignal);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addFreshEntity(entityendersignal)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemFireball.java
|
||||
+++ b/net/minecraft/world/item/ItemFireball.java
|
||||
@@ -32,12 +32,28 @@
|
||||
@@ -33,12 +33,28 @@
|
||||
if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
|
||||
blockposition = blockposition.relative(itemactioncontext.getClickedFace());
|
||||
if (BlockFireAbstract.canBePlacedAt(world, blockposition, itemactioncontext.getHorizontalDirection())) {
|
||||
@@ -14,7 +14,7 @@
|
||||
+ // CraftBukkit end
|
||||
this.playSound(world, blockposition);
|
||||
world.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(world, blockposition));
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
world.gameEvent((Entity) itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
@@ -28,4 +28,4 @@
|
||||
+ // CraftBukkit end
|
||||
this.playSound(world, blockposition);
|
||||
world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true));
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
world.gameEvent((Entity) itemactioncontext.getPlayer(), GameEvent.BLOCK_CHANGE, blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemFishingRod.java
|
||||
+++ b/net/minecraft/world/item/ItemFishingRod.java
|
||||
@@ -12,6 +12,8 @@
|
||||
@@ -11,6 +11,8 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
public class ItemFishingRod extends Item implements ItemVanishable {
|
||||
|
||||
public ItemFishingRod(Item.Info item_info) {
|
||||
@@ -34,12 +36,23 @@
|
||||
@@ -33,12 +35,23 @@
|
||||
world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
world.gameEvent(entityhuman, GameEvent.FISHING_ROD_REEL_IN, (Entity) entityhuman);
|
||||
entityhuman.gameEvent(GameEvent.ITEM_INTERACT_FINISH);
|
||||
} else {
|
||||
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemFlintAndSteel.java
|
||||
+++ b/net/minecraft/world/item/ItemFlintAndSteel.java
|
||||
@@ -34,6 +34,14 @@
|
||||
@@ -35,6 +35,14 @@
|
||||
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
||||
|
||||
if (BlockFireAbstract.canBePlacedAt(world, blockposition1, itemactioncontext.getHorizontalDirection())) {
|
||||
@@ -15,7 +15,7 @@
|
||||
world.playSound(entityhuman, blockposition1, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
||||
IBlockData iblockdata1 = BlockFireAbstract.getState(world, blockposition1);
|
||||
|
||||
@@ -53,6 +61,14 @@
|
||||
@@ -54,6 +62,14 @@
|
||||
return EnumInteractionResult.FAIL;
|
||||
}
|
||||
} else {
|
||||
@@ -29,4 +29,4 @@
|
||||
+ // CraftBukkit end
|
||||
world.playSound(entityhuman, blockposition, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
|
||||
world.gameEvent(entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_CHANGE, blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemHanging.java
|
||||
+++ b/net/minecraft/world/item/ItemHanging.java
|
||||
@@ -15,6 +15,11 @@
|
||||
@@ -16,6 +16,11 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ItemHanging extends Item {
|
||||
|
||||
private final EntityTypes<? extends EntityHanging> type;
|
||||
@@ -58,6 +63,18 @@
|
||||
@@ -65,6 +70,18 @@
|
||||
|
||||
if (((EntityHanging) object).survives()) {
|
||||
if (!world.isClientSide) {
|
||||
@@ -29,5 +29,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((EntityHanging) object).playPlacementSound();
|
||||
world.gameEvent(entityhuman, GameEvent.ENTITY_PLACE, blockposition);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.ENTITY_PLACE, ((EntityHanging) object).position());
|
||||
world.addFreshEntity((Entity) object);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/item/ItemLeash.java
|
||||
+++ b/net/minecraft/world/item/ItemLeash.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -15,6 +15,8 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+import org.bukkit.event.hanging.HangingPlaceEvent; // CraftBukkit
|
||||
@@ -9,7 +9,7 @@
|
||||
public class ItemLeash extends Item {
|
||||
|
||||
public ItemLeash(Item.Info item_info) {
|
||||
@@ -54,9 +56,25 @@
|
||||
@@ -57,9 +59,25 @@
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
if (entityleash == null) {
|
||||
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);
|
||||
|
||||
@@ -70,6 +70,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (!world.addFreshEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition);
|
||||
world.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of(itemactioncontext.getPlayer(), world.getBlockState(blockposition.below())));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemMonsterEgg.java
|
||||
+++ b/net/minecraft/world/item/ItemMonsterEgg.java
|
||||
@@ -179,7 +179,7 @@
|
||||
@@ -181,7 +181,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());
|
||||
}
|
||||
@@ -188,7 +188,7 @@
|
||||
@@ -190,7 +190,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemPotion.java
|
||||
+++ b/net/minecraft/world/item/ItemPotion.java
|
||||
@@ -51,7 +51,7 @@
|
||||
@@ -63,7 +63,7 @@
|
||||
if (mobeffect.getEffect().isInstantenous()) {
|
||||
mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D);
|
||||
} else {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/item/ItemRecord.java
|
||||
+++ b/net/minecraft/world/item/ItemRecord.java
|
||||
@@ -42,6 +42,7 @@
|
||||
@@ -41,6 +41,7 @@
|
||||
ItemStack itemstack = itemactioncontext.getItemInHand();
|
||||
|
||||
if (!world.isClientSide) {
|
||||
+ if (true) return EnumInteractionResult.SUCCESS; // CraftBukkit - handled in ItemStack
|
||||
((BlockJukeBox) Blocks.JUKEBOX).setRecord(world, blockposition, iblockdata, itemstack);
|
||||
((BlockJukeBox) Blocks.JUKEBOX).setRecord(itemactioncontext.getPlayer(), world, blockposition, iblockdata, itemstack);
|
||||
world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this));
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
+++ b/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
@@ -51,6 +51,16 @@
|
||||
@@ -50,6 +50,16 @@
|
||||
TileEntitySkull.updateGameprofile(gameprofile, (gameprofile1) -> {
|
||||
nbttagcompound.put("SkullOwner", GameProfileSerializer.writeGameProfile(new NBTTagCompound(), gameprofile1));
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -73,6 +73,40 @@
|
||||
@@ -71,6 +71,40 @@
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
public final class ItemStack {
|
||||
|
||||
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -144,16 +178,30 @@
|
||||
@@ -146,16 +180,30 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -161,6 +209,11 @@
|
||||
@@ -163,6 +211,11 @@
|
||||
this.setDamageValue(this.getDamageValue());
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -202,7 +255,7 @@
|
||||
@@ -216,7 +269,7 @@
|
||||
return this.getItem().builtInRegistryHolder().tags();
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
EntityHuman entityhuman = itemactioncontext.getPlayer();
|
||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
|
||||
@@ -210,12 +263,157 @@
|
||||
@@ -224,12 +277,157 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
@@ -207,7 +207,7 @@
|
||||
+ // 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).setRecord(world, blockposition, world.getBlockState(blockposition), this);
|
||||
+ ((BlockJukeBox) Blocks.JUKEBOX).setRecord(entityhuman, world, blockposition, world.getBlockState(blockposition), this);
|
||||
+ world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this.item));
|
||||
+ this.shrink(1);
|
||||
+ entityhuman.awardStat(StatisticList.PLAY_RECORD);
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -296,6 +494,21 @@
|
||||
@@ -310,6 +508,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@@ -276,7 +276,7 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -317,6 +530,11 @@
|
||||
@@ -331,6 +544,11 @@
|
||||
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
this.shrink(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -472,6 +690,17 @@
|
||||
@@ -486,6 +704,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,16 @@
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -850,6 +1079,12 @@
|
||||
@@ -782,7 +1011,7 @@
|
||||
|
||||
private static Collection<IChatBaseComponent> expandBlockState(String s) {
|
||||
try {
|
||||
- return (Collection) ArgumentBlock.parseForTesting((IRegistry) IRegistry.BLOCK, s, true).map((argumentblock_a) -> {
|
||||
+ return (Collection) ArgumentBlock.parseForTesting(IRegistry.BLOCK, s, true).map((argumentblock_a) -> { // CraftBukkit - decompile error
|
||||
return Lists.newArrayList(new IChatBaseComponent[]{argumentblock_a.blockState().getBlock().getName().withStyle(EnumChatFormat.DARK_GRAY)});
|
||||
}, (argumentblock_b) -> {
|
||||
return (List) argumentblock_b.tag().stream().map((holder) -> {
|
||||
@@ -848,6 +1077,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
@@ -319,7 +328,7 @@
|
||||
this.getOrCreateTag().putInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -899,6 +1134,13 @@
|
||||
@@ -897,6 +1132,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -331,5 +340,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public IChatBaseComponent getDisplayName() {
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).append(this.getHoverName());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().append(this.getHoverName());
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemWorldMap.java
|
||||
+++ b/net/minecraft/world/item/ItemWorldMap.java
|
||||
@@ -32,6 +32,11 @@
|
||||
@@ -33,6 +33,11 @@
|
||||
import net.minecraft.world.level.material.MaterialMapColor;
|
||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ItemWorldMap extends ItemWorldMapBase {
|
||||
|
||||
public static final int IMAGE_WIDTH = 128;
|
||||
@@ -66,7 +71,7 @@
|
||||
@@ -67,7 +72,7 @@
|
||||
public static Integer getMapId(ItemStack itemstack) {
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
||||
@@ -74,6 +79,10 @@
|
||||
@@ -75,6 +80,10 @@
|
||||
int l = world.getFreeMapId();
|
||||
|
||||
world.setMapData(makeKey(l), worldmap);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
@@ -32,11 +32,13 @@
|
||||
@@ -34,11 +34,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
|
||||
private boolean hasErrors;
|
||||
|
||||
@@ -46,7 +48,12 @@
|
||||
@@ -48,7 +50,12 @@
|
||||
|
||||
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
this.hasErrors = false;
|
||||
@@ -29,7 +29,7 @@
|
||||
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
|
||||
Iterator iterator = map.entrySet().iterator();
|
||||
|
||||
@@ -57,8 +64,10 @@
|
||||
@@ -59,8 +66,10 @@
|
||||
try {
|
||||
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
})).put(minecraftkey, irecipe);
|
||||
builder.put(minecraftkey, irecipe);
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
@@ -67,20 +76,37 @@
|
||||
@@ -69,27 +78,44 @@
|
||||
}
|
||||
|
||||
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
|
||||
@@ -72,27 +72,44 @@
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> getRecipeFor(Recipes<T> recipes, C c0, World world) {
|
||||
- return this.byType(recipes).values().stream().flatMap((irecipe) -> {
|
||||
- return this.byType(recipes).values().stream().filter((irecipe) -> {
|
||||
+ // CraftBukkit start
|
||||
+ Optional<T> recipe = this.byType(recipes).values().stream().flatMap((irecipe) -> {
|
||||
return recipes.tryMatch(irecipe, world, c0).stream();
|
||||
+ Optional<T> recipe = this.byType(recipes).values().stream().filter((irecipe) -> {
|
||||
return irecipe.matches(c0, world);
|
||||
}).findFirst();
|
||||
+ c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
|
||||
+ // CraftBukkit end
|
||||
+ return recipe;
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
|
||||
@@ -98,7 +124,7 @@
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<Pair<MinecraftKey, T>> getRecipeFor(Recipes<T> recipes, C c0, World world, @Nullable MinecraftKey minecraftkey) {
|
||||
Map<MinecraftKey, T> map = this.byType(recipes);
|
||||
|
||||
if (minecraftkey != null) {
|
||||
- T t0 = (IRecipe) map.get(minecraftkey);
|
||||
+ T t0 = map.get(minecraftkey); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 != null && t0.matches(c0, world)) {
|
||||
return Optional.of(Pair.of(minecraftkey, t0));
|
||||
@@ -99,7 +125,7 @@
|
||||
return map.entrySet().stream().filter((entry) -> {
|
||||
return ((IRecipe) entry.getValue()).matches(c0, world);
|
||||
}).findFirst().map((entry) -> {
|
||||
- return Pair.of((MinecraftKey) entry.getKey(), (IRecipe) entry.getValue());
|
||||
+ return Pair.of((MinecraftKey) entry.getKey(), entry.getValue()); // CraftBukkit - decompile error
|
||||
});
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> byType(Recipes<T> recipes) {
|
||||
@@ -116,7 +142,7 @@
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, T> byType(Recipes<T> recipes) {
|
||||
- return (Map) this.recipes.getOrDefault(recipes, Collections.emptyMap());
|
||||
+ return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -118,7 +144,7 @@
|
||||
@@ -136,7 +162,7 @@
|
||||
}
|
||||
|
||||
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
|
||||
@@ -101,7 +118,7 @@
|
||||
}
|
||||
|
||||
public Collection<IRecipe<?>> getRecipes() {
|
||||
@@ -143,12 +169,12 @@
|
||||
@@ -161,12 +187,12 @@
|
||||
|
||||
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
|
||||
this.hasErrors = false;
|
||||
@@ -116,7 +133,7 @@
|
||||
});
|
||||
MinecraftKey minecraftkey = irecipe.getId();
|
||||
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
|
||||
@@ -159,6 +185,26 @@
|
||||
@@ -177,8 +203,28 @@
|
||||
}
|
||||
});
|
||||
this.recipes = ImmutableMap.copyOf(map);
|
||||
@@ -143,4 +160,15 @@
|
||||
+ this.byName = Maps.newHashMap();
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static <C extends IInventory, T extends IRecipe<C>> CraftingManager.a<C, T> createCheck(final Recipes<T> recipes) {
|
||||
return new CraftingManager.a<C, T>() {
|
||||
@@ -194,7 +240,7 @@
|
||||
Pair<MinecraftKey, T> pair = (Pair) optional.get();
|
||||
|
||||
this.lastRecipe = (MinecraftKey) pair.getFirst();
|
||||
- return Optional.of((IRecipe) pair.getSecond());
|
||||
+ return Optional.of(pair.getSecond()); // CraftBukkit - decompile error
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
+++ b/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
@@ -45,6 +45,14 @@
|
||||
@@ -46,6 +46,14 @@
|
||||
public static final Enchantment MENDING = register("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
|
||||
public static final Enchantment VANISHING_CURSE = register("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
|
||||
|
||||
|
||||
@@ -9,14 +9,8 @@
|
||||
public class MerchantRecipe {
|
||||
|
||||
public ItemStack baseCostA;
|
||||
@@ -13,10 +15,26 @@
|
||||
public int uses;
|
||||
public int maxUses;
|
||||
public boolean rewardExp;
|
||||
- private int specialPriceDiff;
|
||||
- private int demand;
|
||||
+ public int specialPriceDiff; // PAIL private -> public
|
||||
+ public int demand; // PAIL private -> public
|
||||
@@ -17,6 +19,22 @@
|
||||
public int demand;
|
||||
public float priceMultiplier;
|
||||
public int xp;
|
||||
+ // CraftBukkit start
|
||||
|
||||
Reference in New Issue
Block a user