@@ -41,10 +41,10 @@
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
ItemStack itemstack1 = itemstack.copyWithCount(1);
|
||||
|
||||
itemstack1.setCount(1);
|
||||
@@ -87,7 +101,7 @@
|
||||
TileEntityBanner.removeLastPattern(itemstack1);
|
||||
@@ -86,7 +100,7 @@
|
||||
}
|
||||
|
||||
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -105,9 +119,14 @@
|
||||
@@ -104,9 +118,14 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -116,7 +135,7 @@
|
||||
@@ -115,7 +134,7 @@
|
||||
};
|
||||
|
||||
static Object2ObjectOpenHashMap<Item, CauldronInteraction> newInteractionMap() {
|
||||
@@ -78,7 +78,7 @@
|
||||
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
return EnumInteractionResult.PASS;
|
||||
});
|
||||
@@ -132,12 +151,17 @@
|
||||
@@ -131,12 +150,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
@@ -97,7 +97,7 @@
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -153,12 +177,17 @@
|
||||
@@ -152,12 +176,17 @@
|
||||
});
|
||||
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if (!world.isClientSide) {
|
||||
@@ -116,7 +116,7 @@
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -168,10 +197,15 @@
|
||||
@@ -167,10 +196,15 @@
|
||||
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.getPotion(itemstack) == Potions.WATER) {
|
||||
if (!world.isClientSide) {
|
||||
@@ -133,7 +133,7 @@
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -243,12 +277,17 @@
|
||||
@@ -242,12 +276,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
@@ -152,7 +152,7 @@
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -259,12 +298,17 @@
|
||||
@@ -258,12 +297,17 @@
|
||||
|
||||
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
if (!world.isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
|
||||
@@ -11,6 +11,11 @@
|
||||
@@ -12,6 +12,11 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem defaultDispenseItemBehavior;
|
||||
@@ -47,12 +52,40 @@
|
||||
d3 = 0.0D;
|
||||
@@ -49,12 +54,40 @@
|
||||
d4 = 0.0D;
|
||||
}
|
||||
|
||||
- Object object = this.isChestBoat ? new ChestBoat(worldserver, d0, d1 + d3, d2) : new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
- Object object = this.isChestBoat ? new ChestBoat(worldserver, d1, d2 + d4, d3) : new EntityBoat(worldserver, d1, d2 + d4, d3);
|
||||
+ // Object object = this.isChestBoat ? new ChestBoat(worldserver, d1, d2 + d4, d3) : new EntityBoat(worldserver, d1, d2 + d4, d3);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d1, d2 + d4, d3));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
if (!worldserver.isClientSide()) {
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
||||
- this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
- this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.isSuccess() && itemstack.hurt(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -78,6 +78,22 @@
|
||||
@@ -78,6 +78,21 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
+import net.minecraft.world.item.ItemBucket;
|
||||
+import net.minecraft.world.level.block.BlockSapling;
|
||||
+import net.minecraft.world.level.block.IFluidContainer;
|
||||
+import net.minecraft.world.level.material.Material;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
@@ -23,7 +22,7 @@
|
||||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -202,14 +218,42 @@
|
||||
@@ -202,14 +217,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
|
||||
|
||||
@@ -68,7 +67,7 @@
|
||||
isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -228,13 +272,41 @@
|
||||
@@ -228,13 +271,41 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
@@ -111,7 +110,7 @@
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -255,8 +327,35 @@
|
||||
@@ -255,8 +326,35 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
@@ -148,7 +147,7 @@
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
@@ -283,7 +382,35 @@
|
||||
@@ -283,7 +381,35 @@
|
||||
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
|
||||
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
|
||||
|
||||
@@ -185,7 +184,7 @@
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -326,9 +453,35 @@
|
||||
@@ -326,9 +452,35 @@
|
||||
}
|
||||
|
||||
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
|
||||
@@ -223,7 +222,7 @@
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -337,12 +490,41 @@
|
||||
@@ -337,12 +489,41 @@
|
||||
@Override
|
||||
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
@@ -266,7 +265,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -364,12 +546,40 @@
|
||||
@@ -364,12 +545,40 @@
|
||||
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
|
||||
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
|
||||
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
|
||||
@@ -312,7 +311,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -405,9 +615,52 @@
|
||||
@@ -405,9 +614,51 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
@@ -321,8 +320,7 @@
|
||||
+ int y = blockposition.getY();
|
||||
+ int z = blockposition.getZ();
|
||||
+ IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+ if (worldserver.isEmptyBlock(blockposition) || !material.isSolid() || material.isReplaceable() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlaceLiquid(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ if (iblockdata.isAir() || iblockdata.canBeReplaced() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlaceLiquid(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
@@ -366,7 +364,7 @@
|
||||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
|
||||
}
|
||||
@@ -434,7 +687,7 @@
|
||||
@@ -434,7 +685,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
@@ -375,7 +373,7 @@
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.execute(isourceblock, itemstack);
|
||||
@@ -442,6 +695,32 @@
|
||||
@@ -442,6 +693,32 @@
|
||||
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
@@ -408,7 +406,7 @@
|
||||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -463,16 +742,44 @@
|
||||
@@ -463,16 +740,44 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
@@ -456,7 +454,7 @@
|
||||
BlockTNT.explode(worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
} else {
|
||||
@@ -496,12 +803,62 @@
|
||||
@@ -496,12 +801,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
@@ -519,7 +517,7 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -511,12 +868,41 @@
|
||||
@@ -511,12 +866,41 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
@@ -563,7 +561,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -541,6 +927,30 @@
|
||||
@@ -541,6 +925,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
|
||||
@@ -594,7 +592,7 @@
|
||||
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -566,6 +976,30 @@
|
||||
@@ -566,6 +974,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
@@ -625,7 +623,7 @@
|
||||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -615,6 +1049,30 @@
|
||||
@@ -615,6 +1047,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user