|
|
|
|
@@ -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);
|
|
|
|
|
|
|
|
|
|
|