Fix modified fireworks from dispenser event

This commit is contained in:
chickeneer 2015-06-13 22:50:04 -05:00 committed by md_5
parent 994b2aae3f
commit c9c233b796

View File

@ -60,10 +60,11 @@
return itemstack; return itemstack;
} }
}); });
@@ -90,10 +127,38 @@ @@ -90,10 +127,39 @@
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack);
+ // CraftBukkit start + // CraftBukkit start
+ World world = isourceblock.i(); + World world = isourceblock.i();
+ ItemStack itemstack1 = itemstack.a(1); + ItemStack itemstack1 = itemstack.a(1);
@ -91,7 +92,8 @@
+ } + }
+ } + }
+ +
EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack); + itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
+ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), itemstack1);
isourceblock.i().addEntity(entityfireworks); isourceblock.i().addEntity(entityfireworks);
- itemstack.a(1); - itemstack.a(1);
@ -100,7 +102,7 @@
return itemstack; return itemstack;
} }
@@ -114,8 +179,38 @@ @@ -114,8 +180,38 @@
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
@ -141,7 +143,7 @@
return itemstack; return itemstack;
} }
@@ -146,10 +241,38 @@ @@ -146,10 +242,38 @@
d3 = 0.0D; d3 = 0.0D;
} }
@ -182,7 +184,7 @@
return itemstack; return itemstack;
} }
@@ -164,9 +287,48 @@ @@ -164,9 +288,48 @@
ItemBucket itembucket = (ItemBucket) itemstack.getItem(); ItemBucket itembucket = (ItemBucket) itemstack.getItem();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
@ -233,7 +235,7 @@
return itemstack; return itemstack;
} else { } else {
return this.b.a(isourceblock, itemstack); return this.b.a(isourceblock, itemstack);
@@ -197,6 +359,30 @@ @@ -197,6 +360,30 @@
item = Items.LAVA_BUCKET; item = Items.LAVA_BUCKET;
} }
@ -264,7 +266,7 @@
world.setAir(blockposition); world.setAir(blockposition);
if (--itemstack.count == 0) { if (--itemstack.count == 0) {
itemstack.setItem(item); itemstack.setItem(item);
@@ -215,11 +401,39 @@ @@ -215,11 +402,39 @@
World world = isourceblock.i(); World world = isourceblock.i();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
@ -307,7 +309,7 @@
} else if (world.getType(blockposition).getBlock() == Blocks.TNT) { } else if (world.getType(blockposition).getBlock() == Blocks.TNT) {
Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true))); Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
world.setAir(blockposition); world.setAir(blockposition);
@@ -247,6 +461,30 @@ @@ -247,6 +462,30 @@
World world = isourceblock.i(); World world = isourceblock.i();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
@ -338,7 +340,7 @@
if (ItemDye.a(itemstack, world, blockposition)) { if (ItemDye.a(itemstack, world, blockposition)) {
if (!world.isClientSide) { if (!world.isClientSide) {
world.triggerEffect(2005, blockposition, 0); world.triggerEffect(2005, blockposition, 0);
@@ -274,11 +512,40 @@ @@ -274,11 +513,40 @@
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.i(); World world = isourceblock.i();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));