SPIGOT-4161: Missing BlockDispenseEvent for Waterlogged

Dieser Commit ist enthalten in:
md_5 2018-07-27 19:29:47 +10:00
Ursprung 0891fc1c45
Commit 3d7f2f07d5
2 geänderte Dateien mit 20 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -158,7 +158,7 @@
return itemstack;
}
@@ -175,9 +271,49 @@
@@ -175,9 +271,51 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
World world = isourceblock.getWorld();
@ -166,7 +166,9 @@
+ int x = blockposition.getX();
+ int y = blockposition.getY();
+ int z = blockposition.getZ();
+ if (world.isEmpty(blockposition) || !world.getType(blockposition).getMaterial().isBuildable()) {
+ IBlockData iblockdata = world.getType(blockposition);
+ Material material = iblockdata.getMaterial();
+ if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).a(world, blockposition, iblockdata, itembucket.a))) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
@ -210,7 +212,7 @@
} else {
return this.a.dispense(isourceblock, itemstack);
}
@@ -207,6 +343,30 @@
@@ -207,6 +345,30 @@
} else {
Item item = fluidtype.b();
@ -241,7 +243,7 @@
itemstack.subtract(1);
if (itemstack.isEmpty()) {
return new ItemStack(item);
@@ -227,11 +387,39 @@
@@ -227,11 +389,39 @@
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
@ -282,7 +284,7 @@
} else {
Block block = world.getType(blockposition).getBlock();
@@ -255,12 +443,55 @@
@@ -255,12 +445,55 @@
this.a = true;
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
@ -338,7 +340,7 @@
return itemstack;
}
@@ -269,11 +500,40 @@
@@ -269,11 +502,40 @@
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
@ -381,7 +383,7 @@
return itemstack;
}
}));
@@ -295,6 +555,30 @@
@@ -295,6 +557,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
@ -412,7 +414,7 @@
this.a = true;
if (world.isEmpty(blockposition) && BlockWitherSkull.b(world, blockposition, itemstack)) {
world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, Integer.valueOf(enumdirection.opposite().get2DRotationValue() * 4)), 3);
@@ -318,6 +602,30 @@
@@ -318,6 +604,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@ -443,7 +445,7 @@
this.a = true;
if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) {
if (!world.isClientSide) {
@@ -379,6 +687,51 @@
@@ -379,6 +689,51 @@
}
d();
@ -495,7 +497,7 @@
}
}
}
@@ -387,7 +740,7 @@
@@ -387,7 +742,7 @@
LocaleLanguage localelanguage = LocaleLanguage.a();
registrymaterials.iterator().forEachRemaining((object) -> {
@ -504,7 +506,7 @@
if (!localelanguage.b(s)) {
DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, registrymaterials.b(object), s);
@@ -481,6 +834,30 @@
@@ -481,6 +836,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
@ -535,7 +537,7 @@
this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS;
if (this.a) {
itemstack.subtract(1);
@@ -534,12 +911,40 @@
@@ -534,12 +913,40 @@
d3 = 0.0D;
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ItemBucket.java
+++ b/net/minecraft/server/ItemBucket.java
@@ -1,6 +1,13 @@
@@ -1,10 +1,17 @@
package net.minecraft.server;
import javax.annotation.Nullable;
@ -14,6 +14,11 @@
public class ItemBucket extends Item {
- private final FluidType a;
+ public final FluidType a; // PAIL: private->public
public ItemBucket(FluidType fluidtype, Item.Info item_info) {
super(item_info);
@@ -28,12 +35,20 @@
if (this.a == FluidTypes.a) {
iblockdata = world.getType(blockposition);