@@ -0,0 +1,75 @@
|
||||
--- a/net/minecraft/core/IRegistryCustom.java
|
||||
+++ b/net/minecraft/core/IRegistryCustom.java
|
||||
@@ -80,7 +80,7 @@
|
||||
public <E> Optional<? extends IRegistry<E>> registry(ResourceKey<? extends IRegistry<? extends E>> resourcekey) {
|
||||
Optional<? extends IRegistry<E>> optional = this.ownedRegistry(resourcekey);
|
||||
|
||||
- return optional.isPresent() ? optional : IRegistry.REGISTRY.getOptional(resourcekey.location());
|
||||
+ return optional.isPresent() ? optional : (Optional<? extends IRegistry<E>>) IRegistry.REGISTRY.getOptional(resourcekey.location()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public <E> IRegistry<E> registryOrThrow(ResourceKey<? extends IRegistry<? extends E>> resourcekey) {
|
||||
@@ -138,7 +138,7 @@
|
||||
}
|
||||
|
||||
private static <R extends IRegistry<?>> void copyBuiltin(IRegistryCustom.Dimension iregistrycustom_dimension, ResourceKey<R> resourcekey) {
|
||||
- IRegistry<R> iregistry = RegistryGeneration.REGISTRY;
|
||||
+ IRegistry<R> iregistry = (IRegistry<R>) RegistryGeneration.REGISTRY; // CraftBukkit - decompile error
|
||||
IRegistry<?> iregistry1 = (IRegistry) iregistry.getOrThrow(resourcekey);
|
||||
|
||||
copy(iregistrycustom_dimension, iregistry1);
|
||||
@@ -178,8 +178,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
- public static final class RegistryData extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ public static final record RegistryData<E>(ResourceKey<? extends IRegistry<E>> key, Codec<E> codec, @Nullable Codec<E> networkCodec) {
|
||||
|
||||
+ /*
|
||||
private final ResourceKey<? extends IRegistry<E>> key;
|
||||
private final Codec<E> codec;
|
||||
@Nullable
|
||||
@@ -190,11 +192,15 @@
|
||||
this.codec = codec;
|
||||
this.networkCodec = codec1;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
public boolean sendToClient() {
|
||||
return this.networkCodec != null;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
public final String toString() {
|
||||
return this.toString < invokedynamic > (this);
|
||||
}
|
||||
@@ -219,6 +225,8 @@
|
||||
public Codec<E> networkCodec() {
|
||||
return this.networkCodec;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static final class Dimension extends IRegistryCustom {
|
||||
@@ -267,7 +275,7 @@
|
||||
}
|
||||
|
||||
private static <E> RegistryMaterials<?> parseRegistry(ResourceKey<? extends IRegistry<?>> resourcekey, Dynamic<?> dynamic) {
|
||||
- DataResult dataresult = RegistryLookupCodec.create(resourcekey).codec().parse(dynamic);
|
||||
+ DataResult<?> dataresult = RegistryLookupCodec.create((ResourceKey) resourcekey).codec().parse(dynamic); // CraftBukkit - decompile error
|
||||
String s = resourcekey + " registry: ";
|
||||
Logger logger = IRegistryCustom.LOGGER;
|
||||
|
||||
@@ -282,7 +290,7 @@
|
||||
}
|
||||
|
||||
private static <E> RegistryMaterials<?> createRegistry(ResourceKey<? extends IRegistry<?>> resourcekey) {
|
||||
- return new RegistryMaterials<>(resourcekey, Lifecycle.stable());
|
||||
+ return new RegistryMaterials(resourcekey, Lifecycle.stable()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,40 @@
|
||||
--- a/net/minecraft/core/RegistryMaterials.java
|
||||
+++ b/net/minecraft/core/RegistryMaterials.java
|
||||
@@ -201,7 +201,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
- return SystemUtils.getRandom(this.randomCache, random);
|
||||
+ return (T) SystemUtils.getRandom(this.randomCache, random); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,7 +228,7 @@
|
||||
return registrymaterials;
|
||||
}, (registrymaterials) -> {
|
||||
Builder<RegistryMaterials.a<T>> builder = ImmutableList.builder();
|
||||
- Iterator iterator = registrymaterials.iterator();
|
||||
+ Iterator<T> iterator = registrymaterials.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -257,8 +257,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
- private static final class a extends Record {
|
||||
+ // CraftBukkit start
|
||||
+ private static final record a<T>(ResourceKey<T> key, int id, T value) {
|
||||
|
||||
+ /*
|
||||
private final ResourceKey<T> key;
|
||||
private final int id;
|
||||
private final T value;
|
||||
@@ -292,5 +294,7 @@
|
||||
public T value() {
|
||||
return this.value;
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
@@ -30,6 +30,10 @@
|
||||
import net.minecraft.world.level.block.state.properties.IBlockState;
|
||||
@@ -29,6 +29,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -10,151 +10,151 @@
|
||||
+
|
||||
public interface CauldronInteraction {
|
||||
|
||||
Map<Item, CauldronInteraction> EMPTY = a();
|
||||
@@ -52,6 +56,11 @@
|
||||
Map<Item, CauldronInteraction> EMPTY = newInteractionMap();
|
||||
@@ -51,6 +55,11 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
@@ -60,7 +69,7 @@
|
||||
@@ -59,7 +68,7 @@
|
||||
|
||||
entityhuman.a(enumhand, itemstack1);
|
||||
entityhuman.a(StatisticList.CLEAN_SHULKER_BOX);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -71,6 +80,11 @@
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -70,6 +79,11 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
|
||||
itemstack1.setCount(1);
|
||||
@@ -88,7 +102,7 @@
|
||||
@@ -87,7 +101,7 @@
|
||||
}
|
||||
|
||||
entityhuman.a(StatisticList.CLEAN_BANNER);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -106,9 +120,14 @@
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -105,9 +119,14 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
idyeable.e_(itemstack);
|
||||
entityhuman.a(StatisticList.CLEAN_ARMOR);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
idyeable.clearColor(itemstack);
|
||||
entityhuman.awardStat(StatisticList.CLEAN_ARMOR);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -117,7 +136,7 @@
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -116,7 +135,7 @@
|
||||
};
|
||||
|
||||
static Object2ObjectOpenHashMap<Item, CauldronInteraction> a() {
|
||||
- return (Object2ObjectOpenHashMap) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
|
||||
+ return SystemUtils.a((new Object2ObjectOpenHashMap<>()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
||||
static Object2ObjectOpenHashMap<Item, CauldronInteraction> newInteractionMap() {
|
||||
- return (Object2ObjectOpenHashMap) SystemUtils.make(new Object2ObjectOpenHashMap(), (object2objectopenhashmap) -> {
|
||||
+ return SystemUtils.make(new Object2ObjectOpenHashMap<>(), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
||||
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
return EnumInteractionResult.PASS;
|
||||
});
|
||||
@@ -133,12 +152,17 @@
|
||||
@@ -132,12 +151,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.getBlockData(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, Blocks.WATER_CAULDRON.getBlockData());
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.WATER_CAULDRON.getBlockData()); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
- world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState());
|
||||
+ // world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -154,12 +178,17 @@
|
||||
@@ -153,12 +177,17 @@
|
||||
});
|
||||
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, PotionUtil.a(new ItemStack(Items.POTION), Potions.WATER)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -169,10 +198,15 @@
|
||||
@@ -168,10 +197,15 @@
|
||||
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if ((Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.d(itemstack) == Potions.WATER) {
|
||||
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.getPotion(itemstack) == Potions.WATER) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.a(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(itemstack.getItem()));
|
||||
- world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL));
|
||||
+ // world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL));
|
||||
+ // world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -244,12 +278,17 @@
|
||||
@@ -243,12 +277,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.CAULDRON.getBlockData(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, itemstack1));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, Blocks.CAULDRON.getBlockData());
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.CAULDRON.getBlockData()); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
- world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState());
|
||||
+ // world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -260,12 +299,17 @@
|
||||
@@ -259,12 +298,17 @@
|
||||
|
||||
static EnumInteractionResult a(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
||||
@@ -163,11 +163,11 @@
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.BUCKET)));
|
||||
entityhuman.a(StatisticList.FILL_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, iblockdata);
|
||||
+ // world.setTypeUpdate(blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.BUCKET)));
|
||||
entityhuman.awardStat(StatisticList.FILL_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ // world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
- EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ 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));
|
||||
@@ -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());
|
||||
@@ -48,11 +48,11 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityboat.setType(this.type);
|
||||
entityboat.setYRot(enumdirection.o());
|
||||
- worldserver.addEntity(entityboat);
|
||||
- itemstack.subtract(1);
|
||||
+ if (!worldserver.addEntity(entityboat)) itemstack.add(1); // CraftBukkit
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled during event processing
|
||||
entityboat.setYRot(enumdirection.toYRot());
|
||||
- worldserver.addFreshEntity(entityboat);
|
||||
- itemstack.shrink(1);
|
||||
+ if (!worldserver.addFreshEntity(entityboat)) itemstack.grow(1); // CraftBukkit
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,37 +14,37 @@
|
||||
|
||||
public DispenseBehaviorItem() {}
|
||||
@@ -26,11 +32,19 @@
|
||||
IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
IPosition iposition = BlockDispenser.getDispensePosition(isourceblock);
|
||||
ItemStack itemstack1 = itemstack.split(1);
|
||||
|
||||
- a(isourceblock.getWorld(), itemstack1, 6, enumdirection, iposition);
|
||||
- spawnItem(isourceblock.getLevel(), itemstack1, 6, enumdirection, iposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (!a(isourceblock.getWorld(), itemstack1, 6, enumdirection, isourceblock)) {
|
||||
+ itemstack.add(1);
|
||||
+ if (!spawnItem(isourceblock.getLevel(), itemstack1, 6, enumdirection, isourceblock)) {
|
||||
+ itemstack.grow(1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
- public static void a(World world, ItemStack itemstack, int i, EnumDirection enumdirection, IPosition iposition) {
|
||||
- public static void spawnItem(World world, ItemStack itemstack, int i, EnumDirection enumdirection, IPosition iposition) {
|
||||
+ // CraftBukkit start - void -> boolean return, IPosition -> ISourceBlock last argument
|
||||
+ public static boolean a(World world, ItemStack itemstack, int i, EnumDirection enumdirection, ISourceBlock isourceblock) {
|
||||
+ public static boolean spawnItem(World world, ItemStack itemstack, int i, EnumDirection enumdirection, ISourceBlock isourceblock) {
|
||||
+ if (itemstack.isEmpty()) return true;
|
||||
+ IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
+ IPosition iposition = BlockDispenser.getDispensePosition(isourceblock);
|
||||
+ // CraftBukkit end
|
||||
double d0 = iposition.getX();
|
||||
double d1 = iposition.getY();
|
||||
double d2 = iposition.getZ();
|
||||
double d0 = iposition.x();
|
||||
double d1 = iposition.y();
|
||||
double d2 = iposition.z();
|
||||
@@ -45,7 +59,39 @@
|
||||
double d3 = world.random.nextDouble() * 0.1D + 0.2D;
|
||||
|
||||
entityitem.setMot(world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getAdjacentX() * d3, world.random.nextGaussian() * 0.007499999832361937D * (double) i + 0.20000000298023224D, world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getAdjacentZ() * d3);
|
||||
entityitem.setDeltaMovement(world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getStepX() * d3, world.random.nextGaussian() * 0.007499999832361937D * (double) i + 0.20000000298023224D, world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getStepZ() * d3);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), CraftVector.toBukkit(entityitem.getMot()));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), CraftVector.toBukkit(entityitem.getDeltaMovement()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
@@ -53,8 +53,8 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ entityitem.setItemStack(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ entityitem.setMot(CraftVector.toNMS(event.getVelocity()));
|
||||
+ entityitem.setItem(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ entityitem.setDeltaMovement(CraftVector.toNMS(event.getVelocity()));
|
||||
+
|
||||
+ if (!event.getItem().getType().equals(craftItem.getType())) {
|
||||
+ // Chain to handler for new item
|
||||
@@ -63,15 +63,15 @@
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior.getClass() != DispenseBehaviorItem.class) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ } else {
|
||||
+ world.addEntity(entityitem);
|
||||
+ world.addFreshEntity(entityitem);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
world.addEntity(entityitem);
|
||||
world.addFreshEntity(entityitem);
|
||||
+
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
protected void playSound(ISourceBlock isourceblock) {
|
||||
|
||||
@@ -15,28 +15,28 @@
|
||||
|
||||
public DispenseBehaviorProjectile() {}
|
||||
@@ -20,9 +27,38 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
IProjectile iprojectile = this.a((World) worldserver, iposition, itemstack);
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
IProjectile iprojectile = this.getProjectile(worldserver, iposition, itemstack);
|
||||
|
||||
- iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
|
||||
+ // iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
|
||||
- iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty());
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ // iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty());
|
||||
+ 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((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ()));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ 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());
|
||||
@@ -46,12 +46,12 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.a());
|
||||
+ ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
+ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.getUncertainty());
|
||||
+ ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getEntity());
|
||||
+ // CraftBukkit end
|
||||
worldserver.addEntity(iprojectile);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - Handled during event processing
|
||||
worldserver.addFreshEntity(iprojectile);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - Handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
@@ -25,6 +25,12 @@
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
public class DispenseBehaviorShears extends DispenseBehaviorMaybe {
|
||||
|
||||
public DispenseBehaviorShears() {}
|
||||
@@ -32,11 +38,34 @@
|
||||
@@ -31,11 +37,34 @@
|
||||
@Override
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -42,31 +42,31 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!worldserver.isClientSide()) {
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
||||
- this.a(a((WorldServer) worldserver, blockposition) || b((WorldServer) worldserver, blockposition));
|
||||
+ this.a(a((WorldServer) worldserver, blockposition) || b((WorldServer) worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.a() && itemstack.isDamaged(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
- this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.isSuccess() && itemstack.hurt(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
@@ -63,7 +92,7 @@
|
||||
@@ -62,7 +91,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- private static boolean b(WorldServer worldserver, BlockPosition blockposition) {
|
||||
+ private static boolean b(WorldServer worldserver, BlockPosition blockposition, org.bukkit.block.Block bukkitBlock, CraftItemStack craftItem) { // CraftBukkit - add args
|
||||
List<EntityLiving> list = worldserver.a(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
|
||||
- private static boolean tryShearLivingEntity(WorldServer worldserver, BlockPosition blockposition) {
|
||||
+ private static boolean tryShearLivingEntity(WorldServer worldserver, BlockPosition blockposition, org.bukkit.block.Block bukkitBlock, CraftItemStack craftItem) { // CraftBukkit - add args
|
||||
List<EntityLiving> list = worldserver.getEntitiesOfClass(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -74,6 +103,11 @@
|
||||
@@ -73,6 +102,11 @@
|
||||
IShearable ishearable = (IShearable) entityliving;
|
||||
|
||||
if (ishearable.canShear()) {
|
||||
if (ishearable.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ishearable.shear(SoundCategory.BLOCKS);
|
||||
worldserver.a((Entity) null, GameEvent.SHEAR, blockposition);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
|
||||
@@ -12,6 +12,11 @@
|
||||
@@ -11,6 +11,11 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
public class DispenseBehaviorShulkerBox extends DispenseBehaviorMaybe {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -28,6 +33,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
|
||||
@@ -27,6 +32,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
EnumDirection enumdirection1 = isourceblock.getLevel().isEmptyBlock(blockposition.below()) ? enumdirection : EnumDirection.UP;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = isourceblock.getWorld().getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = isourceblock.getLevel().getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ isourceblock.getWorld().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ isourceblock.getLevel().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -41,5 +41,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
try {
|
||||
this.a(((ItemBlock) item).a((BlockActionContext) (new BlockActionContextDirectional(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))).a());
|
||||
this.setSuccess(((ItemBlock) item).place(new BlockActionContextDirectional(isourceblock.getLevel(), blockposition, enumdirection, itemstack, enumdirection1)).consumesAction());
|
||||
} catch (Exception exception) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -79,6 +79,21 @@
|
||||
@@ -76,6 +76,21 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -22,59 +22,14 @@
|
||||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogManager.getLogger();
|
||||
@@ -120,7 +135,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.EGG, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
- return (IProjectile) SystemUtils.a((Object) (new EntityEgg(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entityegg) -> {
|
||||
+ return (IProjectile) SystemUtils.a((new EntityEgg(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entityegg) -> { // CraftBukkit - decompile error
|
||||
entityegg.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -128,7 +143,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.SNOWBALL, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
- return (IProjectile) SystemUtils.a((Object) (new EntitySnowball(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitysnowball) -> {
|
||||
+ return (IProjectile) SystemUtils.a((new EntitySnowball(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitysnowball) -> { // CraftBukkit - decompile error
|
||||
entitysnowball.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -136,7 +151,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.EXPERIENCE_BOTTLE, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
- return (IProjectile) SystemUtils.a((Object) (new EntityThrownExpBottle(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitythrownexpbottle) -> {
|
||||
+ return (IProjectile) SystemUtils.a((new EntityThrownExpBottle(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitythrownexpbottle) -> { // CraftBukkit - decompile error
|
||||
entitythrownexpbottle.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -157,7 +172,7 @@
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
|
||||
- return (IProjectile) SystemUtils.a((Object) (new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitypotion) -> {
|
||||
+ return (IProjectile) SystemUtils.a((new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitypotion) -> { // CraftBukkit - decompile error
|
||||
entitypotion.setItem(itemstack1);
|
||||
});
|
||||
}
|
||||
@@ -180,7 +195,7 @@
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
|
||||
- return (IProjectile) SystemUtils.a((Object) (new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitypotion) -> {
|
||||
+ return (IProjectile) SystemUtils.a((new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ())), (entitypotion) -> { // CraftBukkit - decompile error
|
||||
entitypotion.setItem(itemstack1);
|
||||
});
|
||||
}
|
||||
@@ -203,14 +218,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).a(itemstack.getTag());
|
||||
@@ -200,14 +215,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = isourceblock.getWorld();
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ WorldServer worldserver = isourceblock.getLevel();
|
||||
+ 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(0, 0, 0));
|
||||
@@ -83,12 +38,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());
|
||||
@@ -99,27 +54,27 @@
|
||||
+ }
|
||||
+
|
||||
try {
|
||||
entitytypes.spawnCreature(isourceblock.getWorld(), itemstack, (EntityHuman) null, isourceblock.getBlockPosition().shift(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false);
|
||||
entitytypes.spawn(isourceblock.getLevel(), itemstack, (EntityHuman) null, isourceblock.getPos().relative(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false);
|
||||
} catch (Exception exception) {
|
||||
- null.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getBlockPosition(), exception);
|
||||
+ LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getBlockPosition(), exception); // CraftBukkit - decompile error
|
||||
- null.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getPos(), exception);
|
||||
+ LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getPos(), exception); // CraftBukkit - decompile error
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // Handled during event processing
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
isourceblock.getWorld().a(GameEvent.ENTITY_PLACE, isourceblock.getBlockPosition());
|
||||
isourceblock.getLevel().gameEvent(GameEvent.ENTITY_PLACE, isourceblock.getPos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -229,12 +272,40 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
@@ -226,12 +269,40 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ 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(0, 0, 0));
|
||||
@@ -128,12 +83,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());
|
||||
@@ -146,22 +101,22 @@
|
||||
+
|
||||
EntityArmorStand entityarmorstand = new EntityArmorStand(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
|
||||
|
||||
EntityTypes.a((World) worldserver, (EntityHuman) null, (Entity) entityarmorstand, itemstack.getTag());
|
||||
entityarmorstand.setYRot(enumdirection.o());
|
||||
worldserver.addEntity(entityarmorstand);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - Handled during event processing
|
||||
EntityTypes.updateCustomEntityTag(worldserver, (EntityHuman) null, entityarmorstand, itemstack.getTag());
|
||||
entityarmorstand.setYRot(enumdirection.toYRot());
|
||||
worldserver.addFreshEntity(entityarmorstand);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - Handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
}));
|
||||
@@ -253,8 +324,35 @@
|
||||
});
|
||||
@@ -250,8 +321,35 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ World world = isourceblock.getWorld();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ 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) list.get(0).getBukkitEntity());
|
||||
@@ -170,12 +125,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());
|
||||
@@ -185,21 +140,21 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((ISaddleable) list.get(0)).saddle(SoundCategory.BLOCKS);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled above
|
||||
this.a(true);
|
||||
((ISaddleable) list.get(0)).equipSaddle(SoundCategory.BLOCKS);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled above
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
@@ -281,7 +379,35 @@
|
||||
@@ -278,7 +376,35 @@
|
||||
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
|
||||
} while (!entityhorseabstract.m(itemstack) || entityhorseabstract.gd() || !entityhorseabstract.isTamed());
|
||||
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
|
||||
|
||||
- entityhorseabstract.k(401).a(itemstack.cloneAndSubtract(1));
|
||||
- entityhorseabstract.getSlot(401).set(itemstack.split(1));
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ World world = isourceblock.getWorld();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ 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) entityhorseabstract.getBukkitEntity());
|
||||
@@ -208,12 +163,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());
|
||||
@@ -223,21 +178,21 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ entityhorseabstract.k(401).a(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ entityhorseabstract.getSlot(401).set(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
this.a(true);
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -324,9 +450,35 @@
|
||||
@@ -321,9 +447,35 @@
|
||||
}
|
||||
|
||||
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
|
||||
- } while (!entityhorsechestedabstract.isTamed() || !entityhorsechestedabstract.k(499).a(itemstack));
|
||||
- } while (!entityhorsechestedabstract.isTamed() || !entityhorsechestedabstract.getSlot(499).set(itemstack));
|
||||
+ // CraftBukkit start
|
||||
+ } while (!entityhorsechestedabstract.isTamed());
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ World world = isourceblock.getWorld();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ 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) entityhorsechestedabstract.getBukkitEntity());
|
||||
@@ -245,7 +200,7 @@
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
||||
- itemstack.subtract(1);
|
||||
- itemstack.shrink(1);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@@ -259,35 +214,35 @@
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ entityhorsechestedabstract.k(499).a(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ entityhorsechestedabstract.getSlot(499).set(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled above
|
||||
this.a(true);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled above
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -335,12 +487,41 @@
|
||||
@@ -332,12 +484,41 @@
|
||||
@Override
|
||||
public ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = isourceblock.getWorld();
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ WorldServer worldserver = isourceblock.getLevel();
|
||||
+ 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(enumdirection.getAdjacentX(), enumdirection.getAdjacentY(), enumdirection.getAdjacentZ()));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(enumdirection.getStepX(), enumdirection.getStepY(), enumdirection.getStepZ()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ 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());
|
||||
@@ -298,30 +253,30 @@
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack, isourceblock.getX(), isourceblock.getY(), isourceblock.getX(), true);
|
||||
EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getLevel(), itemstack, isourceblock.x(), isourceblock.y(), isourceblock.x(), true);
|
||||
|
||||
IDispenseBehavior.a(isourceblock, entityfireworks, enumdirection);
|
||||
entityfireworks.shoot((double) enumdirection.getAdjacentX(), (double) enumdirection.getAdjacentY(), (double) enumdirection.getAdjacentZ(), 0.5F, 1.0F);
|
||||
isourceblock.getWorld().addEntity(entityfireworks);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // Handled during event processing
|
||||
IDispenseBehavior.setEntityPokingOutOfBlock(isourceblock, entityfireworks, enumdirection);
|
||||
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
|
||||
isourceblock.getLevel().addFreshEntity(entityfireworks);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -362,12 +543,40 @@
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentX();
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
|
||||
@@ -359,12 +540,40 @@
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepX();
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepZ();
|
||||
- EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5);
|
||||
|
||||
- worldserver.addEntity((Entity) SystemUtils.a((Object) entitysmallfireball, (entitysmallfireball1) -> {
|
||||
- worldserver.addFreshEntity((Entity) SystemUtils.make(entitysmallfireball, (entitysmallfireball1) -> {
|
||||
- entitysmallfireball1.setItem(itemstack);
|
||||
- }));
|
||||
- itemstack.subtract(1);
|
||||
- itemstack.shrink(1);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ 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(d3, d4, d5));
|
||||
@@ -330,12 +285,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());
|
||||
@@ -347,26 +302,26 @@
|
||||
+
|
||||
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ entitysmallfireball.setItem(itemstack1);
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getEntity());
|
||||
+
|
||||
+ worldserver.addEntity(entitysmallfireball);
|
||||
+ // itemstack.subtract(1); // Handled during event processing
|
||||
+ worldserver.addFreshEntity(entitysmallfireball);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -391,9 +600,52 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
@@ -388,9 +597,52 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ int x = blockposition.getX();
|
||||
+ int y = blockposition.getY();
|
||||
+ int z = blockposition.getZ();
|
||||
+ IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
+ IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+ if (worldserver.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlace(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ 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))) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
|
||||
@@ -392,38 +347,38 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (dispensiblecontaineritem.a((EntityHuman) null, worldserver, blockposition, (MovingObjectPositionBlock) null)) {
|
||||
dispensiblecontaineritem.a((EntityHuman) null, worldserver, itemstack, blockposition);
|
||||
if (dispensiblecontaineritem.emptyContents((EntityHuman) null, worldserver, blockposition, (MovingObjectPositionBlock) null)) {
|
||||
dispensiblecontaineritem.checkExtraContent((EntityHuman) null, worldserver, itemstack, blockposition);
|
||||
- return new ItemStack(Items.BUCKET);
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
+ Item item = Items.BUCKET;
|
||||
+ itemstack.subtract(1);
|
||||
+ itemstack.shrink(1);
|
||||
+ if (itemstack.isEmpty()) {
|
||||
+ itemstack.setItem(Items.BUCKET);
|
||||
+ itemstack.setCount(1);
|
||||
+ } else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
+ } else if (((TileEntityDispenser) isourceblock.getEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
+ this.defaultDispenseItemBehavior.dispense(isourceblock, new ItemStack(item));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ return itemstack;
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
|
||||
}
|
||||
@@ -419,7 +671,7 @@
|
||||
@@ -416,7 +668,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
- ItemStack itemstack1 = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata);
|
||||
+ ItemStack itemstack1 = ((IFluidSource) block).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
|
||||
- ItemStack itemstack1 = ((IFluidSource) block).pickupBlock(worldserver, blockposition, iblockdata);
|
||||
+ ItemStack itemstack1 = ((IFluidSource) block).pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.a(isourceblock, itemstack);
|
||||
@@ -427,6 +679,32 @@
|
||||
worldserver.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
return super.execute(isourceblock, itemstack);
|
||||
@@ -424,6 +676,32 @@
|
||||
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -445,18 +400,18 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata); // From above
|
||||
+ itemstack1 = ((IFluidSource) block).pickupBlock(worldserver, blockposition, iblockdata); // From above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -448,14 +726,42 @@
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
@@ -445,14 +723,42 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -479,29 +434,29 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.a(true);
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
this.setSuccess(true);
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
if (BlockFireAbstract.a((World) worldserver, blockposition, enumdirection)) {
|
||||
- worldserver.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) worldserver, blockposition));
|
||||
- worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
if (BlockFireAbstract.canBePlacedAt(worldserver, blockposition, enumdirection)) {
|
||||
- worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
|
||||
- worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ // CraftBukkit start - Ignition by dispensing flint and steel
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition, isourceblock.getBlockPosition()).isCancelled()) {
|
||||
+ worldserver.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) worldserver, blockposition));
|
||||
+ worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition, isourceblock.getPos()).isCancelled()) {
|
||||
+ worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
|
||||
+ worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!BlockCampfire.h(iblockdata) && !CandleBlock.g(iblockdata) && !CandleCakeBlock.g(iblockdata)) {
|
||||
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
|
||||
if (iblockdata.getBlock() instanceof BlockTNT) {
|
||||
BlockTNT.a((World) worldserver, blockposition);
|
||||
@@ -481,12 +787,62 @@
|
||||
this.a(true);
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
BlockTNT.explode(worldserver, blockposition);
|
||||
@@ -478,12 +784,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -526,10 +481,10 @@
|
||||
+ worldserver.captureTreeGeneration = true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!ItemBoneMeal.a(itemstack, (World) worldserver, blockposition) && !ItemBoneMeal.a(itemstack, (World) worldserver, blockposition, (EnumDirection) null)) {
|
||||
this.a(false);
|
||||
if (!ItemBoneMeal.growCrop(itemstack, worldserver, blockposition) && !ItemBoneMeal.growWaterPlant(itemstack, worldserver, blockposition, (EnumDirection) null)) {
|
||||
this.setSuccess(false);
|
||||
} else if (!worldserver.isClientSide) {
|
||||
worldserver.triggerEffect(1505, blockposition, 0);
|
||||
worldserver.levelEvent(1505, blockposition, 0);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
@@ -559,16 +514,16 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -496,12 +852,41 @@
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
@@ -493,12 +849,41 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+ // CraftBukkit start
|
||||
+ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ 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((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
|
||||
@@ -577,12 +532,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());
|
||||
@@ -595,20 +550,20 @@
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null);
|
||||
+ // CraftBukkit end
|
||||
|
||||
worldserver.addEntity(entitytntprimed);
|
||||
worldserver.playSound((EntityHuman) null, entitytntprimed.locX(), entitytntprimed.locY(), entitytntprimed.locZ(), SoundEffects.TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
worldserver.a((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled above
|
||||
worldserver.addFreshEntity(entitytntprimed);
|
||||
worldserver.playSound((EntityHuman) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEffects.TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled above
|
||||
return itemstack;
|
||||
}
|
||||
}));
|
||||
@@ -525,6 +910,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
});
|
||||
@@ -522,6 +907,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -631,15 +586,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (worldserver.isEmpty(blockposition) && BlockWitherSkull.b((World) worldserver, blockposition, itemstack)) {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.ROTATION, enumdirection.n() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3);
|
||||
worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -550,6 +959,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, enumdirection.getAxis() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.getOpposite().get2DDataValue() * 4), 3);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -547,6 +956,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -662,15 +617,15 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (worldserver.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) worldserver, blockposition)) {
|
||||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setTypeAndData(blockposition, blockpumpkincarved.getBlockData(), 3);
|
||||
@@ -599,6 +1032,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -596,6 +1029,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -693,6 +648,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (iblockdata.a((Tag) TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
|
||||
return blockbase_blockdata.b(BlockBeehive.HONEY_LEVEL);
|
||||
}) && (Integer) iblockdata.get(BlockBeehive.HONEY_LEVEL) >= 5) {
|
||||
if (iblockdata.is(TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
|
||||
return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL);
|
||||
}) && (Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL) >= 5) {
|
||||
|
||||
Reference in New Issue
Block a user