@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemArmor.java
|
||||
+++ b/net/minecraft/world/item/ItemArmor.java
|
||||
@@ -28,6 +28,11 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
public class ItemArmor extends Item implements ItemWearable {
|
||||
|
||||
private static final UUID[] ARMOR_MODIFIER_UUID_PER_SLOT = new UUID[]{UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
|
||||
@@ -54,8 +59,34 @@
|
||||
@@ -53,8 +58,34 @@
|
||||
EntityLiving entityliving = (EntityLiving) list.get(0);
|
||||
EnumItemSlot enumitemslot = EntityInsentient.getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
ItemStack itemstack1 = itemstack.split(1);
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.getWorld();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ World world = isourceblock.getLevel();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity());
|
||||
@@ -27,12 +27,12 @@
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.add(1);
|
||||
+ itemstack.grow(1);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.add(1);
|
||||
+ itemstack.grow(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
@@ -42,9 +42,9 @@
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- entityliving.setSlot(enumitemslot, itemstack1);
|
||||
+ entityliving.setSlot(enumitemslot, CraftItemStack.asNMSCopy(event.getItem()));
|
||||
- entityliving.setItemSlot(enumitemslot, itemstack1);
|
||||
+ entityliving.setItemSlot(enumitemslot, CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
if (entityliving instanceof EntityInsentient) {
|
||||
((EntityInsentient) entityliving).a(enumitemslot, 2.0F);
|
||||
((EntityInsentient) entityliving).setPersistent();
|
||||
((EntityInsentient) entityliving).setDropChance(enumitemslot, 2.0F);
|
||||
((EntityInsentient) entityliving).setPersistenceRequired();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/item/ItemArmorStand.java
|
||||
+++ b/net/minecraft/world/item/ItemArmorStand.java
|
||||
@@ -58,6 +58,11 @@
|
||||
@@ -55,6 +55,11 @@
|
||||
|
||||
entityarmorstand.setPositionRotation(entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), f, 0.0F);
|
||||
this.a(entityarmorstand, world.random);
|
||||
entityarmorstand.moveTo(entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), f, 0.0F);
|
||||
this.randomizePose(entityarmorstand, world.random);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityarmorstand).isCancelled()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.addAllEntities(entityarmorstand);
|
||||
world.playSound((EntityHuman) null, entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), SoundEffects.ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F);
|
||||
world.a((Entity) itemactioncontext.getEntity(), GameEvent.ENTITY_PLACE, (Entity) entityarmorstand);
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBlock.java
|
||||
+++ b/net/minecraft/world/item/ItemBlock.java
|
||||
@@ -34,6 +34,13 @@
|
||||
@@ -33,6 +33,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -13,24 +13,24 @@
|
||||
+
|
||||
public class ItemBlock extends Item {
|
||||
|
||||
public static final String BLOCK_ENTITY_TAG = "BlockEntityTag";
|
||||
@@ -69,6 +76,12 @@
|
||||
private static final String BLOCK_ENTITY_TAG = "BlockEntityTag";
|
||||
@@ -68,6 +75,12 @@
|
||||
return EnumInteractionResult.FAIL;
|
||||
} else {
|
||||
IBlockData iblockdata = this.c(blockactioncontext1);
|
||||
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) {
|
||||
+ blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getWorld(), blockactioncontext1.getClickPosition());
|
||||
+ blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (iblockdata == null) {
|
||||
return EnumInteractionResult.FAIL;
|
||||
@@ -85,6 +98,19 @@
|
||||
iblockdata1 = this.a(blockposition, world, itemstack, iblockdata1);
|
||||
this.a(blockposition, world, entityhuman, itemstack, iblockdata1);
|
||||
iblockdata1.getBlock().postPlace(world, blockposition, iblockdata1, entityhuman, itemstack);
|
||||
@@ -84,6 +97,19 @@
|
||||
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
|
||||
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
|
||||
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ if (blockstate != null) {
|
||||
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent((WorldServer) world, entityhuman, blockactioncontext1.getHand(), blockstate, blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -45,21 +45,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.PLACED_BLOCK.a((EntityPlayer) entityhuman, blockposition, itemstack);
|
||||
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition, itemstack);
|
||||
}
|
||||
@@ -92,9 +118,9 @@
|
||||
@@ -91,9 +117,9 @@
|
||||
|
||||
SoundEffectType soundeffecttype = iblockdata1.getStepSound();
|
||||
SoundEffectType soundeffecttype = iblockdata1.getSoundType();
|
||||
|
||||
- world.playSound(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
|
||||
+ // world.playSound(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
|
||||
world.a((Entity) entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
- 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);
|
||||
- if (entityhuman == null || !entityhuman.getAbilities().instabuild) {
|
||||
+ if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
@@ -130,6 +156,21 @@
|
||||
@@ -129,6 +155,21 @@
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("BlockStateTag");
|
||||
@@ -68,7 +68,7 @@
|
||||
+ }
|
||||
+
|
||||
+ if (iblockdata1 != iblockdata) {
|
||||
+ world.setTypeAndData(blockposition, iblockdata1, 2);
|
||||
+ world.setBlock(blockposition, iblockdata1, 2);
|
||||
+ }
|
||||
+
|
||||
+ return iblockdata1;
|
||||
@@ -78,44 +78,44 @@
|
||||
+ IBlockData iblockdata1 = iblockdata;
|
||||
+ {
|
||||
+ // CraftBukkit end
|
||||
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStates();
|
||||
Iterator iterator = nbttagcompound1.getKeys().iterator();
|
||||
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStateDefinition();
|
||||
Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
|
||||
@@ -144,11 +185,6 @@
|
||||
@@ -143,11 +184,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- if (iblockdata1 != iblockdata) {
|
||||
- world.setTypeAndData(blockposition, iblockdata1, 2);
|
||||
- world.setBlock(blockposition, iblockdata1, 2);
|
||||
- }
|
||||
-
|
||||
return iblockdata1;
|
||||
}
|
||||
|
||||
@@ -161,8 +197,15 @@
|
||||
protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|
||||
EntityHuman entityhuman = blockactioncontext.getEntity();
|
||||
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman);
|
||||
@@ -160,8 +196,15 @@
|
||||
protected boolean canPlace(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|
||||
EntityHuman entityhuman = blockactioncontext.getPlayer();
|
||||
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entityhuman);
|
||||
+ // CraftBukkit start - store default return
|
||||
+ boolean defaultReturn = (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision);
|
||||
+ org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null;
|
||||
+ boolean defaultReturn = (!this.mustSurvive() || iblockdata.canSurvive(blockactioncontext.getLevel(), blockactioncontext.getClickedPos())) && blockactioncontext.getLevel().isUnobstructed(iblockdata, blockactioncontext.getClickedPos(), voxelshapecollision);
|
||||
+ org.bukkit.entity.Player player = (blockactioncontext.getPlayer() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getPlayer().getBukkitEntity() : null;
|
||||
+
|
||||
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
|
||||
+ blockactioncontext.getWorld().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getLevel(), blockactioncontext.getClickedPos()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
|
||||
+ blockactioncontext.getLevel().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
- return (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision);
|
||||
- return (!this.mustSurvive() || iblockdata.canSurvive(blockactioncontext.getLevel(), blockactioncontext.getClickedPos())) && blockactioncontext.getLevel().isUnobstructed(iblockdata, blockactioncontext.getClickedPos(), voxelshapecollision);
|
||||
+ return event.isBuildable();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected boolean isCheckCollisions() {
|
||||
@@ -247,7 +290,7 @@
|
||||
protected boolean mustSurvive() {
|
||||
@@ -244,7 +287,7 @@
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getCompound("BlockEntityTag").getList("Items", 10);
|
||||
if (nbttagcompound != null && nbttagcompound.contains("Items", 9)) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
|
||||
- Stream stream = nbttaglist.stream();
|
||||
+ Stream<net.minecraft.nbt.NBTBase> stream = nbttaglist.stream(); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(NBTTagCompound.class);
|
||||
ItemLiquidUtil.a(entityitem, stream.map(NBTTagCompound.class::cast).map(ItemStack::a));
|
||||
ItemLiquidUtil.onContainerDestroyed(entityitem, stream.map(NBTTagCompound.class::cast).map(ItemStack::of));
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
|
||||
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
+ // CraftBukkit start - Boat placement
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, enumhand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getPos().x, movingobjectpositionblock.getPos().y, movingobjectpositionblock.getPos().z);
|
||||
EntityBoat entityboat = new EntityBoat(world, movingobjectpositionblock.getLocation().x, movingobjectpositionblock.getLocation().y, movingobjectpositionblock.getLocation().z);
|
||||
|
||||
entityboat.setType(this.type);
|
||||
@@ -64,7 +71,15 @@
|
||||
return InteractionResultWrapper.fail(itemstack);
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
- world.addEntity(entityboat);
|
||||
- world.addFreshEntity(entityboat);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) {
|
||||
+ return InteractionResultWrapper.fail(itemstack);
|
||||
+ }
|
||||
+
|
||||
+ if (!world.addEntity(entityboat)) {
|
||||
+ if (!world.addFreshEntity(entityboat)) {
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.a((Entity) entityhuman, GameEvent.ENTITY_PLACE, new BlockPosition(movingobjectpositionblock.getPos()));
|
||||
world.gameEvent(entityhuman, GameEvent.ENTITY_PLACE, new BlockPosition(movingobjectpositionblock.getLocation()));
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -35,6 +35,12 @@
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(ItemActionContext itemactioncontext) {
|
||||
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||
+ // CraftBukkit start - extract bonemeal application logic to separate, static method
|
||||
+ return applyBonemeal(itemactioncontext);
|
||||
+ }
|
||||
+
|
||||
+ public static EnumInteractionResult applyBonemeal(ItemActionContext itemactioncontext) {
|
||||
+ // CraftBukkit end
|
||||
World world = itemactioncontext.getWorld();
|
||||
BlockPosition blockposition = itemactioncontext.getClickPosition();
|
||||
BlockPosition blockposition1 = blockposition.shift(itemactioncontext.getClickedFace());
|
||||
World world = itemactioncontext.getLevel();
|
||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/item/ItemBow.java
|
||||
+++ b/net/minecraft/world/item/ItemBow.java
|
||||
@@ -64,6 +64,14 @@
|
||||
if (EnchantmentManager.getEnchantmentLevel(Enchantments.FLAMING_ARROWS, itemstack) > 0) {
|
||||
entityarrow.setOnFire(100);
|
||||
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.FLAMING_ARROWS, itemstack) > 0) {
|
||||
entityarrow.setSecondsOnFire(100);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, entityhuman.getRaisedHand(), f, !flag1);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, entityhuman.getUsedItemHand(), f, !flag1);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
@@ -13,16 +13,16 @@
|
||||
+ flag1 = !event.shouldConsumeItem();
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand());
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(entityhuman.getUsedItemHand());
|
||||
@@ -72,7 +80,16 @@
|
||||
entityarrow.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
- world.addEntity(entityarrow);
|
||||
- world.addFreshEntity(entityarrow);
|
||||
+ // CraftBukkit start
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ if (!world.addEntity(entityarrow)) {
|
||||
+ if (!world.addFreshEntity(entityarrow)) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
@@ -32,4 +32,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBucket.java
|
||||
+++ b/net/minecraft/world/item/ItemBucket.java
|
||||
@@ -31,6 +31,16 @@
|
||||
@@ -29,6 +29,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -17,71 +17,71 @@
|
||||
public class ItemBucket extends Item implements DispensibleContainerItem {
|
||||
|
||||
public final FluidType content;
|
||||
@@ -61,6 +71,17 @@
|
||||
iblockdata = world.getType(blockposition);
|
||||
@@ -59,6 +69,17 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack dummyFluid = ifluidsource.removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||
+ ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||
+ if (dummyFluid.isEmpty()) return InteractionResultWrapper.fail(itemstack); // Don't fire event if the bucket won't be filled.
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem());
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
|
||||
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
+ return InteractionResultWrapper.fail(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = ifluidsource.removeFluid(world, blockposition, iblockdata);
|
||||
ItemStack itemstack1 = ifluidsource.pickupBlock(world, blockposition, iblockdata);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
@@ -69,7 +90,7 @@
|
||||
@@ -67,7 +88,7 @@
|
||||
entityhuman.playSound(soundeffect, 1.0F, 1.0F);
|
||||
});
|
||||
world.a((Entity) entityhuman, GameEvent.FLUID_PICKUP, blockposition);
|
||||
- ItemStack itemstack2 = ItemLiquidUtil.a(itemstack, entityhuman, itemstack1);
|
||||
+ ItemStack itemstack2 = ItemLiquidUtil.a(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
world.gameEvent(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.a((EntityPlayer) entityhuman, itemstack1);
|
||||
@@ -84,7 +105,7 @@
|
||||
iblockdata = world.getType(blockposition);
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
@@ -82,7 +103,7 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.content == FluidTypes.WATER ? blockposition : blockposition1;
|
||||
|
||||
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock)) {
|
||||
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
|
||||
this.a(entityhuman, world, itemstack, blockposition2);
|
||||
- if (this.emptyContents(entityhuman, world, blockposition2, movingobjectpositionblock)) {
|
||||
+ if (this.emptyContents(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
|
||||
this.checkExtraContent(entityhuman, world, itemstack, blockposition2);
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.PLACED_BLOCK.a((EntityPlayer) entityhuman, blockposition2, itemstack);
|
||||
@@ -111,6 +132,11 @@
|
||||
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition2, itemstack);
|
||||
@@ -109,6 +130,11 @@
|
||||
|
||||
@Override
|
||||
public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
+ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null);
|
||||
public boolean emptyContents(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
+ return emptyContents(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) {
|
||||
+ public boolean emptyContents(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) {
|
||||
+ // CraftBukkit end
|
||||
if (!(this.content instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -120,8 +146,18 @@
|
||||
boolean flag = iblockdata.a(this.content);
|
||||
boolean flag1 = iblockdata.isAir() || flag || block instanceof IFluidContainer && ((IFluidContainer) block).canPlace(world, blockposition, iblockdata, this.content);
|
||||
@@ -118,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);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (flag1 && entityhuman != null) {
|
||||
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack);
|
||||
+ if (event.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
|
||||
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!flag1) {
|
||||
- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null);
|
||||
+ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit
|
||||
} else if (world.getDimensionManager().isNether() && this.content.a((Tag) TagsFluid.WATER)) {
|
||||
- return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null);
|
||||
+ return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit
|
||||
} else if (world.dimensionType().ultraWarm() && this.content.is(TagsFluid.WATER)) {
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY();
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
entityliving.stopRiding();
|
||||
}
|
||||
|
||||
- if (entityliving.a(d3, d4, d5, true)) {
|
||||
- if (entityliving.randomTeleport(d3, d4, d5, true)) {
|
||||
+ // CraftBukkit start - handle canceled status of teleport event
|
||||
+ java.util.Optional<Boolean> status = entityliving.safeTeleport(d3, d4, d5, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
|
||||
+ java.util.Optional<Boolean> status = entityliving.randomTeleport(d3, d4, d5, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
|
||||
+
|
||||
+ if (!status.isPresent()) {
|
||||
+ // teleport event was canceled, no more tries
|
||||
|
||||
@@ -3,33 +3,33 @@
|
||||
@@ -114,6 +114,10 @@
|
||||
if (itemstack1.isEmpty() && flag) {
|
||||
itemstack1 = new ItemStack(Items.ARROW);
|
||||
itemstack2 = itemstack1.cloneItemStack();
|
||||
itemstack2 = itemstack1.copy();
|
||||
+ // CraftBukkit start - SPIGOT-4870, MC-150847
|
||||
+ } else if (itemstack1.isEmpty()) {
|
||||
+ return false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (!a(entityliving, itemstack, itemstack1, k > 0, flag)) {
|
||||
if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) {
|
||||
@@ -238,11 +242,27 @@
|
||||
vector3fa.a(quaternion);
|
||||
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
|
||||
vector3fa.transform(quaternion);
|
||||
((IProjectile) object).shoot((double) vector3fa.x(), (double) vector3fa.y(), (double) vector3fa.z(), f1, f2);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (Entity) object, entityliving.getRaisedHand(), f, true);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (Entity) object, entityliving.getUsedItemHand(), f, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.damage(flag1 ? 3 : 1, entityliving, (entityliving1) -> {
|
||||
entityliving1.broadcastItemBreak(enumhand);
|
||||
itemstack.hurtAndBreak(flag1 ? 3 : 1, entityliving, (entityliving1) -> {
|
||||
entityliving1.broadcastBreakEvent(enumhand);
|
||||
});
|
||||
- world.addEntity((Entity) object);
|
||||
- world.addFreshEntity((Entity) object);
|
||||
+ // CraftBukkit start
|
||||
+ if (event.getProjectile() == ((Entity) object).getBukkitEntity()) {
|
||||
+ if (!world.addEntity((Entity) object)) {
|
||||
+ if (!world.addFreshEntity((Entity) object)) {
|
||||
+ if (entityliving instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entityliving).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
@@ -37,6 +37,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.playSound((EntityHuman) null, entityliving.locX(), entityliving.locY(), entityliving.locZ(), SoundEffects.CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f);
|
||||
world.playSound((EntityHuman) null, entityliving.getX(), entityliving.getY(), entityliving.getZ(), SoundEffects.CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
@@ -97,7 +98,7 @@
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> IBlockData a(IBlockData iblockdata, IBlockState<T> iblockstate, boolean flag) {
|
||||
- return (IBlockData) iblockdata.set(iblockstate, (Comparable) a((Iterable) iblockstate.getValues(), (Object) iblockdata.get(iblockstate), flag));
|
||||
+ return (IBlockData) iblockdata.set(iblockstate, a(iblockstate.getValues(), iblockdata.get(iblockstate), flag)); // CraftBukkit - decompile error
|
||||
private static <T extends Comparable<T>> IBlockData cycleState(IBlockData iblockdata, IBlockState<T> iblockstate, boolean flag) {
|
||||
- return (IBlockData) iblockdata.setValue(iblockstate, (Comparable) getRelative(iblockstate.getPossibleValues(), iblockdata.getValue(iblockstate), flag));
|
||||
+ return (IBlockData) iblockdata.setValue(iblockstate, getRelative(iblockstate.getPossibleValues(), iblockdata.getValue(iblockstate), flag)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <T> T a(Iterable<T> iterable, @Nullable T t0, boolean flag) {
|
||||
private static <T> T getRelative(Iterable<T> iterable, @Nullable T t0, boolean flag) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
if (!entityhuman.level.isClientSide) {
|
||||
- entitysheep.setColor(this.dyeColor);
|
||||
+ // CraftBukkit start
|
||||
+ byte bColor = (byte) this.dyeColor.getColorIndex();
|
||||
+ 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);
|
||||
+
|
||||
@@ -23,8 +23,8 @@
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+
|
||||
+ entitysheep.setColor(EnumColor.fromColorIndex((byte) event.getColor().getWoolData()));
|
||||
+ entitysheep.setColor(EnumColor.byId((byte) event.getColor().getWoolData()));
|
||||
+ // CraftBukkit end
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/item/ItemEgg.java
|
||||
+++ b/net/minecraft/world/item/ItemEgg.java
|
||||
@@ -19,14 +19,22 @@
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
public InteractionResultWrapper<ItemStack> use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
|
||||
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
|
||||
if (!world.isClientSide) {
|
||||
EntityEgg entityegg = new EntityEgg(world, entityhuman);
|
||||
|
||||
entityegg.setItem(itemstack);
|
||||
entityegg.a(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addEntity(entityegg);
|
||||
entityegg.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addFreshEntity(entityegg);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entityegg)) {
|
||||
+ if (!world.addFreshEntity(entityegg)) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
@@ -21,7 +21,7 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
@@ -46,6 +46,11 @@
|
||||
EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(world, d0 + 0.5D, d1, d2 + 0.5D);
|
||||
|
||||
entityendercrystal.setShowingBottom(false);
|
||||
entityendercrystal.setShowBottom(false);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityendercrystal).isCancelled()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.addEntity(entityendercrystal);
|
||||
world.a((Entity) itemactioncontext.getEntity(), GameEvent.ENTITY_PLACE, blockposition1);
|
||||
EnderDragonBattle enderdragonbattle = ((WorldServer) world).getDragonBattle();
|
||||
world.addFreshEntity(entityendercrystal);
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition1);
|
||||
EnderDragonBattle enderdragonbattle = ((WorldServer) world).dragonFight();
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -85,7 +85,11 @@
|
||||
|
||||
entityendersignal.setItem(itemstack);
|
||||
entityendersignal.a(blockposition);
|
||||
- world.addEntity(entityendersignal);
|
||||
entityendersignal.signalTo(blockposition);
|
||||
- world.addFreshEntity(entityendersignal);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entityendersignal)) {
|
||||
+ if (!world.addFreshEntity(entityendersignal)) {
|
||||
+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.USED_ENDER_EYE.a((EntityPlayer) entityhuman, blockposition);
|
||||
CriterionTriggers.USED_ENDER_EYE.trigger((EntityPlayer) entityhuman, blockposition);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/item/ItemEnderPearl.java
|
||||
+++ b/net/minecraft/world/item/ItemEnderPearl.java
|
||||
@@ -19,16 +19,24 @@
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
public InteractionResultWrapper<ItemStack> use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- entityhuman.getCooldownTracker().setCooldown(this, 20);
|
||||
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- entityhuman.getCooldowns().addCooldown(this, 20);
|
||||
+ // CraftBukkit start - change order
|
||||
if (!world.isClientSide) {
|
||||
EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, entityhuman);
|
||||
|
||||
entityenderpearl.setItem(itemstack);
|
||||
entityenderpearl.a(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addEntity(entityenderpearl);
|
||||
+ if (!world.addEntity(entityenderpearl)) {
|
||||
entityenderpearl.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addFreshEntity(entityenderpearl);
|
||||
+ if (!world.addFreshEntity(entityenderpearl)) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
@@ -21,10 +21,10 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ entityhuman.getCooldownTracker().setCooldown(this, 20);
|
||||
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ entityhuman.getCooldowns().addCooldown(this, 20);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/ItemFireball.java
|
||||
+++ b/net/minecraft/world/item/ItemFireball.java
|
||||
@@ -34,12 +34,28 @@
|
||||
if (!BlockCampfire.h(iblockdata) && !CandleBlock.g(iblockdata) && !CandleCakeBlock.g(iblockdata)) {
|
||||
blockposition = blockposition.shift(itemactioncontext.getClickedFace());
|
||||
if (BlockFireAbstract.a(world, blockposition, itemactioncontext.g())) {
|
||||
@@ -32,12 +32,28 @@
|
||||
if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
|
||||
blockposition = blockposition.relative(itemactioncontext.getClickedFace());
|
||||
if (BlockFireAbstract.canBePlacedAt(world, blockposition, itemactioncontext.getHorizontalDirection())) {
|
||||
+ // CraftBukkit start - fire BlockIgniteEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) {
|
||||
+ if (!itemactioncontext.getEntity().getAbilities().instabuild) {
|
||||
+ itemactioncontext.getItemStack().subtract(1);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getPlayer()).isCancelled()) {
|
||||
+ if (!itemactioncontext.getPlayer().getAbilities().instabuild) {
|
||||
+ itemactioncontext.getItemInHand().shrink(1);
|
||||
+ }
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition);
|
||||
world.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) world, blockposition));
|
||||
world.a((Entity) itemactioncontext.getEntity(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.playSound(world, blockposition);
|
||||
world.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(world, blockposition));
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
+ // CraftBukkit start - fire BlockIgniteEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) {
|
||||
+ if (!itemactioncontext.getEntity().getAbilities().instabuild) {
|
||||
+ itemactioncontext.getItemStack().subtract(1);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getPlayer()).isCancelled()) {
|
||||
+ if (!itemactioncontext.getPlayer().getAbilities().instabuild) {
|
||||
+ itemactioncontext.getItemInHand().shrink(1);
|
||||
+ }
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition);
|
||||
world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockProperties.LIT, true));
|
||||
world.a((Entity) itemactioncontext.getEntity(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.playSound(world, blockposition);
|
||||
world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true));
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
public ItemFishingRod(Item.Info item_info) {
|
||||
@@ -34,12 +36,23 @@
|
||||
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
world.a((Entity) entityhuman, GameEvent.FISHING_ROD_REEL_IN, (Entity) entityhuman);
|
||||
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);
|
||||
} else {
|
||||
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), 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));
|
||||
+ // 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));
|
||||
if (!world.isClientSide) {
|
||||
i = EnchantmentManager.c(itemstack);
|
||||
int j = EnchantmentManager.b(itemstack);
|
||||
i = EnchantmentManager.getFishingSpeedBonus(itemstack);
|
||||
int j = EnchantmentManager.getFishingLuckBonus(itemstack);
|
||||
|
||||
- world.addEntity(new EntityFishingHook(entityhuman, world, j, i));
|
||||
- world.addFreshEntity(new EntityFishingHook(entityhuman, world, j, i));
|
||||
+ // CraftBukkit start
|
||||
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, j, i);
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
|
||||
@@ -29,9 +29,9 @@
|
||||
+ entityhuman.fishing = null;
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ world.addEntity(entityfishinghook);
|
||||
+ 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.addFreshEntity(entityfishinghook);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
--- a/net/minecraft/world/item/ItemFlintAndSteel.java
|
||||
+++ b/net/minecraft/world/item/ItemFlintAndSteel.java
|
||||
@@ -36,6 +36,14 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(itemactioncontext.getClickedFace());
|
||||
@@ -34,6 +34,14 @@
|
||||
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
||||
|
||||
if (BlockFireAbstract.a(world, blockposition1, itemactioncontext.g())) {
|
||||
if (BlockFireAbstract.canBePlacedAt(world, blockposition1, itemactioncontext.getHorizontalDirection())) {
|
||||
+ // CraftBukkit start - Store the clicked block
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
|
||||
+ itemactioncontext.getItemStack().damage(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastItemBreak(itemactioncontext.getHand());
|
||||
+ itemactioncontext.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastBreakEvent(itemactioncontext.getHand());
|
||||
+ });
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.playSound(entityhuman, blockposition1, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
||||
IBlockData iblockdata1 = BlockFireAbstract.a((IBlockAccess) world, blockposition1);
|
||||
IBlockData iblockdata1 = BlockFireAbstract.getState(world, blockposition1);
|
||||
|
||||
@@ -55,6 +63,14 @@
|
||||
@@ -53,6 +61,14 @@
|
||||
return EnumInteractionResult.FAIL;
|
||||
}
|
||||
} else {
|
||||
+ // CraftBukkit start - Store the clicked block
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
|
||||
+ itemactioncontext.getItemStack().damage(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastItemBreak(itemactioncontext.getHand());
|
||||
+ itemactioncontext.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastBreakEvent(itemactioncontext.getHand());
|
||||
+ });
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.playSound(entityhuman, blockposition, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.LIT, true), 11);
|
||||
world.a((Entity) entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
|
||||
world.gameEvent(entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
if (((EntityHanging) object).survives()) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start - fire HangingPlaceEvent
|
||||
+ Player who = (itemactioncontext.getEntity() == null) ? null : (Player) itemactioncontext.getEntity().getBukkitEntity();
|
||||
+ Player who = (itemactioncontext.getPlayer() == null) ? null : (Player) itemactioncontext.getPlayer().getBukkitEntity();
|
||||
+ org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection);
|
||||
+
|
||||
@@ -28,6 +28,6 @@
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((EntityHanging) object).playPlaceSound();
|
||||
world.a((Entity) entityhuman, GameEvent.ENTITY_PLACE, blockposition);
|
||||
world.addEntity((Entity) object);
|
||||
((EntityHanging) object).playPlacementSound();
|
||||
world.gameEvent(entityhuman, GameEvent.ENTITY_PLACE, blockposition);
|
||||
world.addFreshEntity((Entity) object);
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
@@ -55,9 +57,25 @@
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
if (entityleash == null) {
|
||||
entityleash = EntityLeash.b(world, blockposition);
|
||||
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);
|
||||
+
|
||||
+ // CraftBukkit start - fire HangingPlaceEvent
|
||||
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleash.getBukkitEntity(), entityhuman != null ? (org.bukkit.entity.Player) entityhuman.getBukkitEntity() : null, world.getWorld().getBlockAt(i, j, k), org.bukkit.block.BlockFace.SELF);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ entityleash.die();
|
||||
+ entityleash.discard();
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityleash.playPlaceSound();
|
||||
entityleash.playPlacementSound();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -32,6 +32,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
entityinsentient.setLeashHolder(entityleash, true);
|
||||
entityinsentient.setLeashedTo(entityleash, true);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemMinecart.java
|
||||
+++ b/net/minecraft/world/item/ItemMinecart.java
|
||||
@@ -20,6 +20,11 @@
|
||||
@@ -18,6 +18,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPosition;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
public class ItemMinecart extends Item {
|
||||
|
||||
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
|
||||
@@ -58,14 +63,43 @@
|
||||
@@ -56,14 +61,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
|
||||
- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
|
||||
+ // CraftBukkit start
|
||||
+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).b);
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block2 = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block2 = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
@@ -29,12 +29,12 @@
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.add(1);
|
||||
+ itemstack.grow(1);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.add(1);
|
||||
+ itemstack.grow(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
@@ -45,31 +45,31 @@
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).type);
|
||||
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).type);
|
||||
|
||||
if (itemstack.hasName()) {
|
||||
entityminecartabstract.setCustomName(itemstack.getName());
|
||||
if (itemstack.hasCustomHoverName()) {
|
||||
entityminecartabstract.setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
|
||||
- worldserver.addEntity(entityminecartabstract);
|
||||
- itemstack.subtract(1);
|
||||
+ if (!worldserver.addEntity(entityminecartabstract)) itemstack.add(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled during event processing
|
||||
- worldserver.addFreshEntity(entityminecartabstract);
|
||||
- itemstack.shrink(1);
|
||||
+ if (!worldserver.addFreshEntity(entityminecartabstract)) itemstack.grow(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -107,7 +141,12 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getName());
|
||||
@@ -105,7 +139,12 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
|
||||
- world.addEntity(entityminecartabstract);
|
||||
- world.addFreshEntity(entityminecartabstract);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityminecartabstract).isCancelled()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (!world.addEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
|
||||
world.a((Entity) itemactioncontext.getEntity(), GameEvent.ENTITY_PLACE, blockposition);
|
||||
+ if (!world.addFreshEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
|
||||
world.gameEvent(itemactioncontext.getPlayer(), GameEvent.ENTITY_PLACE, blockposition);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@@ -179,7 +179,7 @@
|
||||
return Optional.empty();
|
||||
} else {
|
||||
((EntityInsentient) object).setPositionRotation(vec3d.getX(), vec3d.getY(), vec3d.getZ(), 0.0F, 0.0F);
|
||||
- worldserver.addAllEntities((Entity) object);
|
||||
+ worldserver.addAllEntities((Entity) object, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
|
||||
if (itemstack.hasName()) {
|
||||
((EntityInsentient) object).setCustomName(itemstack.getName());
|
||||
((EntityInsentient) object).moveTo(vec3d.x(), vec3d.y(), vec3d.z(), 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers((Entity) object);
|
||||
+ worldserver.addFreshEntityWithPassengers((Entity) object, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
|
||||
if (itemstack.hasCustomHoverName()) {
|
||||
((EntityInsentient) object).setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
@@ -188,7 +188,7 @@
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- return Optional.of(object);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/item/ItemPotion.java
|
||||
+++ b/net/minecraft/world/item/ItemPotion.java
|
||||
@@ -52,7 +52,7 @@
|
||||
if (mobeffect.getMobEffect().isInstant()) {
|
||||
mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D);
|
||||
@@ -51,7 +51,7 @@
|
||||
if (mobeffect.getEffect().isInstantenous()) {
|
||||
mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect));
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/item/ItemRecord.java
|
||||
+++ b/net/minecraft/world/item/ItemRecord.java
|
||||
@@ -43,6 +43,7 @@
|
||||
ItemStack itemstack = itemactioncontext.getItemStack();
|
||||
@@ -42,6 +42,7 @@
|
||||
ItemStack itemstack = itemactioncontext.getItemInHand();
|
||||
|
||||
if (!world.isClientSide) {
|
||||
+ if (true) return EnumInteractionResult.SUCCESS; // CraftBukkit - handled in ItemStack
|
||||
((BlockJukeBox) Blocks.JUKEBOX).a((GeneratorAccess) world, blockposition, iblockdata, itemstack);
|
||||
world.a((EntityHuman) null, 1010, blockposition, Item.getId(this));
|
||||
itemstack.subtract(1);
|
||||
((BlockJukeBox) Blocks.JUKEBOX).setRecord(world, blockposition, iblockdata, itemstack);
|
||||
world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this));
|
||||
itemstack.shrink(1);
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
super(block, block1, item_info);
|
||||
}
|
||||
@@ -19,7 +21,10 @@
|
||||
boolean flag = super.a(blockposition, world, entityhuman, itemstack, iblockdata);
|
||||
boolean flag = super.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata);
|
||||
|
||||
if (!world.isClientSide && !flag && entityhuman != null) {
|
||||
- entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
- entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(blockposition));
|
||||
+ // CraftBukkit start - SPIGOT-4678
|
||||
+ // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
+ // entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(blockposition));
|
||||
+ ItemSign.openSign = blockposition;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
+++ b/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
@@ -51,6 +51,16 @@
|
||||
TileEntitySkull.a(gameprofile, (gameprofile1) -> {
|
||||
nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile1));
|
||||
TileEntitySkull.updateGameprofile(gameprofile, (gameprofile1) -> {
|
||||
nbttagcompound.put("SkullOwner", GameProfileSerializer.writeGameProfile(new NBTTagCompound(), gameprofile1));
|
||||
});
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ net.minecraft.nbt.NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts
|
||||
+ for (int i = 0; i < textures.size(); i++) {
|
||||
+ if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).hasKeyOfType("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) {
|
||||
+ if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).contains("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) {
|
||||
+ nbttagcompound.remove("SkullOwner");
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
--- a/net/minecraft/world/item/ItemSnowball.java
|
||||
+++ b/net/minecraft/world/item/ItemSnowball.java
|
||||
@@ -19,19 +19,32 @@
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
public InteractionResultWrapper<ItemStack> use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.SNOWBALL_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.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // CraftBukkit - moved down
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.SNOWBALL_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.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
if (!world.isClientSide) {
|
||||
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
|
||||
|
||||
entitysnowball.setItem(itemstack);
|
||||
entitysnowball.a(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addEntity(entitysnowball);
|
||||
+ if (world.addEntity(entitysnowball)) {
|
||||
entitysnowball.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
- world.addFreshEntity(entitysnowball);
|
||||
+ if (world.addFreshEntity(entitysnowball)) {
|
||||
+ if (!entityhuman.getAbilities().instabuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+
|
||||
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.SNOWBALL_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.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
||||
+ // CraftBukkit start - moved up
|
||||
+ /*
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
+ */
|
||||
|
||||
return InteractionResultWrapper.a(itemstack, world.isClientSide());
|
||||
return InteractionResultWrapper.sidedSuccess(itemstack, world.isClientSide());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -76,6 +76,39 @@
|
||||
@@ -73,6 +73,40 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Objects;
|
||||
+import net.minecraft.core.EnumDirection;
|
||||
+import net.minecraft.nbt.DynamicOpsNBT;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
|
||||
@@ -40,17 +41,8 @@
|
||||
public final class ItemStack {
|
||||
|
||||
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -89,7 +122,7 @@
|
||||
});
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final ItemStack EMPTY = new ItemStack((Item) null);
|
||||
- public static final DecimalFormat ATTRIBUTE_MODIFIER_FORMAT = (DecimalFormat) SystemUtils.a((Object) (new DecimalFormat("#.##")), (decimalformat) -> {
|
||||
+ public static final DecimalFormat ATTRIBUTE_MODIFIER_FORMAT = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error
|
||||
decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT));
|
||||
});
|
||||
public static final String TAG_ENCH = "Enchantments";
|
||||
@@ -140,16 +173,30 @@
|
||||
this.checkEmpty();
|
||||
@@ -139,16 +173,30 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
+ // Called to run this stack through the data converter to handle older storage methods and serialized items
|
||||
@@ -63,7 +55,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private void checkEmpty() {
|
||||
private void updateEmptyCacheFlag() {
|
||||
+ if (this.emptyCacheFlag && this == ItemStack.EMPTY) throw new AssertionError("TRAP"); // CraftBukkit
|
||||
this.emptyCacheFlag = false;
|
||||
this.emptyCacheFlag = this.isEmpty();
|
||||
@@ -74,16 +66,16 @@
|
||||
+ private void load(NBTTagCompound nbttagcompound) {
|
||||
this.item = (Item) IRegistry.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
|
||||
this.count = nbttagcompound.getByte("Count");
|
||||
if (nbttagcompound.hasKeyOfType("tag", 10)) {
|
||||
if (nbttagcompound.contains("tag", 10)) {
|
||||
- this.tag = nbttagcompound.getCompound("tag");
|
||||
+ // CraftBukkit start - make defensive copy as this data may be coming from the save thread
|
||||
+ this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
|
||||
+ this.tag = nbttagcompound.getCompound("tag").copy();
|
||||
+ // CraftBukkit end
|
||||
this.getItem().b(this.tag);
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -157,6 +204,11 @@
|
||||
this.setDamage(this.getDamage());
|
||||
@@ -156,6 +204,11 @@
|
||||
this.setDamageValue(this.getDamageValue());
|
||||
}
|
||||
|
||||
+ }
|
||||
@@ -91,26 +83,26 @@
|
||||
+ private ItemStack(NBTTagCompound nbttagcompound) {
|
||||
+ this.load(nbttagcompound);
|
||||
+ // CraftBukkit end
|
||||
this.checkEmpty();
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -194,7 +246,7 @@
|
||||
@@ -193,7 +246,7 @@
|
||||
return this.getItem() == item;
|
||||
}
|
||||
|
||||
- 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);
|
||||
@@ -202,12 +254,157 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.b(itemactioncontext.getWorld().r(), shapedetectorblock)) {
|
||||
- public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||
+ public EnumInteractionResult useOn(ItemActionContext itemactioncontext, EnumHand enumhand) { // CraftBukkit - add hand
|
||||
EntityHuman entityhuman = itemactioncontext.getPlayer();
|
||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
|
||||
@@ -201,12 +254,157 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
+ // CraftBukkit start - handle all block place event logic here
|
||||
+ NBTTagCompound oldData = this.getTagClone();
|
||||
+ int oldCount = this.getCount();
|
||||
+ WorldServer world = (WorldServer) itemactioncontext.getWorld();
|
||||
+ WorldServer world = (WorldServer) itemactioncontext.getLevel();
|
||||
+
|
||||
+ if (!(this.getItem() instanceof ItemBucket || this.getItem() instanceof SolidBucketItem)) { // if not bucket
|
||||
+ world.captureBlockStates = true;
|
||||
@@ -120,13 +112,13 @@
|
||||
+ }
|
||||
+ }
|
||||
Item item = this.getItem();
|
||||
EnumInteractionResult enuminteractionresult = item.a(itemactioncontext);
|
||||
EnumInteractionResult enuminteractionresult = item.useOn(itemactioncontext);
|
||||
+ NBTTagCompound newData = this.getTagClone();
|
||||
+ int newCount = this.getCount();
|
||||
+ this.setCount(oldCount);
|
||||
+ this.setTagClone(oldData);
|
||||
+ world.captureBlockStates = false;
|
||||
+ if (enuminteractionresult.a() && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) {
|
||||
+ if (enuminteractionresult.consumesAction() && 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;
|
||||
@@ -160,8 +152,8 @@
|
||||
+ }
|
||||
+ world.captureTreeGeneration = false;
|
||||
|
||||
if (entityhuman != null && enuminteractionresult.c()) {
|
||||
- entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
if (entityhuman != null && enuminteractionresult.shouldAwardStats()) {
|
||||
- entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = null;
|
||||
+ List<BlockState> blocks = new java.util.ArrayList<>(world.capturedBlockStates.values());
|
||||
+ world.capturedBlockStates.clear();
|
||||
@@ -185,7 +177,7 @@
|
||||
+ // Brute force all possible updates
|
||||
+ BlockPosition placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
|
||||
+ for (EnumDirection dir : EnumDirection.values()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, placedPos.shift(dir)));
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutBlockChange(world, placedPos.relative(dir)));
|
||||
+ }
|
||||
+ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return
|
||||
+ } else {
|
||||
@@ -196,44 +188,44 @@
|
||||
+ }
|
||||
+
|
||||
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
|
||||
+ world.setTileEntity(e.getValue());
|
||||
+ world.setBlockEntity(e.getValue());
|
||||
+ }
|
||||
+
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ int updateFlag = ((CraftBlockState) blockstate).getFlag();
|
||||
+ IBlockData oldBlock = ((CraftBlockState) blockstate).getHandle();
|
||||
+ BlockPosition newblockposition = ((CraftBlockState) blockstate).getPosition();
|
||||
+ IBlockData block = world.getType(newblockposition);
|
||||
+ IBlockData block = world.getBlockState(newblockposition);
|
||||
+
|
||||
+ if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically
|
||||
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true);
|
||||
+ }
|
||||
+
|
||||
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
+ }
|
||||
+
|
||||
+ // 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);
|
||||
+ ((BlockJukeBox) Blocks.JUKEBOX).setRecord(world, blockposition, world.getBlockState(blockposition), this);
|
||||
+ world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this.item));
|
||||
+ this.shrink(1);
|
||||
+ entityhuman.awardStat(StatisticList.PLAY_RECORD);
|
||||
+ }
|
||||
+
|
||||
+ if (this.item == Items.WITHER_SKELETON_SKULL) { // Special case skulls to allow wither spawns to be cancelled
|
||||
+ BlockPosition bp = blockposition;
|
||||
+ if (!world.getType(blockposition).getMaterial().isReplaceable()) {
|
||||
+ if (!world.getType(blockposition).getMaterial().isBuildable()) {
|
||||
+ if (!world.getBlockState(blockposition).getMaterial().isReplaceable()) {
|
||||
+ if (!world.getBlockState(blockposition).getMaterial().isSolid()) {
|
||||
+ bp = null;
|
||||
+ } else {
|
||||
+ bp = bp.shift(itemactioncontext.getClickedFace());
|
||||
+ bp = bp.relative(itemactioncontext.getClickedFace());
|
||||
+ }
|
||||
+ }
|
||||
+ if (bp != null) {
|
||||
+ TileEntity te = world.getTileEntity(bp);
|
||||
+ TileEntity te = world.getBlockEntity(bp);
|
||||
+ if (te instanceof TileEntitySkull) {
|
||||
+ BlockWitherSkull.a(world, bp, (TileEntitySkull) te);
|
||||
+ BlockWitherSkull.checkSpawn(world, bp, (TileEntitySkull) te);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -241,7 +233,7 @@
|
||||
+ // SPIGOT-4678
|
||||
+ if (this.item instanceof ItemSign && ItemSign.openSign != null) {
|
||||
+ try {
|
||||
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(ItemSign.openSign));
|
||||
+ entityhuman.openTextEdit((TileEntitySign) world.getBlockEntity(ItemSign.openSign));
|
||||
+ } finally {
|
||||
+ ItemSign.openSign = null;
|
||||
+ }
|
||||
@@ -249,11 +241,11 @@
|
||||
+
|
||||
+ // SPIGOT-1288 - play sound stripped from ItemBlock
|
||||
+ if (this.item instanceof ItemBlock) {
|
||||
+ SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().getStepSound(null);
|
||||
+ SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().getSoundType(null);
|
||||
+ world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
|
||||
+ }
|
||||
+
|
||||
+ entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
+ entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
+ }
|
||||
}
|
||||
+ world.capturedTileEntities.clear();
|
||||
@@ -262,7 +254,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -288,6 +485,21 @@
|
||||
@@ -287,6 +485,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@@ -284,8 +276,8 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -309,6 +521,11 @@
|
||||
if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
@@ -308,6 +521,11 @@
|
||||
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
+ // CraftBukkit start - Check for item breaking
|
||||
@@ -294,40 +286,40 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.subtract(1);
|
||||
this.shrink(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -464,6 +681,17 @@
|
||||
@@ -463,6 +681,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Nullable
|
||||
+ private NBTTagCompound getTagClone() {
|
||||
+ return this.tag == null ? null : this.tag.clone();
|
||||
+ return this.tag == null ? null : this.tag.copy();
|
||||
+ }
|
||||
+
|
||||
+ private void setTagClone(@Nullable NBTTagCompound nbtttagcompound) {
|
||||
+ this.setTag(nbtttagcompound == null ? null : nbtttagcompound.clone());
|
||||
+ this.setTag(nbtttagcompound == null ? null : nbtttagcompound.copy());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -844,6 +1072,12 @@
|
||||
@@ -843,6 +1072,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
+ // CraftBukkit start - remove RepairCost tag when 0 (SPIGOT-3945)
|
||||
+ if (i == 0) {
|
||||
+ this.removeTag("RepairCost");
|
||||
+ this.removeTagKey("RepairCost");
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.getOrCreateTag().setInt("RepairCost", i);
|
||||
this.getOrCreateTag().putInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -893,6 +1127,13 @@
|
||||
@@ -892,6 +1127,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -338,6 +330,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public IChatBaseComponent G() {
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).addSibling(this.getName());
|
||||
public IChatBaseComponent getDisplayName() {
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).append(this.getHoverName());
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit - moved down
|
||||
+ /*
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(entityliving.getUsedItemHand());
|
||||
});
|
||||
+ */
|
||||
if (k == 0) {
|
||||
@@ -17,35 +17,35 @@
|
||||
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
- world.addEntity(entitythrowntrident);
|
||||
- world.addFreshEntity(entitythrowntrident);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entitythrowntrident)) {
|
||||
+ if (!world.addFreshEntity(entitythrowntrident)) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
|
||||
+ itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastBreakEvent(entityliving.getUsedItemHand());
|
||||
+ });
|
||||
+ entitythrowntrident.tridentItem = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved
|
||||
+ entitythrowntrident.tridentItem = itemstack.copy(); // SPIGOT-4511 update since damage call moved
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
entityhuman.getInventory().g(itemstack);
|
||||
entityhuman.getInventory().removeItem(itemstack);
|
||||
}
|
||||
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
|
||||
+ } else {
|
||||
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
|
||||
+ itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
+ entityhuman1.broadcastBreakEvent(entityliving.getUsedItemHand());
|
||||
+ });
|
||||
+ // CraftBukkkit end
|
||||
}
|
||||
}
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
||||
if (k > 0) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerRiptideEvent event = new org.bukkit.event.player.PlayerRiptideEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemWorldMap.java
|
||||
+++ b/net/minecraft/world/item/ItemWorldMap.java
|
||||
@@ -34,6 +34,11 @@
|
||||
@@ -33,6 +33,11 @@
|
||||
import net.minecraft.world.level.material.MaterialMapColor;
|
||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
public class ItemWorldMap extends ItemWorldMapBase {
|
||||
|
||||
public static final int IMAGE_WIDTH = 128;
|
||||
@@ -68,7 +73,7 @@
|
||||
public static Integer d(ItemStack itemstack) {
|
||||
@@ -67,7 +72,7 @@
|
||||
public static Integer getMapId(ItemStack itemstack) {
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
|
||||
- return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : null;
|
||||
+ return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
|
||||
- return nbttagcompound != null && nbttagcompound.contains("map", 99) ? nbttagcompound.getInt("map") : null;
|
||||
+ return nbttagcompound != null && nbttagcompound.contains("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
|
||||
}
|
||||
|
||||
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
||||
@@ -76,6 +81,10 @@
|
||||
int l = world.getWorldMapCount();
|
||||
@@ -75,6 +80,10 @@
|
||||
int l = world.getFreeMapId();
|
||||
|
||||
world.a(a(l), worldmap);
|
||||
world.setMapData(makeKey(l), worldmap);
|
||||
+ // CraftBukkit start
|
||||
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public CraftingManager() {
|
||||
@@ -47,7 +49,12 @@
|
||||
|
||||
protected void a(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
this.hasErrors = false;
|
||||
- Map<Recipes<?>, Builder<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
|
||||
+ // CraftBukkit start - SPIGOT-5667 make sure all types are populated and mutable
|
||||
@@ -31,12 +31,12 @@
|
||||
while (iterator.hasNext()) {
|
||||
@@ -57,8 +64,10 @@
|
||||
try {
|
||||
IRecipe<?> irecipe = a(minecraftkey, ChatDeserializer.m((JsonElement) entry.getValue(), "top element"));
|
||||
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
|
||||
|
||||
- ((Builder) map1.computeIfAbsent(irecipe.g(), (recipes) -> {
|
||||
- ((Builder) map1.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
- return ImmutableMap.builder();
|
||||
+ // CraftBukkit start
|
||||
+ (map1.computeIfAbsent(irecipe.g(), (recipes) -> {
|
||||
+ (map1.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
+ return new Object2ObjectLinkedOpenHashMap<>();
|
||||
+ // CraftBukkit end
|
||||
})).put(minecraftkey, irecipe);
|
||||
@@ -54,44 +54,44 @@
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void addRecipe(IRecipe<?> irecipe) {
|
||||
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.g()); // CraftBukkit
|
||||
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.getType()); // CraftBukkit
|
||||
+
|
||||
+ if (map.containsKey(irecipe.getKey())) {
|
||||
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getKey());
|
||||
+ if (map.containsKey(irecipe.getId())) {
|
||||
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getId());
|
||||
+ } else {
|
||||
+ map.putAndMoveToFirst(irecipe.getKey(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
+ map.putAndMoveToFirst(irecipe.getId(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean a() {
|
||||
public boolean hadErrorsLoading() {
|
||||
return this.hasErrors;
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) {
|
||||
- return this.b(recipes).values().stream().flatMap((irecipe) -> {
|
||||
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) -> {
|
||||
+ // CraftBukkit start
|
||||
+ Optional<T> recipe = this.b(recipes).values().stream().flatMap((irecipe) -> {
|
||||
return SystemUtils.a(recipes.a(irecipe, world, c0));
|
||||
+ Optional<T> recipe = this.byType(recipes).values().stream().flatMap((irecipe) -> {
|
||||
return SystemUtils.toStream(recipes.tryMatch(irecipe, world, c0));
|
||||
}).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> a(Recipes<T> recipes) {
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
|
||||
@@ -96,7 +121,7 @@
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> b(Recipes<T> recipes) {
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> 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> c(Recipes<T> recipes, C c0, World world) {
|
||||
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -117,7 +142,7 @@
|
||||
|
||||
public Optional<? extends IRecipe<?>> getRecipe(MinecraftKey minecraftkey) {
|
||||
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
|
||||
return this.recipes.values().stream().map((map) -> {
|
||||
- return (IRecipe) map.get(minecraftkey);
|
||||
+ return map.get(minecraftkey); // CraftBukkit - decompile error
|
||||
@@ -100,17 +100,17 @@
|
||||
|
||||
@@ -143,11 +168,11 @@
|
||||
|
||||
public void a(Iterable<IRecipe<?>> iterable) {
|
||||
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
|
||||
this.hasErrors = false;
|
||||
- Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap();
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap(); // CraftBukkit
|
||||
|
||||
iterable.forEach((irecipe) -> {
|
||||
Map<MinecraftKey, IRecipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.g(), (recipes) -> {
|
||||
Map<MinecraftKey, IRecipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
- return Maps.newHashMap();
|
||||
+ return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
|
||||
});
|
||||
IRecipe<?> irecipe1 = (IRecipe) map1.put(irecipe.getKey(), irecipe);
|
||||
IRecipe<?> irecipe1 = (IRecipe) map1.put(irecipe.getId(), irecipe);
|
||||
|
||||
@@ -157,4 +182,14 @@
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public FurnaceRecipe(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,14 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SMELTING_RECIPE;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/item/crafting/IRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/IRecipe.java
|
||||
@@ -61,4 +61,6 @@
|
||||
return recipeitemstack.a().length == 0;
|
||||
return recipeitemstack.getItems().length == 0;
|
||||
});
|
||||
}
|
||||
+
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/item/crafting/IRecipeComplex.java
|
||||
+++ b/net/minecraft/world/item/crafting/IRecipeComplex.java
|
||||
@@ -25,4 +25,11 @@
|
||||
public ItemStack getResult() {
|
||||
public ItemStack getResultItem() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public RecipeBlasting(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.BLASTING_RECIPE;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public RecipeCampfire(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.CAMPFIRE_COOKING_RECIPE;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -1,35 +1,26 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeItemStack.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeItemStack.java
|
||||
@@ -35,6 +35,7 @@
|
||||
private final RecipeItemStack.Provider[] values;
|
||||
@@ -37,6 +37,7 @@
|
||||
public ItemStack[] itemStacks;
|
||||
@Nullable
|
||||
private IntList stackingIds;
|
||||
+ public boolean exact; // CraftBukkit
|
||||
|
||||
public RecipeItemStack(Stream<? extends RecipeItemStack.Provider> stream) {
|
||||
this.values = (RecipeItemStack.Provider[]) stream.toArray((i) -> {
|
||||
@@ -72,6 +73,15 @@
|
||||
@@ -74,6 +75,15 @@
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ItemStack itemstack1 = aitemstack[j];
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (exact) {
|
||||
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.equals(itemstack, itemstack1)) {
|
||||
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.tagMatches(itemstack, itemstack1)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (itemstack1.a(itemstack.getItem())) {
|
||||
if (itemstack1.is(itemstack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
@@ -103,7 +113,7 @@
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) {
|
||||
this.buildChoices();
|
||||
- packetdataserializer.a((Collection) Arrays.asList(this.itemStacks), PacketDataSerializer::a);
|
||||
+ packetdataserializer.a(Arrays.asList(this.itemStacks), PacketDataSerializer::a); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public JsonElement c() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeSmithing.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeSmithing.java
|
||||
@@ -12,6 +12,14 @@
|
||||
@@ -11,6 +11,14 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class RecipeSmithing implements IRecipe<IInventory> {
|
||||
|
||||
final RecipeItemStack base;
|
||||
@@ -84,6 +92,17 @@
|
||||
@@ -83,6 +91,17 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public RecipeSmoking(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SMOKING_RECIPE;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public RecipeStonecutting(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack) {
|
||||
@@ -21,4 +29,16 @@
|
||||
public ItemStack h() {
|
||||
public ItemStack getToastSymbol() {
|
||||
return new ItemStack(Blocks.STONECUTTER);
|
||||
}
|
||||
+
|
||||
|
||||
@@ -79,5 +79,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public MinecraftKey getKey() {
|
||||
public MinecraftKey getId() {
|
||||
return this.id;
|
||||
|
||||
@@ -32,5 +32,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public MinecraftKey getKey() {
|
||||
public MinecraftKey getId() {
|
||||
return this.id;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
+++ b/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
@@ -57,8 +57,11 @@
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
IBlockData iblockdata2 = world.getBlockState(blockposition1);
|
||||
|
||||
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.get(BlockFluids.LEVEL) == 0 && iblockdata.canPlace(world, blockposition1) && world.a(iblockdata, blockposition1, VoxelShapeCollision.a())) {
|
||||
- world.setTypeUpdate(blockposition1, iblockdata);
|
||||
- world.getBlockTickList().a(blockposition1, Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.getValue(BlockFluids.LEVEL) == 0 && 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
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition1, iblockdata, entityliving)) {
|
||||
+ world.getBlockTickList().a(blockposition1, Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
+ world.scheduleTick(blockposition1, Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/item/enchantment/EnchantmentWeaponDamage.java
|
||||
+++ b/net/minecraft/world/item/enchantment/EnchantmentWeaponDamage.java
|
||||
@@ -63,7 +63,7 @@
|
||||
if (this.type == 2 && i > 0 && entityliving1.getMonsterType() == EnumMonsterType.ARTHROPOD) {
|
||||
if (this.type == 2 && i > 0 && entityliving1.getMobType() == EnumMonsterType.ARTHROPOD) {
|
||||
int j = 20 + entityliving.getRandom().nextInt(10 * i);
|
||||
|
||||
- entityliving1.addEffect(new MobEffect(MobEffects.MOVEMENT_SLOWDOWN, j, 3));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
+++ b/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
@@ -45,9 +45,17 @@
|
||||
public static final Enchantment MENDING = a("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
|
||||
public static final Enchantment VANISHING_CURSE = a("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
|
||||
@@ -45,6 +45,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()));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ static {
|
||||
@@ -14,8 +14,4 @@
|
||||
+
|
||||
public Enchantments() {}
|
||||
|
||||
private static Enchantment a(String s, Enchantment enchantment) {
|
||||
- return (Enchantment) IRegistry.a(IRegistry.ENCHANTMENT, s, (Object) enchantment);
|
||||
+ return (Enchantment) IRegistry.a(IRegistry.ENCHANTMENT, s, enchantment); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
private static Enchantment register(String s, Enchantment enchantment) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/item/trading/IMerchant.java
|
||||
+++ b/net/minecraft/world/item/trading/IMerchant.java
|
||||
@@ -53,4 +53,6 @@
|
||||
}
|
||||
|
||||
@@ -52,4 +52,6 @@
|
||||
}
|
||||
|
||||
boolean isClientSide();
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
this.rewardExp = true;
|
||||
@@ -78,6 +92,7 @@
|
||||
|
||||
public ItemStack getBuyItem1() {
|
||||
public ItemStack getCostA() {
|
||||
int i = this.baseCostA.getCount();
|
||||
+ if (i <= 0) return ItemStack.EMPTY; // CraftBukkit - SPIGOT-5476
|
||||
ItemStack itemstack = this.baseCostA.cloneItemStack();
|
||||
int j = Math.max(0, MathHelper.d((float) (i * this.demand) * this.priceMultiplier));
|
||||
ItemStack itemstack = this.baseCostA.copy();
|
||||
int j = Math.max(0, MathHelper.floor((float) (i * this.demand) * this.priceMultiplier));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user