geforkt von Mirrors/Paper
Update to Minecraft 1.8.3
Dieser Commit ist enthalten in:
Ursprung
33d5de312e
Commit
d8a9c7be42
@ -1,139 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:26:13.625913570 +0000
|
||||
+++ src/main/java/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:15:22.000000000 +0000
|
||||
@@ -132,7 +132,7 @@
|
||||
WorldGenTreeAbstract worldgentreeabstract = biomebase.a(this.b);
|
||||
|
||||
worldgentreeabstract.e();
|
||||
- blockposition = this.a.getHighestBlockYAt(this.c.a(k, 0, l));
|
||||
+ blockposition = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash
|
||||
if (worldgentreeabstract.generate(this.a, this.b, blockposition)) {
|
||||
worldgentreeabstract.a(this.a, this.b, blockposition);
|
||||
}
|
||||
@@ -141,7 +141,7 @@
|
||||
for (j = 0; j < this.K; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- this.v.generate(this.a, this.b, this.a.getHighestBlockYAt(this.c.a(k, 0, l)));
|
||||
+ this.v.generate(this.a, this.b, this.getHighestBlockYAt(this.c.a(k, 0, l ))); // CraftBukkit - Prevent crash
|
||||
}
|
||||
|
||||
int i1;
|
||||
@@ -149,7 +149,7 @@
|
||||
for (j = 0; j < this.B; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); // CraftBukkit - Prevent crash
|
||||
blockposition = this.c.a(k, i1, l);
|
||||
EnumFlowerVarient enumflowervarient = biomebase.a(this.b, blockposition);
|
||||
BlockFlowers blockflowers = enumflowervarient.a().a();
|
||||
@@ -163,14 +163,14 @@
|
||||
for (j = 0; j < this.C; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
biomebase.b(this.b).generate(this.a, this.b, this.c.a(k, i1, l));
|
||||
}
|
||||
|
||||
for (j = 0; j < this.D; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
(new WorldGenDeadBush()).generate(this.a, this.b, this.c.a(k, i1, l));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
while (j < this.z) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
blockposition = this.c.a(k, i1, l);
|
||||
|
||||
while (true) {
|
||||
@@ -202,7 +202,7 @@
|
||||
if (this.b.nextInt(4) == 0) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- BlockPosition blockposition2 = this.a.getHighestBlockYAt(this.c.a(k, 0, l));
|
||||
+ BlockPosition blockposition2 = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash
|
||||
|
||||
this.t.generate(this.a, this.b, blockposition2);
|
||||
}
|
||||
@@ -210,7 +210,7 @@
|
||||
if (this.b.nextInt(8) == 0) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
blockposition = this.c.a(k, i1, l);
|
||||
this.u.generate(this.a, this.b, blockposition);
|
||||
}
|
||||
@@ -219,42 +219,42 @@
|
||||
if (this.b.nextInt(4) == 0) {
|
||||
j = this.b.nextInt(16) + 8;
|
||||
k = this.b.nextInt(16) + 8;
|
||||
- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
|
||||
+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
this.t.generate(this.a, this.b, this.c.a(j, l, k));
|
||||
}
|
||||
|
||||
if (this.b.nextInt(8) == 0) {
|
||||
j = this.b.nextInt(16) + 8;
|
||||
k = this.b.nextInt(16) + 8;
|
||||
- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
|
||||
+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
this.u.generate(this.a, this.b, this.c.a(j, l, k));
|
||||
}
|
||||
|
||||
for (j = 0; j < this.F; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
this.w.generate(this.a, this.b, this.c.a(k, i1, l));
|
||||
}
|
||||
|
||||
for (j = 0; j < 10; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
this.w.generate(this.a, this.b, this.c.a(k, i1, l));
|
||||
}
|
||||
|
||||
if (this.b.nextInt(32) == 0) {
|
||||
j = this.b.nextInt(16) + 8;
|
||||
k = this.b.nextInt(16) + 8;
|
||||
- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2);
|
||||
+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
(new WorldGenPumpkin()).generate(this.a, this.b, this.c.a(j, l, k));
|
||||
}
|
||||
|
||||
for (j = 0; j < this.G; ++j) {
|
||||
k = this.b.nextInt(16) + 8;
|
||||
l = this.b.nextInt(16) + 8;
|
||||
- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2);
|
||||
+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash
|
||||
this.x.generate(this.a, this.b, this.c.a(k, i1, l));
|
||||
}
|
||||
|
||||
@@ -274,6 +274,16 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - The heightMap can be wrong calculated and return Y = 0 which will crash the Server
|
||||
+ private BlockPosition getHighestBlockYAt( BlockPosition blockPosition ) {
|
||||
+ BlockPosition returnBlockPosition = this.a.getHighestBlockYAt( blockPosition );
|
||||
+ if ( returnBlockPosition.getY() == 0 ) {
|
||||
+ returnBlockPosition = returnBlockPosition.up( 1 );
|
||||
+ }
|
||||
+ return returnBlockPosition;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void a(int i, WorldGenerator worldgenerator, int j, int k) {
|
||||
int l;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BiomeTheEndDecorator.java 2014-11-28 17:43:42.857707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BiomeTheEndDecorator.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BiomeTheEndDecorator.java 2015-02-26 22:40:21.971608146 +0000
|
||||
+++ src/main/java/net/minecraft/server/BiomeTheEndDecorator.java 2015-02-26 22:40:21.971608146 +0000
|
||||
@@ -21,7 +21,7 @@
|
||||
EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.a);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/Block.java 2014-11-28 17:43:42.913707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/Block.java 2014-11-28 17:38:24.000000000 +0000
|
||||
@@ -295,7 +295,8 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/Block.java 2015-02-26 22:40:22.155608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/Block.java 2015-02-26 22:40:22.159608144 +0000
|
||||
@@ -336,7 +336,8 @@
|
||||
int j = this.getDropCount(i, world.random);
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
@ -10,9 +10,9 @@
|
||||
Item item = this.getDropType(iblockdata, world.random, i);
|
||||
|
||||
if (item != null) {
|
||||
@@ -920,4 +921,10 @@
|
||||
private static void a(int i, String s, Block block) {
|
||||
a(i, new MinecraftKey(s), block);
|
||||
@@ -1002,4 +1003,10 @@
|
||||
return this.getBreakSound();
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockBloodStone.java 2014-11-28 17:43:42.873707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockBloodStone.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockBloodStone.java 2015-02-26 22:40:22.031608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockBloodStone.java 2015-02-26 22:40:22.031608145 +0000
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockButtonAbstract.java 2014-11-28 17:43:42.877707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockButtonAbstract.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockButtonAbstract.java 2015-02-26 22:40:22.035608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockButtonAbstract.java 2015-02-26 22:40:22.039608145 +0000
|
||||
@@ -3,6 +3,11 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@ -12,7 +12,7 @@
|
||||
public abstract class BlockButtonAbstract extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -122,6 +127,19 @@
|
||||
@@ -124,6 +129,19 @@
|
||||
if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
|
||||
return true;
|
||||
} else {
|
||||
@ -32,8 +32,8 @@
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3);
|
||||
world.b(blockposition, blockposition);
|
||||
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
@@ -159,6 +177,16 @@
|
||||
if (this.M) {
|
||||
@@ -161,6 +179,16 @@
|
||||
if (this.N) {
|
||||
this.f(world, blockposition, iblockdata);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
@ -47,13 +47,12 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
|
||||
this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
@@ -192,8 +220,42 @@
|
||||
List list = world.a(EntityArrow.class, new AxisAlignedBB((double) blockposition.getX() + this.minX, (double) blockposition.getY() + this.minY, (double) blockposition.getZ() + this.minZ, (double) blockposition.getX() + this.maxX, (double) blockposition.getY() + this.maxY, (double) blockposition.getZ() + this.maxZ));
|
||||
@@ -195,7 +223,41 @@
|
||||
boolean flag = !list.isEmpty();
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue();
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Call interact event when arrows turn on wooden buttons
|
||||
+ if (flag1 != flag && flag) {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@ -77,7 +76,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (flag && !flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@ -90,9 +89,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)));
|
||||
this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
world.b(blockposition, blockposition);
|
||||
@@ -201,6 +263,16 @@
|
||||
@@ -203,6 +265,16 @@
|
||||
}
|
||||
|
||||
if (!flag && flag1) {
|
||||
@ -107,5 +106,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
|
||||
this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
world.b(blockposition, blockposition);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/BlockCactus.java 2014-12-11 00:44:17.652251803 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCactus.java 2014-12-11 00:43:46.164252144 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockCactus.java 2015-02-26 22:40:22.043608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCactus.java 2015-02-26 22:40:22.043608145 +0000
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockCake.java 2014-11-28 17:43:42.881707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCake.java 2014-11-28 17:38:19.000000000 +0000
|
||||
@@ -54,7 +54,18 @@
|
||||
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockCake.java 2015-02-26 22:40:22.047608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCake.java 2015-02-26 22:40:22.047608145 +0000
|
||||
@@ -55,7 +55,18 @@
|
||||
private void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
if (entityhuman.j(false)) {
|
||||
entityhuman.b(StatisticList.H);
|
||||
- entityhuman.getFoodData().eat(2, 0.1F);
|
||||
+ // CraftBukkit start
|
||||
+ // entityhuman.getFoodData().eat(2, 0.1F);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockCocoa.java 2014-11-28 17:43:42.881707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCocoa.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockCocoa.java 2015-02-26 22:40:22.063608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCocoa.java 2015-02-26 22:40:22.067608145 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockCommand.java 2014-11-28 17:43:42.885707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCommand.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockCommand.java 2015-02-26 22:40:22.071608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCommand.java 2015-02-26 22:40:22.071608145 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -9,11 +9,11 @@
|
||||
public class BlockCommand extends BlockContainer {
|
||||
|
||||
public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered");
|
||||
@@ -19,11 +21,20 @@
|
||||
if (!world.isStatic) {
|
||||
@@ -20,10 +22,19 @@
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockCommand.TRIGGERED)).booleanValue();
|
||||
+
|
||||
|
||||
- if (flag && !flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = flag1 ? 15 : 0;
|
||||
@ -22,8 +22,7 @@
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (flag && !flag1) {
|
||||
+
|
||||
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockCommand.TRIGGERED, Boolean.valueOf(true)), 4);
|
||||
world.a(blockposition, (Block) this, this.a(world));
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockCrops.java 2014-11-28 17:43:42.885707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCrops.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockCrops.java 2015-02-26 22:40:22.083608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockCrops.java 2015-02-26 22:40:22.083608145 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDaylightDetector.java 2014-11-28 17:43:42.889707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDaylightDetector.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDaylightDetector.java 2015-02-26 22:40:22.091608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDaylightDetector.java 2015-02-26 22:40:22.091608145 +0000
|
||||
@@ -41,6 +41,7 @@
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDiodeAbstract.java 2014-11-28 17:43:42.889707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDiodeAbstract.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDiodeAbstract.java 2015-02-26 22:40:22.099608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDiodeAbstract.java 2015-02-26 22:40:22.103608145 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -8,18 +8,18 @@
|
||||
+
|
||||
public abstract class BlockDiodeAbstract extends BlockDirectional {
|
||||
|
||||
protected final boolean M;
|
||||
protected final boolean N;
|
||||
@@ -31,8 +33,18 @@
|
||||
boolean flag = this.e(world, blockposition, iblockdata);
|
||||
|
||||
if (this.M && !flag) {
|
||||
if (this.N && !flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, this.k(iblockdata), 2);
|
||||
} else if (!this.M) {
|
||||
} else if (!this.N) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
|
@ -1,14 +1,23 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDispenser.java 2014-11-28 17:43:42.893707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDispenser.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDispenser.java 2015-02-26 22:40:22.103608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDispenser.java 2015-02-26 22:40:22.103608145 +0000
|
||||
@@ -8,6 +8,7 @@
|
||||
public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered");
|
||||
public static final RegistryDefault M = new RegistryDefault(new DispenseBehaviorItem());
|
||||
protected Random N = new Random();
|
||||
public static final RegistryDefault<Item, IDispenseBehavior> N = new RegistryDefault(new DispenseBehaviorItem());
|
||||
protected Random O = new Random();
|
||||
+ public static boolean eventFired = false; // CraftBukkit
|
||||
|
||||
protected BlockDispenser() {
|
||||
super(Material.STONE);
|
||||
@@ -78,6 +79,7 @@
|
||||
@@ -68,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- protected void dispense(World world, BlockPosition blockposition) {
|
||||
+ public void dispense(World world, BlockPosition blockposition) { // CraftBukkit - public
|
||||
SourceBlock sourceblock = new SourceBlock(world, blockposition);
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
|
||||
|
||||
@@ -83,6 +84,7 @@
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.a) {
|
||||
ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDoor.java 2014-11-28 17:43:42.893707440 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDoor.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDoor.java 2015-02-26 22:40:22.107608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDoor.java 2015-02-26 22:40:22.107608145 +0000
|
||||
@@ -3,6 +3,8 @@
|
||||
import com.google.common.base.Predicate;
|
||||
import java.util.Random;
|
||||
@ -8,12 +8,14 @@
|
||||
+
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -151,9 +153,21 @@
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -155,9 +157,22 @@
|
||||
this.b(world, blockposition, iblockdata, 0);
|
||||
}
|
||||
} else {
|
||||
- boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition2);
|
||||
|
||||
- if ((flag1 || block.isPowerSource()) && block != this && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@ -27,13 +29,12 @@
|
||||
+ if (oldPower == 0 ^ power == 0) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
- if ((flag1 || block.isPowerSource()) && block != this && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
+
|
||||
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
world.setTypeAndData(blockposition2, iblockdata2.set(BlockDoor.POWERED, Boolean.valueOf(flag1)), 2);
|
||||
if (flag1 != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.OPEN, Boolean.valueOf(flag1)), 2);
|
||||
@@ -161,6 +175,7 @@
|
||||
@@ -165,6 +180,7 @@
|
||||
world.a((EntityHuman) null, flag1 ? 1003 : 1006, blockposition, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDragonEgg.java 2014-11-28 17:43:42.897707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDragonEgg.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDragonEgg.java 2015-02-26 22:40:22.111608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDragonEgg.java 2015-02-26 22:40:22.111608145 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -25,6 +25,6 @@
|
||||
+
|
||||
+ blockposition1 = new BlockPosition(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ());
|
||||
+ // CraftBukkit end
|
||||
if (world.isStatic) {
|
||||
if (world.isClientSide) {
|
||||
for (int j = 0; j < 128; ++j) {
|
||||
double d0 = world.random.nextDouble();
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockDropper.java 2014-11-28 17:43:42.897707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDropper.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockDropper.java 2015-02-26 22:40:22.115608145 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockDropper.java 2015-02-26 22:40:22.115608145 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -10,7 +10,16 @@
|
||||
+
|
||||
public class BlockDropper extends BlockDispenser {
|
||||
|
||||
private final IDispenseBehavior O = new DispenseBehaviorItem();
|
||||
private final IDispenseBehavior P = new DispenseBehaviorItem();
|
||||
@@ -14,7 +19,7 @@
|
||||
return new TileEntityDropper();
|
||||
}
|
||||
|
||||
- protected void dispense(World world, BlockPosition blockposition) {
|
||||
+ public void dispense(World world, BlockPosition blockposition) { // CraftBukkit - public
|
||||
SourceBlock sourceblock = new SourceBlock(world, blockposition);
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
|
||||
|
||||
@@ -38,8 +43,25 @@
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockEnderPortal.java 2014-11-28 17:43:42.901707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockEnderPortal.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockEnderPortal.java 2015-02-26 22:40:22.119608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockEnderPortal.java 2015-02-26 22:40:22.119608144 +0000
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@ -12,7 +12,7 @@
|
||||
@@ -36,6 +38,10 @@
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (entity.vehicle == null && entity.passenger == null && !world.isStatic) {
|
||||
if (entity.vehicle == null && entity.passenger == null && !world.isClientSide) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockFire.java 2015-02-17 14:05:03.475599681 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockFire.java 2015-02-17 14:05:03.475599681 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockFire.java 2015-02-26 22:40:22.123608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockFire.java 2015-02-26 22:40:22.123608144 +0000
|
||||
@@ -4,6 +4,12 @@
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@ -25,7 +25,7 @@
|
||||
@@ -120,7 +126,7 @@
|
||||
}
|
||||
|
||||
if (!flag && world.S() && this.d(world, blockposition)) {
|
||||
if (!flag && world.S() && this.e(world, blockposition)) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain
|
||||
} else {
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
@@ -133,14 +139,14 @@
|
||||
if (!flag) {
|
||||
if (!this.e(world, blockposition)) {
|
||||
if (!this.f(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) || i > 3) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit
|
||||
@ -76,11 +76,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,6 +248,17 @@
|
||||
|
||||
@@ -224,6 +249,17 @@
|
||||
if (random.nextInt(i) < k) {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+
|
||||
@ -91,9 +90,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
|
||||
int l = j + random.nextInt(5) / 4;
|
||||
|
||||
@@ -233,7 +269,7 @@
|
||||
|
||||
world.setTypeAndData(blockposition, this.getBlockData().set(BlockFire.AGE, Integer.valueOf(l)), 3);
|
||||
@ -106,7 +106,7 @@
|
||||
@@ -290,7 +326,7 @@
|
||||
|
||||
public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.e(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block gone
|
||||
}
|
||||
@ -114,8 +114,8 @@
|
||||
}
|
||||
@@ -298,7 +334,7 @@
|
||||
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (world.worldProvider.getDimension() > 0 || !Blocks.PORTAL.d(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.e(world, blockposition)) {
|
||||
if (world.worldProvider.getDimension() > 0 || !Blocks.PORTAL.e(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockFlowing.java 2014-11-28 17:43:42.905707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockFlowing.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockFlowing.java 2015-02-26 22:40:22.127608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockFlowing.java 2015-02-26 22:40:22.127608144 +0000
|
||||
@@ -5,6 +5,11 @@
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@ -26,48 +26,33 @@
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.material == Material.LAVA && !world.worldProvider.n()) {
|
||||
@@ -88,17 +98,25 @@
|
||||
@@ -88,6 +98,12 @@
|
||||
IBlockData iblockdata2 = world.getType(blockposition.down());
|
||||
|
||||
if (this.h(world, blockposition.down(), iblockdata2)) {
|
||||
- if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) {
|
||||
- world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
||||
- this.fizz(world, blockposition.down());
|
||||
- return;
|
||||
- }
|
||||
+ // CraftBukkit start - Send "down" to the server
|
||||
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
|
||||
+ if (server != null) {
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) {
|
||||
+ world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
||||
+ this.fizz(world, blockposition.down());
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- if (i >= 8) {
|
||||
- this.flow(world, blockposition.down(), iblockdata2, i);
|
||||
- } else {
|
||||
- this.flow(world, blockposition.down(), iblockdata2, i + 8);
|
||||
+ if (i >= 8) {
|
||||
+ this.flow(world, blockposition.down(), iblockdata2, i);
|
||||
+ } else {
|
||||
+ this.flow(world, blockposition.down(), iblockdata2, i + 8);
|
||||
+ }
|
||||
if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) {
|
||||
world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
||||
this.fizz(world, blockposition.down());
|
||||
@@ -99,6 +115,8 @@
|
||||
} else {
|
||||
this.flow(world, blockposition.down(), iblockdata2, i + 8);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i >= 0 && (i == 0 || this.g(world, blockposition.down(), iblockdata2))) {
|
||||
Set set = this.e(world, blockposition);
|
||||
|
||||
@@ -115,8 +133,17 @@
|
||||
Set set = this.f(world, blockposition);
|
||||
|
||||
@@ -116,7 +134,16 @@
|
||||
while (iterator1.hasNext()) {
|
||||
EnumDirection enumdirection1 = (EnumDirection) iterator1.next();
|
||||
-
|
||||
|
||||
- this.flow(world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection1));
|
||||
+ if (server != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockGrass.java 2014-11-28 17:43:42.909707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockGrass.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockGrass.java 2015-02-26 22:40:22.147608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockGrass.java 2015-02-26 22:40:22.147608144 +0000
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -17,8 +17,8 @@
|
||||
public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy");
|
||||
@@ -22,7 +30,19 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().n() > 2) {
|
||||
if (!world.isClientSide) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
@ -39,7 +39,7 @@
|
||||
@@ -31,7 +51,19 @@
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.n() <= 2) {
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) {
|
||||
- world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData());
|
||||
@ -58,7 +58,7 @@
|
||||
}
|
||||
}
|
||||
@@ -74,13 +106,15 @@
|
||||
IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.l(), enumflowervarient);
|
||||
IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.n(), blockflowers_enumflowervarient);
|
||||
|
||||
if (blockflowers.f(world, blockposition2, iblockdata1)) {
|
||||
- world.setTypeAndData(blockposition2, iblockdata1, 3);
|
||||
@ -66,11 +66,11 @@
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), iblockdata1.getBlock(), iblockdata1.getBlock().toLegacyData(iblockdata1)); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
IBlockData iblockdata2 = Blocks.TALLGRASS.getBlockData().set(BlockLongGrass.TYPE, EnumTallGrassType.GRASS);
|
||||
IBlockData iblockdata2 = Blocks.TALLGRASS.getBlockData().set(BlockLongGrass.TYPE, BlockLongGrass.EnumTallGrassType.GRASS);
|
||||
|
||||
if (Blocks.TALLGRASS.f(world, blockposition2, iblockdata2)) {
|
||||
- world.setTypeAndData(blockposition2, iblockdata2, 3);
|
||||
+ // world.setTypeAndData(blockposition2, iblockdata2, 3); // CRaftBukkit
|
||||
+ // world.setTypeAndData(blockposition2, iblockdata2, 3); // CraftBukkit
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), iblockdata2.getBlock(), iblockdata2.getBlock().toLegacyData(iblockdata2)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockIce.java 2014-11-28 17:43:42.909707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockIce.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockIce.java 2015-02-26 22:40:22.151608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockIce.java 2015-02-26 22:40:22.151608144 +0000
|
||||
@@ -44,6 +44,12 @@
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11 - this.n()) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11 - this.p()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), world.worldProvider.n() ? Blocks.AIR : Blocks.WATER).isCancelled()) {
|
||||
+ return;
|
||||
|
23
nms-patches/BlockJukeBox.patch
Normale Datei
23
nms-patches/BlockJukeBox.patch
Normale Datei
@ -0,0 +1,23 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockJukeBox.java 2015-02-26 22:40:22.159608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockJukeBox.java 2015-02-26 22:40:22.163608144 +0000
|
||||
@@ -32,7 +32,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void dropRecord(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ public void dropRecord(World world, BlockPosition blockposition, IBlockData iblockdata) { // CraftBukkit - public
|
||||
if (!world.isClientSide) {
|
||||
TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
|
||||
@@ -136,6 +136,11 @@
|
||||
}
|
||||
|
||||
public void setRecord(ItemStack itemstack) {
|
||||
+ // CraftBukkit start - There can only be one
|
||||
+ if (itemstack != null) {
|
||||
+ itemstack.count = 1;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.record = itemstack;
|
||||
this.update();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockLeaves.java 2014-11-29 22:31:45.788917956 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockLeaves.java 2014-11-29 22:27:58.604922998 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockLeaves.java 2015-02-26 22:40:22.163608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockLeaves.java 2015-02-26 22:40:22.167608144 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -9,10 +9,10 @@
|
||||
public abstract class BlockLeaves extends BlockTransparent {
|
||||
|
||||
public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable");
|
||||
@@ -128,6 +130,14 @@
|
||||
@@ -130,6 +132,14 @@
|
||||
}
|
||||
|
||||
private void d(World world, BlockPosition blockposition) {
|
||||
private void e(World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockLever.java 2014-11-28 17:43:42.917707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockLever.java 2014-11-28 17:38:24.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockLever.java 2015-02-26 22:40:22.167608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockLever.java 2015-02-26 22:40:22.171608144 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Iterator;
|
||||
@ -8,13 +8,13 @@
|
||||
+
|
||||
public class BlockLever extends Block {
|
||||
|
||||
public static final BlockStateEnum FACING = BlockStateEnum.of("facing", EnumLeverPosition.class);
|
||||
@@ -144,6 +146,20 @@
|
||||
if (world.isStatic) {
|
||||
public static final BlockStateEnum<BlockLever.EnumLeverPosition> FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class);
|
||||
@@ -155,6 +157,20 @@
|
||||
if (world.isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
+ // CraftBukkit start - Interact Lever
|
||||
+ boolean powered = (Boolean)iblockdata.get(POWERED);
|
||||
+ boolean powered = iblockdata.get(POWERED);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = (powered) ? 15 : 0;
|
||||
+ int current = (!powered) ? 15 : 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockMinecartDetector.java 2014-11-28 17:43:42.917707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMinecartDetector.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockMinecartDetector.java 2015-02-26 22:40:22.171608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMinecartDetector.java 2015-02-26 22:40:22.175608144 +0000
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@ -8,12 +8,11 @@
|
||||
+
|
||||
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", EnumTrackPosition.class, (Predicate) (new BlockMinecartDetectorInnerClass1()));
|
||||
@@ -55,6 +57,17 @@
|
||||
if (!list.isEmpty()) {
|
||||
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
|
||||
@@ -64,6 +66,17 @@
|
||||
flag1 = true;
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (flag != flag1) {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@ -24,6 +23,7 @@
|
||||
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (flag1 && !flag) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockMinecartDetector.POWERED, Boolean.valueOf(true)), 3);
|
||||
world.applyPhysics(blockposition, this);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockMobSpawner.java 2014-11-28 17:43:42.921707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMobSpawner.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockMobSpawner.java 2015-02-26 22:40:22.175608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMobSpawner.java 2015-02-26 22:40:22.175608144 +0000
|
||||
@@ -22,9 +22,19 @@
|
||||
|
||||
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockMonsterEggs.java 2014-11-28 17:43:42.921707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMonsterEggs.java 2014-11-28 17:38:20.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockMonsterEggs.java 2015-02-26 22:40:22.179608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMonsterEggs.java 2015-02-26 22:40:22.179608144 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockMonsterEggs extends Block {
|
||||
|
||||
public static final BlockStateEnum VARIANT = BlockStateEnum.of("variant", EnumMonsterEggVarient.class);
|
||||
public static final BlockStateEnum<BlockMonsterEggs.EnumMonsterEggVarient> VARIANT = BlockStateEnum.of("variant", BlockMonsterEggs.EnumMonsterEggVarient.class);
|
||||
@@ -50,7 +52,7 @@
|
||||
EntitySilverfish entitysilverfish = new EntitySilverfish(world);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockMushroom.java 2014-11-28 17:43:42.925707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMushroom.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockMushroom.java 2015-02-26 22:40:22.183608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMushroom.java 2015-02-26 22:40:22.183608144 +0000
|
||||
@@ -3,6 +3,12 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -21,13 +21,11 @@
|
||||
if (random.nextInt(25) == 0) {
|
||||
int i = 5;
|
||||
boolean flag = true;
|
||||
@@ -39,8 +46,20 @@
|
||||
blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1);
|
||||
@@ -40,7 +47,19 @@
|
||||
}
|
||||
|
||||
- if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
|
||||
if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
|
||||
- world.setTypeAndData(blockposition2, this.getBlockData(), 2);
|
||||
+ if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData(), 2);
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
@ -49,9 +47,9 @@
|
||||
|
||||
if (this == Blocks.BROWN_MUSHROOM) {
|
||||
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(0);
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
|
||||
} else if (this == Blocks.RED_MUSHROOM) {
|
||||
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(1);
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.RED_MUSHROOM_BLOCK);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockMycel.java 2014-11-28 17:43:42.925707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMycel.java 2014-11-28 17:38:20.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockMycel.java 2015-02-26 22:40:22.187608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockMycel.java 2015-02-26 22:40:22.187608144 +0000
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -16,9 +16,9 @@
|
||||
public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy");
|
||||
@@ -22,7 +29,19 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().n() > 2) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT));
|
||||
if (!world.isClientSide) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.DIRT));
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT));
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
@ -38,7 +38,7 @@
|
||||
@@ -31,7 +50,19 @@
|
||||
Block block = world.getType(blockposition1.up()).getBlock();
|
||||
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.n() <= 2) {
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) {
|
||||
- world.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockNetherWart.java 2014-11-28 17:43:42.929707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockNetherWart.java 2014-11-28 17:38:18.000000000 +0000
|
||||
@@ -28,7 +28,8 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockNetherWart.java 2015-02-26 22:40:22.191608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockNetherWart.java 2015-02-26 22:40:22.191608144 +0000
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
if (i < 3 && random.nextInt(10) == 0) {
|
||||
iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1));
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockOre.java 2014-11-28 17:43:42.929707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockOre.java 2014-11-28 17:38:23.000000000 +0000
|
||||
@@ -33,6 +33,7 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockOre.java 2015-02-26 22:40:22.191608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockOre.java 2015-02-26 22:40:22.195608144 +0000
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
super.dropNaturally(world, blockposition, iblockdata, f, i);
|
||||
@ -8,13 +8,14 @@
|
||||
if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) {
|
||||
int j = 0;
|
||||
|
||||
@@ -50,7 +51,31 @@
|
||||
@@ -54,9 +55,34 @@
|
||||
|
||||
this.dropExperience(world, blockposition, j);
|
||||
}
|
||||
+ // */
|
||||
+ }
|
||||
+
|
||||
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public int getExpDrop(World world, IBlockData iblockdata, int i) {
|
||||
+ if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) {
|
||||
@ -34,9 +35,11 @@
|
||||
+
|
||||
+ return j;
|
||||
+ }
|
||||
|
||||
+
|
||||
+ return 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
public int getDropData(World world, BlockPosition blockposition) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,34 +1,30 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPiston.java 2015-01-19 23:27:22.252538854 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPiston.java 2015-01-19 23:27:22.252538854 +0000
|
||||
@@ -1,6 +1,17 @@
|
||||
package net.minecraft.server;
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.195608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.199608144 +0000
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.AbstractList;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Iterator;
|
||||
import java.util.List;
|
||||
+import java.util.ListIterator;
|
||||
+
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
+import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
+
|
||||
public class BlockPiston extends Block {
|
||||
|
||||
@@ -52,10 +63,21 @@
|
||||
boolean flag = this.b(world, blockposition, enumdirection);
|
||||
|
||||
if (flag && !((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
|
||||
- if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) {
|
||||
+ if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) {
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -56,6 +68,17 @@
|
||||
world.playBlockAction(blockposition, this, 0, enumdirection.a());
|
||||
}
|
||||
} else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.M) {
|
||||
+ if (!this.N) {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
@ -41,16 +37,16 @@
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockPiston.EXTENDED, Boolean.valueOf(false)), 2);
|
||||
world.playBlockAction(blockposition, this, 1, enumdirection.a());
|
||||
}
|
||||
@@ -146,7 +168,7 @@
|
||||
@@ -146,7 +169,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.i() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
|
||||
+ if (!flag1 && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.i() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
|
||||
- if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
|
||||
+ if (!flag1 && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
|
||||
this.a(world, blockposition, enumdirection, false);
|
||||
}
|
||||
} else {
|
||||
@@ -286,10 +308,46 @@
|
||||
@@ -286,10 +309,46 @@
|
||||
if (!pistonextendschecker.a()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1,15 +1,17 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/BlockPlant.java 2015-01-31 10:09:14.372634430 +1100
|
||||
+++ src/main/java/net/minecraft/server/BlockPlant.java 2015-01-31 10:09:14.372634430 +1100
|
||||
@@ -1,6 +1,8 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000
|
||||
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class BlockPlant extends Block {
|
||||
|
||||
@@ -36,6 +38,15 @@
|
||||
@@ -40,6 +44,15 @@
|
||||
|
||||
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (!this.f(world, blockposition, iblockdata)) {
|
||||
|
@ -1,15 +1,16 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPortal.java 2014-11-28 17:43:42.933707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPortal.java 2014-11-28 17:38:18.000000000 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPortal.java 2015-02-26 22:40:22.207608144 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPortal.java 2015-02-26 22:40:22.207608144 +0000
|
||||
@@ -3,6 +3,9 @@
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import java.util.Random;
|
||||
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
|
||||
+import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockPortal extends BlockHalfTransparent {
|
||||
|
||||
public static final BlockStateEnum AXIS = BlockStateEnum.of("axis", EnumAxis.class, new EnumAxis[] { EnumAxis.X, EnumAxis.Z});
|
||||
@@ -24,7 +26,8 @@
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockStateEnum.of("axis", EnumDirection.EnumAxis.class, new EnumDirection.EnumAxis[] { EnumDirection.EnumAxis.X, EnumDirection.EnumAxis.Z});
|
||||
@@ -25,7 +28,8 @@
|
||||
}
|
||||
|
||||
if (i > 0 && !world.getType(blockposition1.up()).getBlock().isOccluding()) {
|
||||
@ -18,29 +19,29 @@
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
|
||||
if (entity != null) {
|
||||
entity.portalCooldown = entity.ar();
|
||||
@@ -66,14 +69,16 @@
|
||||
PortalCreator portalcreator = new PortalCreator(world, blockposition, EnumAxis.X);
|
||||
entity.portalCooldown = entity.aq();
|
||||
@@ -67,14 +71,16 @@
|
||||
BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X);
|
||||
|
||||
if (portalcreator.b() && PortalCreator.a(portalcreator) == 0) {
|
||||
- portalcreator.c();
|
||||
if (blockportal_shape.d() && blockportal_shape.e == 0) {
|
||||
- blockportal_shape.e();
|
||||
- return true;
|
||||
+ // CraftBukkit start - return portalcreator
|
||||
+ return portalcreator.c();
|
||||
+ return blockportal_shape.e();
|
||||
+ // return true;
|
||||
} else {
|
||||
PortalCreator portalcreator1 = new PortalCreator(world, blockposition, EnumAxis.Z);
|
||||
BlockPortal.Shape blockportal_shape1 = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.Z);
|
||||
|
||||
if (portalcreator1.b() && PortalCreator.a(portalcreator1) == 0) {
|
||||
- portalcreator1.c();
|
||||
if (blockportal_shape1.d() && blockportal_shape1.e == 0) {
|
||||
- blockportal_shape1.e();
|
||||
- return true;
|
||||
+ return portalcreator1.c();
|
||||
+ return blockportal_shape1.e();
|
||||
+ // return true;
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -104,6 +109,10 @@
|
||||
@@ -105,6 +111,10 @@
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (entity.vehicle == null && entity.passenger == null) {
|
||||
@ -48,6 +49,96 @@
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.aq();
|
||||
entity.d(blockposition);
|
||||
}
|
||||
|
||||
@@ -185,6 +195,7 @@
|
||||
private BlockPosition f;
|
||||
private int g;
|
||||
private int h;
|
||||
+ java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>(); // CraftBukkit - add field
|
||||
|
||||
public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
this.a = world;
|
||||
@@ -243,6 +254,10 @@
|
||||
}
|
||||
|
||||
protected int c() {
|
||||
+ // CraftBukkit start
|
||||
+ this.blocks.clear();
|
||||
+ org.bukkit.World bworld = this.a.getWorld();
|
||||
+ // CraftBukkit end
|
||||
int i;
|
||||
|
||||
label56:
|
||||
@@ -263,11 +278,21 @@
|
||||
block = this.a.getType(blockposition.shift(this.d)).getBlock();
|
||||
if (block != Blocks.OBSIDIAN) {
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
+ BlockPosition pos = blockposition.shift(this.d);
|
||||
+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (i == this.h - 1) {
|
||||
block = this.a.getType(blockposition.shift(this.c)).getBlock();
|
||||
if (block != Blocks.OBSIDIAN) {
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
+ BlockPosition pos = blockposition.shift(this.c);
|
||||
+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,6 +302,11 @@
|
||||
if (this.a.getType(this.f.shift(this.c, i).up(this.g)).getBlock() != Blocks.OBSIDIAN) {
|
||||
this.g = 0;
|
||||
break;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
+ BlockPosition pos = this.f.shift(this.c, i).up(this.g);
|
||||
+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +328,27 @@
|
||||
return this.f != null && this.h >= 2 && this.h <= 21 && this.g >= 3 && this.g <= 21;
|
||||
}
|
||||
|
||||
- public void e() {
|
||||
+ // CraftBukkit start - return boolean
|
||||
+ public boolean e() {
|
||||
+ org.bukkit.World bworld = this.a.getWorld();
|
||||
+
|
||||
+ // Copy below for loop
|
||||
+ for (int i = 0; i < this.h; ++i) {
|
||||
+ BlockPosition blockposition = this.f.shift(this.c, i);
|
||||
+
|
||||
+ for (int j = 0; j < this.g; ++j) {
|
||||
+ BlockPosition pos = blockposition.up(j);
|
||||
+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
|
||||
+ this.a.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
for (int i = 0; i < this.h; ++i) {
|
||||
BlockPosition blockposition = this.f.shift(this.c, i);
|
||||
|
||||
@@ -307,6 +357,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:43:42.937707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPoweredRail.java 2015-02-26 22:40:22.211608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPoweredRail.java 2015-02-26 22:40:22.211608143 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", EnumTrackPosition.class, (Predicate) (new BlockPoweredRailInnerClass1()));
|
||||
@@ -108,6 +110,13 @@
|
||||
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
|
||||
@@ -116,6 +118,13 @@
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
|
||||
|
||||
if (flag1 != flag) {
|
||||
@ -22,4 +22,4 @@
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockPoweredRail.POWERED, Boolean.valueOf(flag1)), 3);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
if (((EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {
|
||||
if (((BlockMinecartTrackAbstract.EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateAbstract.java 2014-11-28 17:43:42.937707439 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.211608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.215608143 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -9,11 +9,10 @@
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected BlockPressurePlateAbstract(Material material) {
|
||||
@@ -90,6 +92,19 @@
|
||||
int j = this.e(world, blockposition);
|
||||
@@ -99,6 +101,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Interact Pressure Plate
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
@ -26,6 +25,7 @@
|
||||
+ j = eventRedstone.getNewCurrent();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (i != j) {
|
||||
iblockdata = this.a(iblockdata, j);
|
||||
world.setTypeAndData(blockposition, iblockdata, 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateBinary.java 2014-11-28 17:43:42.941707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateBinary.java 2014-11-28 17:38:20.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateBinary.java 2015-02-26 22:40:22.215608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateBinary.java 2015-02-26 22:40:22.215608143 +0000
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -9,11 +9,10 @@
|
||||
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
||||
@@ -44,6 +46,26 @@
|
||||
|
||||
@@ -45,6 +47,26 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ if (this.e(world.getType(blockposition)) == 0) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
@ -33,6 +32,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!entity.aH()) {
|
||||
+
|
||||
if (!entity.aI()) {
|
||||
return 15;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-28 17:43:42.945707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateWeighted.java 2015-02-26 22:40:22.219608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPressurePlateWeighted.java 2015-02-26 22:40:22.219608143 +0000
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateInteger POWER = BlockStateInteger.of("power", 0, 15);
|
||||
@@ -12,7 +14,31 @@
|
||||
@@ -16,7 +18,31 @@
|
||||
}
|
||||
|
||||
protected int e(World world, BlockPosition blockposition) {
|
||||
protected int f(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b);
|
||||
+ // CraftBukkit start
|
||||
+ //int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b);
|
||||
|
@ -1,7 +1,8 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPumpkin.java 2014-11-28 17:43:42.945707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPumpkin.java 2014-11-28 17:38:16.000000000 +0000
|
||||
@@ -1,5 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||
@ -12,13 +13,13 @@
|
||||
public class BlockPumpkin extends BlockDirectional {
|
||||
|
||||
private ShapeDetector snowGolemPart;
|
||||
@@ -29,31 +35,45 @@
|
||||
@@ -40,17 +46,24 @@
|
||||
int j;
|
||||
|
||||
if ((shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) {
|
||||
if ((shapedetector_shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) {
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
|
||||
for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetectorcollection.a(0, i, 0);
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
|
||||
+ // CraftBukkit start
|
||||
@ -29,7 +30,7 @@
|
||||
}
|
||||
|
||||
EntitySnowman entitysnowman = new EntitySnowman(world);
|
||||
BlockPosition blockposition1 = shapedetectorcollection.a(0, 2, 0).d();
|
||||
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).d();
|
||||
|
||||
entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entitysnowman);
|
||||
@ -37,81 +38,43 @@
|
||||
+ if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
|
||||
+ blockList.updateList();
|
||||
|
||||
- for (j = 0; j < 120; ++j) {
|
||||
- world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
- }
|
||||
+ for (j = 0; j < 120; ++j) {
|
||||
+ world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+ }
|
||||
for (j = 0; j < 120; ++j) {
|
||||
world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
@@ -61,10 +74,16 @@
|
||||
|
||||
- for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) {
|
||||
- ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(0, j, 0);
|
||||
+ for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) {
|
||||
+ ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(0, j, 0);
|
||||
|
||||
- world.update(shapedetectorblock1.d(), Blocks.AIR);
|
||||
+ world.update(shapedetectorblock1.d(), Blocks.AIR);
|
||||
+ }
|
||||
world.update(shapedetectorblock1.d(), Blocks.AIR);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
} else if ((shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition)) != null) {
|
||||
+ } // CraftBukkit end
|
||||
} else if ((shapedetector_shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition)) != null) {
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
|
||||
for (i = 0; i < this.getDetectorIronGolem().c(); ++i) {
|
||||
for (int k = 0; k < this.getDetectorIronGolem().b(); ++k) {
|
||||
- world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
|
||||
- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
|
||||
+ BlockPosition pos = shapedetectorcollection.a(i, k, 0).d();
|
||||
+ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).d();
|
||||
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,22 +82,38 @@
|
||||
@@ -73,7 +92,10 @@
|
||||
|
||||
entityirongolem.setPlayerCreated(true);
|
||||
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entityirongolem);
|
||||
-
|
||||
- for (j = 0; j < 120; ++j) {
|
||||
- world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
- }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
|
||||
+ blockList.updateList();
|
||||
+
|
||||
+ for (j = 0; j < 120; ++j) {
|
||||
+ world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+ }
|
||||
|
||||
- for (j = 0; j < this.getDetectorIronGolem().c(); ++j) {
|
||||
- for (int l = 0; l < this.getDetectorIronGolem().b(); ++l) {
|
||||
- ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(j, l, 0);
|
||||
+ for (j = 0; j < this.getDetectorIronGolem().c(); ++j) {
|
||||
+ for (int l = 0; l < this.getDetectorIronGolem().b(); ++l) {
|
||||
+ ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(j, l, 0);
|
||||
|
||||
- world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
+ world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
+ }
|
||||
for (j = 0; j < 120; ++j) {
|
||||
world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
@@ -86,6 +108,7 @@
|
||||
world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+ } // CraftBukkit end
|
||||
}
|
||||
+ }
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public void doPhysics(World world, BlockPosition position, IBlockData data, Block block) {
|
||||
+ if (block != null && block.isPowerSource()) {
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public boolean canPlace(World world, BlockPosition blockposition) {
|
||||
return world.getType(blockposition).getBlock().material.isReplaceable() && World.a((IBlockAccess) world, blockposition.down());
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 17:43:42.945707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 17:38:20.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneLamp.java 2015-02-26 22:40:22.227608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneLamp.java 2015-02-26 22:40:22.227608143 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -35,13 +35,13 @@
|
||||
|
||||
@@ -40,6 +52,11 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (!world.isClientSide) {
|
||||
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneOre.java 2014-11-28 17:43:42.949707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneOre.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneOre.java 2015-02-26 22:40:22.231608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneOre.java 2015-02-26 22:40:22.231608143 +0000
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -16,29 +16,28 @@
|
||||
}
|
||||
|
||||
public void attack(World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
- this.d(world, blockposition);
|
||||
+ this.d(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
- this.e(world, blockposition);
|
||||
+ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
super.attack(world, blockposition, entityhuman);
|
||||
}
|
||||
|
||||
- public void a(World world, BlockPosition blockposition, Entity entity) {
|
||||
- this.d(world, blockposition);
|
||||
public void a(World world, BlockPosition blockposition, Entity entity) {
|
||||
- this.e(world, blockposition);
|
||||
- super.a(world, blockposition, entity);
|
||||
+ public void a(World world, BlockPosition blockposition, Entity entity) {
|
||||
+ // CraftBukkit start
|
||||
+ // this.d(world, blockposition);
|
||||
+ // this.e(world, blockposition);
|
||||
+ // super.a(world, blockposition, entity);
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.d(world, blockposition, entity); // add entity
|
||||
+ this.e(world, blockposition, entity); // add entity
|
||||
+ super.a(world, blockposition, entity);
|
||||
+ }
|
||||
+ } else {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.d(world, blockposition, entity); // add entity
|
||||
+ this.e(world, blockposition, entity); // add entity
|
||||
+ super.a(world, blockposition, entity);
|
||||
+ }
|
||||
+ }
|
||||
@ -46,14 +45,14 @@
|
||||
}
|
||||
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
- this.d(world, blockposition);
|
||||
+ this.d(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
- this.e(world, blockposition);
|
||||
+ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2);
|
||||
}
|
||||
|
||||
- private void d(World world, BlockPosition blockposition) {
|
||||
+ private void d(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity
|
||||
this.e(world, blockposition);
|
||||
- private void e(World world, BlockPosition blockposition) {
|
||||
+ private void e(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity
|
||||
this.f(world, blockposition);
|
||||
if (this == Blocks.REDSTONE_ORE) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.LIT_REDSTONE_ORE, 0).isCancelled()) {
|
||||
@ -99,4 +98,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private void e(World world, BlockPosition blockposition) {
|
||||
private void f(World world, BlockPosition blockposition) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneTorch.java 2014-11-28 17:43:42.949707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.231608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.235608143 +0000
|
||||
@@ -6,6 +6,8 @@
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@ -8,12 +8,20 @@
|
||||
+
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
private static Map b = Maps.newHashMap();
|
||||
@@ -95,9 +97,26 @@
|
||||
while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
||||
private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = Maps.newHashMap();
|
||||
@@ -13,7 +15,7 @@
|
||||
|
||||
private boolean a(World world, BlockPosition blockposition, boolean flag) {
|
||||
if (!BlockRedstoneTorch.b.containsKey(world)) {
|
||||
- BlockRedstoneTorch.b.put(world, Lists.newArrayList());
|
||||
+ BlockRedstoneTorch.b.put(world, Lists.<BlockRedstoneTorch.RedstoneUpdateInfo>newArrayList()); // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
List list = (List) BlockRedstoneTorch.b.get(world);
|
||||
@@ -96,8 +98,25 @@
|
||||
list.remove(0);
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@ -21,7 +29,7 @@
|
||||
+
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (this.isOn) {
|
||||
if (flag) {
|
||||
+ // CraftBukkit start
|
||||
@ -36,7 +44,7 @@
|
||||
world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
|
||||
if (this.a(world, blockposition, true)) {
|
||||
world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
@@ -114,6 +133,16 @@
|
||||
@@ -114,6 +133,15 @@
|
||||
}
|
||||
}
|
||||
} else if (!flag && !this.a(world, blockposition, false)) {
|
||||
@ -49,7 +57,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
world.setTypeAndData(blockposition, Blocks.REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneWire.java 2014-11-28 17:43:42.953707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneWire.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000
|
||||
@@ -8,6 +8,8 @@
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@ -8,12 +8,11 @@
|
||||
+
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
public static final BlockStateEnum NORTH = BlockStateEnum.of("north", EnumRedstoneWireConnection.class);
|
||||
@@ -123,6 +125,15 @@
|
||||
if (k > j - 1) {
|
||||
public static final BlockStateEnum<BlockRedstoneWire.EnumRedstoneWireConnection> NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class);
|
||||
@@ -124,6 +126,15 @@
|
||||
j = k;
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (i != j) {
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
|
||||
@ -22,6 +21,16 @@
|
||||
+ j = event.getNewCurrent();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (i != j) {
|
||||
iblockdata = iblockdata.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
|
||||
if (world.getType(blockposition) == iblockdata1) {
|
||||
@@ -232,7 +243,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private int getPower(World world, BlockPosition blockposition, int i) {
|
||||
+ public int getPower(World world, BlockPosition blockposition, int i) { // CraftBukkit - public
|
||||
if (world.getType(blockposition).getBlock() != this) {
|
||||
return i;
|
||||
} else {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/BlockReed.java 2014-12-11 00:44:17.804251801 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockReed.java 2014-12-11 00:43:36.504252249 +0000
|
||||
@@ -29,8 +29,13 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockReed.java 2015-02-26 22:40:22.243608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockReed.java 2015-02-26 22:40:22.243608143 +0000
|
||||
@@ -29,8 +29,12 @@
|
||||
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
|
||||
|
||||
if (j == 15) {
|
||||
@ -11,7 +11,6 @@
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, upPos.getX(), upPos.getY(), upPos.getZ(), this, 0);
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(0)), 4);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
} else {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(j + 1)), 4);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockSapling.java 2014-11-28 17:43:42.957707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSapling.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockSapling.java 2015-02-26 22:40:22.243608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSapling.java 2015-02-26 22:40:22.247608143 +0000
|
||||
@@ -2,10 +2,20 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -15,14 +15,14 @@
|
||||
+
|
||||
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateEnum TYPE = BlockStateEnum.of("type", EnumLogVariant.class);
|
||||
public static final BlockStateEnum<BlockWood.EnumLogVariant> TYPE = BlockStateEnum.of("type", BlockWood.EnumLogVariant.class);
|
||||
public static final BlockStateInteger STAGE = BlockStateInteger.of("stage", 0, 1);
|
||||
+ public static TreeType treeType; // CraftBukkit
|
||||
|
||||
protected BlockSapling() {
|
||||
this.j(this.blockStateList.getBlockData().set(BlockSapling.TYPE, EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0)));
|
||||
@@ -19,7 +29,30 @@
|
||||
if (!world.isStatic) {
|
||||
this.j(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0)));
|
||||
@@ -23,7 +33,30 @@
|
||||
if (!world.isClientSide) {
|
||||
super.b(world, blockposition, iblockdata, random);
|
||||
if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
+ // CraftBukkit start
|
||||
@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +68,17 @@
|
||||
@@ -39,7 +72,17 @@
|
||||
}
|
||||
|
||||
public void e(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
@ -71,15 +71,15 @@
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
boolean flag = false;
|
||||
@@ -46,6 +89,7 @@
|
||||
@@ -51,6 +94,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.SPRUCE)) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.SPRUCE)) {
|
||||
+ treeType = TreeType.MEGA_REDWOOD; // CraftBukkit
|
||||
object = new WorldGenMegaTree(false, random.nextBoolean());
|
||||
flag = true;
|
||||
break label78;
|
||||
@@ -56,11 +100,13 @@
|
||||
break label66;
|
||||
@@ -61,11 +105,13 @@
|
||||
if (!flag) {
|
||||
j = 0;
|
||||
i = 0;
|
||||
@ -93,33 +93,33 @@
|
||||
object = new WorldGenForest(true, false);
|
||||
break;
|
||||
|
||||
@@ -69,6 +115,7 @@
|
||||
@@ -77,6 +123,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.JUNGLE)) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.JUNGLE)) {
|
||||
+ treeType = TreeType.JUNGLE; // CraftBukkit
|
||||
object = new WorldGenJungleTree(true, 10, 20, EnumLogVariant.JUNGLE.a(), EnumLogVariant.JUNGLE.a());
|
||||
object = new WorldGenJungleTree(true, 10, 20, iblockdata1, iblockdata2);
|
||||
flag = true;
|
||||
break label93;
|
||||
@@ -79,11 +126,13 @@
|
||||
break label78;
|
||||
@@ -87,11 +134,13 @@
|
||||
if (!flag) {
|
||||
j = 0;
|
||||
i = 0;
|
||||
+ treeType = TreeType.SMALL_JUNGLE; // CraftBukkit
|
||||
object = new WorldGenTrees(true, 4 + random.nextInt(7), EnumLogVariant.JUNGLE.a(), EnumLogVariant.JUNGLE.a(), false);
|
||||
object = new WorldGenTrees(true, 4 + random.nextInt(7), iblockdata1, iblockdata2, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
+ treeType = TreeType.ACACIA; // CraftBukki
|
||||
+ treeType = TreeType.ACACIA; // CraftBukkit
|
||||
object = new WorldGenAcaciaTree(true);
|
||||
break;
|
||||
|
||||
@@ -92,6 +141,7 @@
|
||||
@@ -100,6 +149,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.DARK_OAK)) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.DARK_OAK)) {
|
||||
+ treeType = TreeType.DARK_OAK; // CraftBukkit
|
||||
object = new WorldGenForestTree(true);
|
||||
flag = true;
|
||||
break label108;
|
||||
break label90;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockSkull.java 2015-02-02 21:55:13.808077826 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSkull.java 2015-02-02 21:55:13.808077826 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockSkull.java 2015-02-27 00:00:38.507555865 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSkull.java 2015-02-27 00:00:38.507555865 +0000
|
||||
@@ -4,6 +4,11 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -12,12 +12,13 @@
|
||||
public class BlockSkull extends BlockContainer {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -69,8 +74,25 @@
|
||||
@@ -81,8 +86,26 @@
|
||||
|
||||
return tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).getSkullType() : super.getDropData(world, blockposition);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Special case dropping so we can get info from the tile entity
|
||||
+ @Override
|
||||
+ public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
+ if (world.random.nextFloat() < f) {
|
||||
+ ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition));
|
||||
@ -39,10 +40,10 @@
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
if (entityhuman.abilities.canInstantlyBuild) {
|
||||
@@ -83,7 +105,10 @@
|
||||
@@ -95,7 +118,10 @@
|
||||
|
||||
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (!world.isStatic) {
|
||||
if (!world.isClientSide) {
|
||||
- if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) {
|
||||
+ // CraftBukkit start - Drop item in code above, not here
|
||||
+ // if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) {
|
||||
@ -51,22 +52,22 @@
|
||||
TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntitySkull) {
|
||||
@@ -115,24 +140,36 @@
|
||||
@@ -127,24 +153,36 @@
|
||||
}
|
||||
|
||||
public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
+ if (world.captureBlockStates) return; // CraftBukkit
|
||||
if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL && !world.isStatic) {
|
||||
ShapeDetector shapedetector = this.l();
|
||||
ShapeDetectorCollection shapedetectorcollection = shapedetector.a(world, blockposition);
|
||||
if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL && !world.isClientSide) {
|
||||
ShapeDetector shapedetector = this.n();
|
||||
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
|
||||
|
||||
if (shapedetectorcollection != null) {
|
||||
if (shapedetector_shapedetectorcollection != null) {
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetectorcollection.a(i, 0, 0);
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(i, 0, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock.d(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2);
|
||||
+ // CraftBukkit start
|
||||
@ -79,7 +80,7 @@
|
||||
|
||||
for (i = 0; i < shapedetector.c(); ++i) {
|
||||
for (int j = 0; j < shapedetector.b(); ++j) {
|
||||
ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(i, j, 0);
|
||||
ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(i, j, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock1.d(), Blocks.AIR.getBlockData(), 2);
|
||||
+ // CraftBukkit start
|
||||
@ -90,50 +91,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,28 +182,31 @@
|
||||
@@ -157,14 +195,16 @@
|
||||
entitywither.n();
|
||||
Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().grow(50.0D, 50.0D, 50.0D)).iterator();
|
||||
|
||||
- while (iterator.hasNext()) {
|
||||
- EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
+ // CraftBukkit start
|
||||
+ if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
+ while (iterator.hasNext()) {
|
||||
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
- entityhuman.b((Statistic) AchievementList.I);
|
||||
- }
|
||||
-
|
||||
- world.addEntity(entitywither);
|
||||
+ entityhuman.b((Statistic) AchievementList.I);
|
||||
+ }
|
||||
+
|
||||
+ blockList.updateList();
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
- int k;
|
||||
+ int k;
|
||||
entityhuman.b((Statistic) AchievementList.I);
|
||||
}
|
||||
|
||||
- for (k = 0; k < 120; ++k) {
|
||||
- world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
- }
|
||||
+ for (k = 0; k < 120; ++k) {
|
||||
+ world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+ }
|
||||
- world.addEntity(entitywither);
|
||||
-
|
||||
int k;
|
||||
|
||||
- for (k = 0; k < shapedetector.c(); ++k) {
|
||||
- for (int l = 0; l < shapedetector.b(); ++l) {
|
||||
- ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(k, l, 0);
|
||||
+ for (k = 0; k < shapedetector.c(); ++k) {
|
||||
+ for (int l = 0; l < shapedetector.b(); ++l) {
|
||||
+ ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(k, l, 0);
|
||||
|
||||
- world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
+ world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
+ }
|
||||
for (k = 0; k < 120; ++k) {
|
||||
@@ -178,6 +218,7 @@
|
||||
world.update(shapedetectorblock2.d(), Blocks.AIR);
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // CraftBukkit end
|
||||
+ } // CraftBukkit end
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockSnow.java 2014-11-28 17:43:42.961707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSnow.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockSnow.java 2015-02-26 22:40:22.251608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSnow.java 2015-02-26 22:40:22.255608143 +0000
|
||||
@@ -85,6 +85,11 @@
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/BlockSoil.java 2015-01-31 10:14:10.936280376 +1100
|
||||
+++ src/main/java/net/minecraft/server/BlockSoil.java 2015-01-31 10:14:10.936280376 +1100
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockSoil.java 2015-02-26 22:40:22.263608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockSoil.java 2015-02-26 22:40:22.263608143 +0000
|
||||
@@ -3,6 +3,11 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -15,7 +15,7 @@
|
||||
@@ -34,6 +39,12 @@
|
||||
if (i > 0) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2);
|
||||
} else if (!this.d(world, blockposition)) {
|
||||
} else if (!this.e(world, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) {
|
||||
@ -31,7 +31,7 @@
|
||||
public void a(World world, BlockPosition blockposition, Entity entity, float f) {
|
||||
+ super.a(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (entity instanceof EntityLiving) {
|
||||
if (!world.isStatic && world.random.nextFloat() < f - 0.5F) {
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F) {
|
||||
if (!(entity instanceof EntityHuman) && !world.getGameRules().getBoolean("mobGriefing")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockStationary.java 2014-11-28 17:43:42.965707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockStationary.java 2014-11-28 17:38:19.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockStationary.java 2015-02-26 22:40:22.267608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockStationary.java 2015-02-26 22:40:22.267608143 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
@ -12,7 +12,7 @@
|
||||
@@ -41,6 +43,13 @@
|
||||
|
||||
if (block.material == Material.AIR) {
|
||||
if (this.e(world, blockposition1)) {
|
||||
if (this.f(world, blockposition1)) {
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire
|
||||
+ if (world.getType(blockposition1) != Blocks.FIRE) {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), blockposition.getX(), blockposition.getY(), blockposition.getZ()).isCancelled()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockStem.java 2014-11-28 17:43:42.969707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockStem.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockStem.java 2015-02-26 22:40:22.271608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockStem.java 2015-02-26 22:40:22.271608143 +0000
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -9,7 +9,7 @@
|
||||
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
|
||||
@@ -50,7 +52,8 @@
|
||||
@@ -58,7 +60,8 @@
|
||||
|
||||
if (i < 7) {
|
||||
iblockdata = iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
|
||||
@ -17,9 +17,9 @@
|
||||
+ // world.setTypeAndData(blockposition, iblockdata, 2); // CraftBukkit
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(iblockdata)); // CraftBukkit
|
||||
} else {
|
||||
Iterator iterator = EnumDirectionLimit.HORIZONTAL.iterator();
|
||||
Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
|
||||
|
||||
@@ -66,7 +69,8 @@
|
||||
@@ -74,7 +77,8 @@
|
||||
Block block = world.getType(blockposition.down()).getBlock();
|
||||
|
||||
if (world.getType(blockposition).getBlock().material == Material.AIR && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.GRASS)) {
|
||||
@ -29,7 +29,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +81,8 @@
|
||||
@@ -85,7 +89,8 @@
|
||||
public void g(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5);
|
||||
|
||||
@ -38,4 +38,4 @@
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, Math.min(7, i)); // CraftBukkit
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void j() {
|
||||
|
@ -1,25 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockTallPlant.java 2015-02-07 10:08:04.520216186 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTallPlant.java 2015-02-07 10:08:04.520216186 +0000
|
||||
@@ -55,16 +55,20 @@
|
||||
Object object1 = flag ? world.getType(blockposition2).getBlock() : this;
|
||||
|
||||
if (object == this) {
|
||||
- world.setTypeAndData(blockposition1, Blocks.AIR.getBlockData(), 3);
|
||||
+ world.setTypeAndData(blockposition1, Blocks.AIR.getBlockData(), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
if (object1 == this) {
|
||||
- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
|
||||
+ world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 2); // CraftBukkit
|
||||
if (!flag) {
|
||||
this.b(world, blockposition2, iblockdata, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - delay updates
|
||||
+ world.update(blockposition1, this);
|
||||
+ world.update(blockposition2, this);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockTrapdoor.java 2014-11-28 17:43:42.969707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTrapdoor.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockTrapdoor.java 2015-02-26 22:40:22.275608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTrapdoor.java 2015-02-26 22:40:22.275608143 +0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockTrapdoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL);
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -101,6 +103,19 @@
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockTripwire.java 2014-11-28 17:43:42.977707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTripwire.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.279608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.283608143 +0000
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@ -9,11 +9,10 @@
|
||||
public class BlockTripwire extends Block {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
||||
@@ -154,6 +156,40 @@
|
||||
}
|
||||
@@ -155,6 +157,40 @@
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Call interact even when triggering connected tripwire
|
||||
+ if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
@ -47,6 +46,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (flag1 != flag) {
|
||||
iblockdata = iblockdata.set(BlockTripwire.POWERED, Boolean.valueOf(flag1));
|
||||
world.setTypeAndData(blockposition, iblockdata, 3);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockTripwireHook.java 2014-11-28 17:43:42.973707438 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTripwireHook.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockTripwireHook.java 2015-02-26 22:40:22.275608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockTripwireHook.java 2015-02-26 22:40:22.279608143 +0000
|
||||
@@ -5,6 +5,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockTripwireHook extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL);
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -141,6 +143,17 @@
|
||||
this.a(world, blockposition1, flag5, flag6, flag2, flag3);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockVine.java 2015-01-06 23:53:23.903653254 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockVine.java 2015-01-06 23:53:23.903653254 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/BlockVine.java 2015-02-26 22:40:22.283608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/BlockVine.java 2015-02-26 22:40:22.287608143 +0000
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
@ -9,7 +9,7 @@
|
||||
public class BlockVine extends Block {
|
||||
|
||||
public static final BlockStateBoolean UP = BlockStateBoolean.of("up");
|
||||
@@ -203,7 +205,13 @@
|
||||
@@ -199,7 +201,13 @@
|
||||
}
|
||||
|
||||
if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) {
|
||||
@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -223,17 +231,29 @@
|
||||
@@ -219,17 +227,29 @@
|
||||
BlockPosition blockposition2 = blockposition1.shift(enumdirection1);
|
||||
BlockPosition blockposition3 = blockposition1.shift(enumdirection2);
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
} else if (block.material.k() && block.d()) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(a(enumdirection), Boolean.valueOf(true)), 2);
|
||||
}
|
||||
@@ -260,7 +280,12 @@
|
||||
@@ -256,7 +276,12 @@
|
||||
}
|
||||
|
||||
if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ChatBaseComponent.java 2015-01-11 18:45:55.785438005 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChatBaseComponent.java 2015-01-11 18:45:55.785438005 +0000
|
||||
@@ -91,7 +91,7 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ChatBaseComponent.java 2015-02-26 22:40:22.295608143 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChatBaseComponent.java 2015-02-26 22:40:22.299608143 +0000
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ChatModifier.java 2014-12-27 19:28:58.855157429 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChatModifier.java 2014-12-27 19:28:58.855157429 +0000
|
||||
@@ -160,16 +160,18 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ChatModifier.java 2015-02-26 22:40:22.303608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChatModifier.java 2015-02-26 22:40:22.307608142 +0000
|
||||
@@ -254,16 +254,18 @@
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@ -28,3 +28,17 @@
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -429,11 +431,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
|
||||
+ public JsonElement serialize(ChatModifier object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - fix decompile error
|
||||
return this.a((ChatModifier) object, type, jsonserializationcontext);
|
||||
}
|
||||
|
||||
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
||||
+ public ChatModifier deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - fix decompile error
|
||||
return this.a(jsonelement, type, jsondeserializationcontext);
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,36 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000
|
||||
+++ src/main/java/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
+import com.google.common.collect.Lists; // CraftBukkit
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Queues;
|
||||
import java.util.Arrays;
|
||||
@@ -14,6 +15,8 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/Chunk.java 2015-02-26 22:40:22.311608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/Chunk.java 2015-02-26 22:40:22.315608142 +0000
|
||||
@@ -14,6 +14,9 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import com.google.common.collect.Lists; // CraftBukkit
|
||||
+import org.bukkit.Bukkit; // CraftBukkit
|
||||
+
|
||||
public class Chunk {
|
||||
|
||||
private static final Logger c = LogManager.getLogger();
|
||||
@@ -23,7 +26,7 @@
|
||||
@@ -22,13 +25,13 @@
|
||||
private final int[] f;
|
||||
private final boolean[] g;
|
||||
private boolean h;
|
||||
public final World world;
|
||||
- private final World world;
|
||||
- private final int[] heightMap;
|
||||
+ public final int[] heightMap; // CraftBukkit - make public
|
||||
+ public final World world; // CraftBukkit - public
|
||||
+ public final int[] heightMap; // CraftBukkit - public
|
||||
public final int locX;
|
||||
public final int locZ;
|
||||
private boolean k;
|
||||
- private final Map<BlockPosition, TileEntity> tileEntities;
|
||||
- private final EntitySlice<Entity>[] entitySlices;
|
||||
+ public final Map<BlockPosition, TileEntity> tileEntities;
|
||||
+ public final EntitySlice<Entity>[] entitySlices; // CraftBukkit - public
|
||||
private boolean done;
|
||||
private boolean lit;
|
||||
private boolean p;
|
||||
@@ -40,6 +43,34 @@
|
||||
private int v;
|
||||
private ConcurrentLinkedQueue w;
|
||||
private ConcurrentLinkedQueue<BlockPosition> w;
|
||||
|
||||
+ // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
|
||||
+ private int neighbors = 0x1 << 12;
|
||||
@ -79,17 +81,17 @@
|
||||
public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) {
|
||||
this(world, i, j);
|
||||
short short0 = 256;
|
||||
@@ -505,7 +545,8 @@
|
||||
@@ -529,7 +569,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.world.isStatic && block1 != block) {
|
||||
- if (!this.world.isClientSide && block1 != block) {
|
||||
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
+ if (!this.world.isStatic && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) {
|
||||
+ if (!this.world.isClientSide && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) {
|
||||
block.onPlace(this.world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -586,7 +627,11 @@
|
||||
@@ -610,7 +651,11 @@
|
||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||
|
||||
if (i != this.locX || j != this.locZ) {
|
||||
@ -102,7 +104,7 @@
|
||||
entity.die();
|
||||
}
|
||||
|
||||
@@ -673,6 +718,13 @@
|
||||
@@ -697,6 +742,13 @@
|
||||
|
||||
tileentity.D();
|
||||
this.tileEntities.put(blockposition, tileentity);
|
||||
@ -116,7 +118,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +768,21 @@
|
||||
@@ -740,7 +792,21 @@
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||
@ -139,3 +141,14 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -798,8 +864,8 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) {
|
||||
- list.add(entity);
|
||||
+ if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error
|
||||
+ list.add((T) entity); // Fix decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkProviderServer.java 2014-11-28 17:43:42.985707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2014-11-28 17:38:20.000000000 +0000
|
||||
@@ -10,17 +10,28 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ChunkProviderServer.java 2015-02-26 22:40:22.319608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2015-02-26 22:40:22.323608142 +0000
|
||||
@@ -11,17 +11,28 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -19,22 +19,24 @@
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
private static final Logger b = LogManager.getLogger();
|
||||
- public Set unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap());
|
||||
- private Set<Long> unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap());
|
||||
- private Chunk emptyChunk;
|
||||
- private IChunkProvider chunkProvider;
|
||||
+ public LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider;
|
||||
+ public Chunk emptyChunk; // CraftBukkit - public
|
||||
+ public IChunkProvider chunkProvider; // CraftBukkit - public
|
||||
private IChunkLoader chunkLoader;
|
||||
- public boolean forceChunkLoad = true;
|
||||
- public LongHashMap chunks = new LongHashMap();
|
||||
- private List chunkList = Lists.newArrayList();
|
||||
- private LongHashMap<Chunk> chunks = new LongHashMap();
|
||||
- private List<Chunk> chunkList = Lists.newArrayList();
|
||||
- private WorldServer world;
|
||||
+ public boolean forceChunkLoad = false; // CraftBukkit - true -> false
|
||||
+ public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
||||
+ public WorldServer world; // CraftBukkit- public
|
||||
+ public WorldServer world; // CraftBukkit - public
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
|
||||
@@ -30,40 +41,93 @@
|
||||
@@ -31,26 +42,43 @@
|
||||
}
|
||||
|
||||
public boolean isChunkLoaded(int i, int j) {
|
||||
@ -42,7 +44,7 @@
|
||||
+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
}
|
||||
|
||||
- public List a() {
|
||||
- public List<Chunk> a() {
|
||||
- return this.chunkList;
|
||||
+ // CraftBukkit start - Change return type to Collection and return the values of our chunk map
|
||||
+ public java.util.Collection a() {
|
||||
@ -84,22 +86,17 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
@@ -60,11 +88,48 @@
|
||||
|
||||
}
|
||||
|
||||
this.queueUnload(chunk.locX, chunk.locZ);
|
||||
}
|
||||
-
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - Add async variant, provide compatibility
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return chunks.get(LongHash.toLong(x, z));
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
- long k = ChunkCoordIntPair.a(i, j);
|
||||
-
|
||||
- this.unloadQueue.remove(Long.valueOf(k));
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(k);
|
||||
+ return getChunkAt(i, j, null);
|
||||
+ }
|
||||
+
|
||||
@ -110,7 +107,9 @@
|
||||
+
|
||||
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
|
||||
+ loader = (ChunkRegionLoader) this.chunkLoader;
|
||||
+
|
||||
|
||||
- this.unloadQueue.remove(Long.valueOf(k));
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(k);
|
||||
+ }
|
||||
+ // We can only use the queue for already generated chunks
|
||||
+ if (chunk == null && loader != null && loader.chunkExists(world, i, j)) {
|
||||
@ -139,7 +138,7 @@
|
||||
|
||||
if (chunk == null) {
|
||||
chunk = this.loadChunk(i, j);
|
||||
@@ -78,16 +142,44 @@
|
||||
@@ -79,16 +144,43 @@
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
|
||||
|
||||
crashreportsystemdetails.a("Location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
|
||||
@ -183,19 +182,17 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
chunk.loadNearby(this, this, i, j);
|
||||
}
|
||||
|
||||
@@ -95,9 +187,22 @@
|
||||
@@ -96,12 +188,25 @@
|
||||
}
|
||||
|
||||
public Chunk getOrCreateChunk(int i, int j) {
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(ChunkCoordIntPair.a(i, j));
|
||||
+ // CraftBukkit start
|
||||
+ Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
|
||||
- return chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
+
|
||||
+ chunk = chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
+
|
||||
+ if (chunk == emptyChunk) return chunk;
|
||||
@ -206,28 +203,36 @@
|
||||
+ ex.fillInStackTrace();
|
||||
+ ex.printStackTrace();
|
||||
+ }
|
||||
+
|
||||
|
||||
- return chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
+ return chunk;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public Chunk loadChunk(int i, int j) {
|
||||
@@ -138,10 +243,13 @@
|
||||
- private Chunk loadChunk(int i, int j) {
|
||||
+ public Chunk loadChunk(int i, int j) { // CraftBukkit - public
|
||||
if (this.chunkLoader == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -123,7 +228,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void saveChunkNOP(Chunk chunk) {
|
||||
+ public void saveChunkNOP(Chunk chunk) { // CraftBukkit - public
|
||||
if (this.chunkLoader != null) {
|
||||
try {
|
||||
this.chunkLoader.b(this.world, chunk);
|
||||
@@ -134,7 +239,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void saveChunk(Chunk chunk) {
|
||||
+ public void saveChunk(Chunk chunk) { // CraftBukkit - public
|
||||
if (this.chunkLoader != null) {
|
||||
try {
|
||||
chunk.setLastSaved(this.world.getTime());
|
||||
this.chunkLoader.a(this.world, chunk);
|
||||
- } catch (IOException ioexception) {
|
||||
+ // CraftBukkit start - IOException to Exception
|
||||
+ } catch (Exception ioexception) {
|
||||
ChunkProviderServer.b.error("Couldn\'t save chunk", ioexception);
|
||||
+ /* Remove extra exception
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
ChunkProviderServer.b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
|
||||
+ // CraftBukkit end */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -154,6 +262,30 @@
|
||||
@@ -155,6 +260,30 @@
|
||||
chunk.n();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||
@ -258,14 +263,14 @@
|
||||
chunk.e();
|
||||
}
|
||||
}
|
||||
@@ -173,9 +305,12 @@
|
||||
@@ -174,10 +303,12 @@
|
||||
|
||||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
int i = 0;
|
||||
-
|
||||
- for (int j = 0; j < this.chunkList.size(); ++j) {
|
||||
- Chunk chunk = (Chunk) this.chunkList.get(j);
|
||||
+
|
||||
- ArrayList arraylist = Lists.newArrayList(this.chunkList);
|
||||
|
||||
- for (int j = 0; j < arraylist.size(); ++j) {
|
||||
- Chunk chunk = (Chunk) arraylist.get(j);
|
||||
+ // CraftBukkit start
|
||||
+ Iterator iterator = this.chunks.values().iterator();
|
||||
+ while (iterator.hasNext()) {
|
||||
@ -274,7 +279,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.saveChunkNOP(chunk);
|
||||
@@ -203,22 +338,42 @@
|
||||
@@ -205,22 +336,43 @@
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.savingDisabled) {
|
||||
@ -282,7 +287,6 @@
|
||||
- if (!this.unloadQueue.isEmpty()) {
|
||||
- Long olong = (Long) this.unloadQueue.iterator().next();
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(olong.longValue());
|
||||
-
|
||||
+ // CraftBukkit start
|
||||
+ Server server = this.world.getServer();
|
||||
+ for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); ++i) {
|
||||
@ -293,6 +297,7 @@
|
||||
+ ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.removeEntities();
|
||||
this.saveChunk(chunk);
|
||||
@ -320,13 +325,12 @@
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.chunkLoader != null) {
|
||||
this.chunkLoader.a();
|
||||
@@ -233,7 +388,8 @@
|
||||
@@ -235,7 +387,8 @@
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -335,8 +339,8 @@
|
||||
+ return "ServerChunkCache: " + this.chunks.size() + " Drop: " + this.unloadQueue.size();
|
||||
}
|
||||
|
||||
public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
@@ -245,7 +401,8 @@
|
||||
public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
@@ -247,7 +400,8 @@
|
||||
}
|
||||
|
||||
public int getLoadedChunks() {
|
||||
|
@ -1,10 +1,9 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:25:09.296846856 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:24:59.400847076 +0000
|
||||
@@ -23,8 +23,40 @@
|
||||
public ChunkRegionLoader(File file) {
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.327608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.331608142 +0000
|
||||
@@ -25,7 +25,39 @@
|
||||
this.e = file;
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean chunkExists(World world, int i, int j) {
|
||||
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
@ -18,13 +17,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+
|
||||
+ return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start - Add async variant, provide compatibility
|
||||
public Chunk a(World world, int i, int j) {
|
||||
public Chunk a(World world, int i, int j) throws IOException {
|
||||
+ Object[] data = loadChunk(world, i, j);
|
||||
+ if (data != null) {
|
||||
+ Chunk chunk = (Chunk) data[0];
|
||||
@ -36,12 +35,12 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public Object[] loadChunk(World world, int i, int j) {
|
||||
+ public Object[] loadChunk(World world, int i, int j) throws IOException {
|
||||
+ // CraftBukkit end
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
Object object = this.d;
|
||||
@@ -53,7 +85,7 @@
|
||||
@@ -54,7 +86,7 @@
|
||||
return this.a(world, i, j, nbttagcompound);
|
||||
}
|
||||
|
||||
@ -50,70 +49,41 @@
|
||||
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
|
||||
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is missing level data, skipping");
|
||||
return null;
|
||||
@@ -64,18 +96,42 @@
|
||||
Chunk chunk = this.a(world, nbttagcompound.getCompound("Level"));
|
||||
|
||||
if (!chunk.a(i, j)) {
|
||||
- ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
|
||||
- nbttagcompound.setInt("xPos", i);
|
||||
- nbttagcompound.setInt("zPos", j);
|
||||
+ a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
|
||||
+ nbttagcompound.getCompound("Level").setInt("xPos", i);
|
||||
+ nbttagcompound.getCompound("Level").setInt("zPos", j);
|
||||
@@ -71,10 +103,28 @@
|
||||
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
|
||||
nbttagcompound1.setInt("xPos", i);
|
||||
nbttagcompound1.setInt("zPos", j);
|
||||
+
|
||||
+ // CraftBukkit start - Have to move tile entities since we don't load them at this stage
|
||||
+ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10);
|
||||
+ if (tileEntities != null) {
|
||||
+ for (int te = 0; te < tileEntities.size(); te++) {
|
||||
+ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te);
|
||||
+ int x = tileEntity.getInt("x") - chunk.locX * 16;
|
||||
+ int z = tileEntity.getInt("z") - chunk.locZ * 16;
|
||||
+ tileEntity.setInt("x", i * 16 + x);
|
||||
+ tileEntity.setInt("z", j * 16 + z);
|
||||
+ // CraftBukkit start - Have to move tile entities since we don't load them at this stage
|
||||
+ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10);
|
||||
+ if (tileEntities != null) {
|
||||
+ for (int te = 0; te < tileEntities.size(); te++) {
|
||||
+ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te);
|
||||
+ int x = tileEntity.getInt("x") - chunk.locX * 16;
|
||||
+ int z = tileEntity.getInt("z") - chunk.locZ * 16;
|
||||
+ tileEntity.setInt("x", i * 16 + x);
|
||||
+ tileEntity.setInt("z", j * 16 + z);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
chunk = this.a(world, nbttagcompound.getCompound("Level"));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
chunk = this.a(world, nbttagcompound1);
|
||||
}
|
||||
|
||||
- return chunk;
|
||||
+ // CraftBukkit start
|
||||
+ Object[] data = new Object[2];
|
||||
+ data[0] = chunk;
|
||||
+ data[1] = nbttagcompound;
|
||||
+ return data;
|
||||
+ // CraftBukkit end
|
||||
- return chunk;
|
||||
+ // CraftBukkit start
|
||||
+ Object[] data = new Object[2];
|
||||
+ data[0] = chunk;
|
||||
+ data[1] = nbttagcompound;
|
||||
+ return data;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, Chunk chunk) {
|
||||
- world.checkSession();
|
||||
+ // CraftBukkit start - "handle" exception
|
||||
+ try {
|
||||
+ world.checkSession();
|
||||
+ } catch (ExceptionWorldConflict ex) {
|
||||
+ ex.printStackTrace();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
try {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -133,7 +189,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
- public void a(PendingChunkToSave pendingchunktosave) {
|
||||
+ public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - added throws
|
||||
DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z);
|
||||
|
||||
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
|
||||
@@ -302,8 +358,27 @@
|
||||
int j1 = l >> 8 & 15;
|
||||
@@ -308,7 +358,26 @@
|
||||
int k1 = l >> 4 & 15;
|
||||
int l1 = nibblearray1 != null ? nibblearray1.a(i1, j1, k1) : 0;
|
||||
-
|
||||
|
||||
- achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
|
||||
+
|
||||
+ // CraftBukkit start - fix broken blocks
|
||||
+ // achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
|
||||
+
|
||||
@ -137,25 +107,26 @@
|
||||
}
|
||||
|
||||
chunksection.a(achar);
|
||||
@@ -320,7 +395,13 @@
|
||||
if (nbttagcompound.hasKeyOfType("Biomes", 7)) {
|
||||
@@ -326,6 +395,13 @@
|
||||
chunk.a(nbttagcompound.getByteArray("Biomes"));
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - End this method here and split off entity loading to another method
|
||||
+ return chunk;
|
||||
+ }
|
||||
|
||||
+
|
||||
+ public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) {
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
|
||||
|
||||
if (nbttaglist1 != null) {
|
||||
@@ -379,6 +460,6 @@
|
||||
@@ -384,7 +460,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return chunk;
|
||||
+ // return chunk; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
static class PendingChunkToSave {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkSection.java 2014-11-28 17:43:42.989707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkSection.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ChunkSection.java 2015-02-26 22:40:22.335608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ChunkSection.java 2015-02-26 22:40:22.335608142 +0000
|
||||
@@ -19,6 +19,18 @@
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2015-01-25 15:16:21.156837700 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2015-01-25 15:16:21.156837700 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandBlockListenerAbstract.java 2015-02-27 10:25:29.434446612 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2015-02-27 10:25:29.434446612 +0000
|
||||
@@ -4,6 +4,13 @@
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
+import org.apache.logging.log4j.Level;
|
||||
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||
+import com.google.common.base.Joiner;
|
||||
+import java.util.logging.Level;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class CommandBlockListenerAbstract implements ICommandListener {
|
||||
|
||||
private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss");
|
||||
@@ -13,6 +20,7 @@
|
||||
public String e = "";
|
||||
private String e = "";
|
||||
private String f = "@";
|
||||
private final CommandObjectiveExecutor g = new CommandObjectiveExecutor();
|
||||
+ protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender
|
||||
@ -29,19 +29,16 @@
|
||||
- this.b = icommandhandler.a(this, this.e);
|
||||
+ // this.b = icommandhandler.a(this, this.e);
|
||||
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
|
||||
+ this.b= executeCommand(this, sender, this.e);
|
||||
+ this.b = executeCommand(this, sender, this.e);
|
||||
+ // CraftBukkit end
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
|
||||
@@ -91,8 +102,136 @@
|
||||
} else {
|
||||
this.b = 0;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
@@ -110,6 +121,130 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+
|
||||
+ public static int executeCommand(ICommandListener sender, org.bukkit.command.CommandSender bSender, String command) {
|
||||
+ org.bukkit.command.SimpleCommandMap commandMap = sender.getWorld().getServer().getCommandMap();
|
||||
+ Joiner joiner = Joiner.on(" ");
|
||||
@ -90,40 +87,37 @@
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // testfor command requires special handling
|
||||
+ if (args[0].equalsIgnoreCase("testfor")) {
|
||||
+ if (args.length < 2) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ EntityPlayer[] players = ((java.util.List<EntityPlayer>) PlayerSelector.getPlayers(sender, args[1], EntityPlayer.class)).toArray(new EntityPlayer[0]);
|
||||
+
|
||||
+ if (players != null && players.length > 0) {
|
||||
+ return players.length;
|
||||
+ } else {
|
||||
+ EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]);
|
||||
+ if (player == null) {
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ commands.add(args);
|
||||
+
|
||||
+ // Find positions of command block syntax, if any
|
||||
+ ArrayList<String[]> newCommands = new ArrayList<String[]>();
|
||||
+ for (int i = 0; i < args.length; i++) {
|
||||
+ if (PlayerSelector.isPattern(args[i])) {
|
||||
+ for (int j = 0; j < commands.size(); j++) {
|
||||
+ newCommands.addAll(buildCommands(sender, commands.get(j), i));
|
||||
+ }
|
||||
+ ArrayList<String[]> temp = commands;
|
||||
+ commands = newCommands;
|
||||
+ newCommands = temp;
|
||||
+ newCommands.clear();
|
||||
+ WorldServer[] prev = MinecraftServer.getServer().worldServer;
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+ server.worldServer = new WorldServer[server.worlds.size()];
|
||||
+ server.worldServer[0] = (WorldServer) sender.getWorld();
|
||||
+ int bpos = 0;
|
||||
+ for (int pos = 1; pos < server.worldServer.length; pos++) {
|
||||
+ WorldServer world = server.worlds.get(bpos++);
|
||||
+ if (server.worldServer[0] == world) {
|
||||
+ pos--;
|
||||
+ continue;
|
||||
+ }
|
||||
+ server.worldServer[pos] = world;
|
||||
+ }
|
||||
+ try {
|
||||
+ ArrayList<String[]> newCommands = new ArrayList<String[]>();
|
||||
+ for (int i = 0; i < args.length; i++) {
|
||||
+ if (PlayerSelector.isPattern(args[i])) {
|
||||
+ for (int j = 0; j < commands.size(); j++) {
|
||||
+ newCommands.addAll(buildCommands(sender, commands.get(j), i));
|
||||
+ }
|
||||
+ ArrayList<String[]> temp = commands;
|
||||
+ commands = newCommands;
|
||||
+ newCommands = temp;
|
||||
+ newCommands.clear();
|
||||
+ }
|
||||
+ }
|
||||
+ } finally {
|
||||
+ MinecraftServer.getServer().worldServer = prev;
|
||||
+ }
|
||||
+
|
||||
+ int completed = 0;
|
||||
@ -135,14 +129,13 @@
|
||||
+ completed++;
|
||||
+ }
|
||||
+ } catch (Throwable exception) {
|
||||
+ if (sender instanceof TileEntityCommandListener) {
|
||||
+ TileEntityCommandListener listener = (TileEntityCommandListener) sender;
|
||||
+ MinecraftServer.getLogger().log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception);
|
||||
+ } else if (sender instanceof EntityMinecartCommandBlockListener) {
|
||||
+ EntityMinecartCommandBlockListener listener = (EntityMinecartCommandBlockListener) sender;
|
||||
+ MinecraftServer.getLogger().log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception);
|
||||
+ if (sender.f() instanceof EntityMinecartCommandBlock) {
|
||||
+ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", sender.getChunkCoordinates().getX(), sender.getChunkCoordinates().getY(), sender.getChunkCoordinates().getZ()), exception);
|
||||
+ } else if (sender instanceof CommandBlockListenerAbstract) {
|
||||
+ CommandBlockListenerAbstract listener = (CommandBlockListenerAbstract) sender;
|
||||
+ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception);
|
||||
+ } else {
|
||||
+ MinecraftServer.getLogger().log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), exception);
|
||||
+ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("Unknown CommandBlock failed to handle command"), exception);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -164,10 +157,11 @@
|
||||
+ commands.add(command);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+
|
||||
+ return commands;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public String getName() {
|
||||
return this.f;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/CommandExecute.java 2015-01-25 15:16:56.720837314 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandExecute.java 2015-01-25 15:16:56.720837314 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandExecute.java 2015-02-26 22:40:22.343608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandExecute.java 2015-02-26 22:40:22.343608142 +0000
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
import java.util.Collection;
|
||||
@ -11,27 +11,17 @@
|
||||
|
||||
public class CommandExecute extends CommandAbstract {
|
||||
|
||||
@@ -19,7 +23,7 @@
|
||||
return "commands.execute.usage";
|
||||
}
|
||||
|
||||
- public void execute(ICommandListener icommandlistener, String[] astring) {
|
||||
+ public void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage, CommandException { // CraftBukkit - added throws
|
||||
if (astring.length < 5) {
|
||||
throw new ExceptionUsage("commands.execute.usage", new Object[0]);
|
||||
} else {
|
||||
@@ -52,12 +56,30 @@
|
||||
@@ -94,12 +98,31 @@
|
||||
ICommandHandler icommandhandler = MinecraftServer.getServer().getCommandHandler();
|
||||
|
||||
try {
|
||||
- int j = icommandhandler.a(commandlistenerentity, s);
|
||||
-
|
||||
- int j = icommandhandler.a(icommandlistener1, s);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.command.CommandSender sender = null;
|
||||
+ if (icommandlistener instanceof DedicatedServer) {
|
||||
+ sender = MinecraftServer.getServer().server.getConsoleSender();
|
||||
+ } else if (icommandlistener instanceof TileEntityCommandListener) {
|
||||
+ sender = ((TileEntityCommandListener) icommandlistener).sender;
|
||||
+ } else if (icommandlistener instanceof CommandBlockListenerAbstract) {
|
||||
+ sender = ((CommandBlockListenerAbstract) icommandlistener).sender;
|
||||
+ } else if (VanillaCommandWrapper.lastSender != null) {
|
||||
+ sender = VanillaCommandWrapper.lastSender;
|
||||
+ }else if (icommandlistener.f() != null) {
|
||||
@ -39,8 +29,9 @@
|
||||
+ } else {
|
||||
+ throw new CommandException("Unhandled executor " + icommandlistener.getClass().getSimpleName(), new Object[0]);
|
||||
+ }
|
||||
+ int j = CommandBlockListenerAbstract.executeCommand(commandlistenerentity, new ProxiedNativeCommandSender(commandlistenerentity, sender, entity.getBukkitEntity()), s); // icommandhandler.a(commandlistenerentity, s);
|
||||
+ int j = CommandBlockListenerAbstract.executeCommand(icommandlistener1, new ProxiedNativeCommandSender(icommandlistener1, sender, entity.getBukkitEntity()), s);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (j < 1) {
|
||||
throw new CommandException("commands.execute.allInvocationsFailed", new Object[] { s});
|
||||
}
|
||||
@ -53,14 +44,14 @@
|
||||
throw new CommandException("commands.execute.failed", new Object[] { s, entity.getName()});
|
||||
}
|
||||
}
|
||||
@@ -70,4 +92,11 @@
|
||||
@@ -112,4 +135,11 @@
|
||||
public boolean isListStart(String[] astring, int i) {
|
||||
return i == 0;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - fix decompiler error
|
||||
+ @Override
|
||||
+ public int compareTo(Object o) {
|
||||
+ public int compareTo(ICommand o) {
|
||||
+ return a((ICommand) o);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -1,21 +1,11 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000
|
||||
@@ -18,7 +18,7 @@
|
||||
return "commands.gamemode.usage";
|
||||
}
|
||||
|
||||
- public void execute(ICommandListener icommandlistener, String[] astring) {
|
||||
+ public void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage { // CraftBukkit - added throws
|
||||
if (astring.length <= 0) {
|
||||
throw new ExceptionUsage("commands.gamemode.usage", new Object[0]);
|
||||
} else {
|
||||
@@ -26,6 +26,14 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.343608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.351608142 +0000
|
||||
@@ -26,6 +26,13 @@
|
||||
EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener);
|
||||
|
||||
entityplayer.a(enumgamemode);
|
||||
+
|
||||
entityplayer.a(worldsettings_enumgamemode);
|
||||
+ // CraftBukkit start - handle event cancelling the change
|
||||
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
+ if (entityplayer.playerInteractManager.getGameMode() != worldsettings_enumgamemode) {
|
||||
+ icommandlistener.sendMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
||||
+ return;
|
||||
+ }
|
||||
@ -24,14 +14,14 @@
|
||||
entityplayer.fallDistance = 0.0F;
|
||||
if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) {
|
||||
entityplayer.sendMessage(new ChatMessage("gameMode.changed", new Object[0]));
|
||||
@@ -57,4 +65,11 @@
|
||||
@@ -57,4 +64,11 @@
|
||||
public boolean isListStart(String[] astring, int i) {
|
||||
return i == 1;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - fix decompiler error
|
||||
+ @Override
|
||||
+ public int compareTo(Object o) {
|
||||
+ public int compareTo(ICommand o) {
|
||||
+ return a((ICommand) o);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -1,13 +1,11 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/CommandGamerule.java 2014-12-10 16:21:38.404579167 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandGamerule.java 2014-12-10 16:18:45.268581046 +0000
|
||||
@@ -19,8 +19,8 @@
|
||||
return "commands.gamerule.usage";
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandGamerule.java 2015-02-26 22:40:22.363608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandGamerule.java 2015-02-26 22:40:22.363608142 +0000
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
- public void execute(ICommandListener icommandlistener, String[] astring) {
|
||||
public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
|
||||
- GameRules gamerules = this.d();
|
||||
+ public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { // CraftBukkit - added throws
|
||||
+ GameRules gamerules = icommandlistener.getWorld().getGameRules(); // Use current world
|
||||
+ GameRules gamerules = icommandlistener.getWorld().getGameRules(); // CraftBukkit - Use current world
|
||||
String s = astring.length > 0 ? astring[0] : "";
|
||||
String s1 = astring.length > 1 ? a(astring, 1) : "";
|
||||
|
||||
@ -18,7 +16,7 @@
|
||||
+
|
||||
+ // CraftBukkit start - fix decompile error
|
||||
+ @Override
|
||||
+ public int compareTo(Object o) {
|
||||
+ public int compareTo(ICommand o) {
|
||||
+ return a((ICommand) o);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
47
nms-patches/CommandSpreadPlayers.patch
Normale Datei
47
nms-patches/CommandSpreadPlayers.patch
Normale Datei
@ -0,0 +1,47 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandSpreadPlayers.java 2015-02-26 22:40:22.367608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandSpreadPlayers.java 2015-02-26 22:40:22.367608142 +0000
|
||||
@@ -237,6 +237,13 @@
|
||||
return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : null;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - fix decompile error
|
||||
+ @Override
|
||||
+ public int compareTo(ICommand o) {
|
||||
+ return a(o);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
static class Location2D {
|
||||
|
||||
double a;
|
||||
@@ -303,7 +310,7 @@
|
||||
}
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- } while (world.getType(blockposition).getBlock().getMaterial() == Material.AIR);
|
||||
+ } while (getType(world, blockposition).getBlock().getMaterial() == Material.AIR); // CraftBukkit
|
||||
|
||||
return blockposition.getY() + 1;
|
||||
}
|
||||
@@ -319,7 +326,7 @@
|
||||
}
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- material = world.getType(blockposition).getBlock().getMaterial();
|
||||
+ material = getType(world, blockposition).getBlock().getMaterial(); // CraftBukkit
|
||||
} while (material == Material.AIR);
|
||||
|
||||
return !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -329,5 +336,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - add a version of getType which force loads chunks
|
||||
+ private static IBlockData getType(World world, BlockPosition position) {
|
||||
+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
|
||||
+ return world.getType(position);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
@ -1,14 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/CommandTp.java 2014-12-13 09:54:39.438309447 +1100
|
||||
+++ src/main/java/net/minecraft/server/CommandTp.java 2014-12-13 09:54:37.990309246 +1100
|
||||
@@ -19,7 +19,7 @@
|
||||
return "commands.tp.usage";
|
||||
}
|
||||
|
||||
- public void execute(ICommandListener icommandlistener, String[] astring) {
|
||||
+ public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { // CraftBukkit - add throws
|
||||
if (astring.length < 1) {
|
||||
throw new ExceptionUsage("commands.tp.usage", new Object[0]);
|
||||
} else {
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CommandTp.java 2015-02-26 22:40:22.371608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/CommandTp.java 2015-02-26 22:40:22.371608142 +0000
|
||||
@@ -105,17 +105,11 @@
|
||||
} else {
|
||||
Entity entity = b(icommandlistener, astring[astring.length - 1]);
|
||||
@ -39,7 +30,7 @@
|
||||
+
|
||||
+ // CraftBukkit start - fix decompile error
|
||||
+ @Override
|
||||
+ public int compareTo(Object o) {
|
||||
+ public int compareTo(ICommand o) {
|
||||
+ return a((ICommand) o);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/Container.java 2014-11-28 17:43:43.013707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/Container.java 2014-11-28 17:38:22.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/Container.java 2015-02-26 22:40:22.415608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/Container.java 2015-02-26 22:40:22.419608141 +0000
|
||||
@@ -7,6 +7,17 @@
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -17,12 +17,11 @@
|
||||
+
|
||||
public abstract class Container {
|
||||
|
||||
public List b = Lists.newArrayList();
|
||||
@@ -17,6 +28,18 @@
|
||||
private final Set h = Sets.newHashSet();
|
||||
protected List listeners = Lists.newArrayList();
|
||||
private Set i = Sets.newHashSet();
|
||||
+
|
||||
public List<ItemStack> b = Lists.newArrayList();
|
||||
@@ -18,12 +29,24 @@
|
||||
protected List<ICrafting> listeners = Lists.newArrayList();
|
||||
private Set<EntityHuman> i = Sets.newHashSet();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean checkReachable = true;
|
||||
+ public abstract InventoryView getBukkitView();
|
||||
@ -34,9 +33,17 @@
|
||||
+ ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public Container() {}
|
||||
|
||||
protected Slot a(Slot slot) {
|
||||
slot.rawSlotIndex = this.c.size();
|
||||
this.c.add(slot);
|
||||
- this.b.add((Object) null);
|
||||
+ this.b.add(null); // CraftBukkit - fix decompile error
|
||||
return slot;
|
||||
}
|
||||
|
||||
@@ -124,6 +147,7 @@
|
||||
l = playerinventory.getCarried().count;
|
||||
Iterator iterator = this.h.iterator();
|
||||
@ -45,7 +52,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Slot slot1 = (Slot) iterator.next();
|
||||
|
||||
@@ -141,16 +165,49 @@
|
||||
@@ -141,16 +165,48 @@
|
||||
}
|
||||
|
||||
l -= itemstack2.count - j1;
|
||||
@ -54,7 +61,10 @@
|
||||
+ draggedSlots.put(slot1.rawSlotIndex, itemstack2); // CraftBukkit - Put in map instead of setting
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
- itemstack1.count = l;
|
||||
- if (itemstack1.count <= 0) {
|
||||
- itemstack1 = null;
|
||||
+ // CraftBukkit start - InventoryDragEvent
|
||||
+ InventoryView view = getBukkitView();
|
||||
+ org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack1);
|
||||
@ -83,10 +93,6 @@
|
||||
+ if (playerinventory.getCarried() != null) {
|
||||
+ playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor()));
|
||||
+ needsUpdate = true;
|
||||
|
||||
- itemstack1.count = l;
|
||||
- if (itemstack1.count <= 0) {
|
||||
- itemstack1 = null;
|
||||
+ }
|
||||
+ } else {
|
||||
+ playerinventory.setCarried(oldCursor);
|
||||
@ -100,7 +106,7 @@
|
||||
}
|
||||
|
||||
this.d();
|
||||
@@ -173,8 +230,14 @@
|
||||
@@ -173,8 +229,14 @@
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
@ -117,7 +123,7 @@
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
@@ -223,7 +286,11 @@
|
||||
@@ -223,7 +285,11 @@
|
||||
|
||||
if (itemstack4.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
@ -129,7 +135,7 @@
|
||||
}
|
||||
} else if (slot2.isAllowed(entityhuman)) {
|
||||
if (itemstack4 == null) {
|
||||
@@ -249,7 +316,11 @@
|
||||
@@ -249,7 +315,11 @@
|
||||
itemstack4.a(k1);
|
||||
if (itemstack4.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
@ -141,7 +147,7 @@
|
||||
|
||||
itemstack1.count += k1;
|
||||
} else if (itemstack4.count <= slot2.getMaxStackSize(itemstack4)) {
|
||||
@@ -258,7 +329,9 @@
|
||||
@@ -258,7 +328,9 @@
|
||||
}
|
||||
} else if (itemstack1.getItem() == itemstack4.getItem() && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
|
||||
k1 = itemstack1.count;
|
||||
@ -152,7 +158,7 @@
|
||||
itemstack4.count += k1;
|
||||
itemstack1 = slot2.a(k1);
|
||||
if (itemstack1.count == 0) {
|
||||
@@ -266,11 +339,24 @@
|
||||
@@ -266,11 +338,24 @@
|
||||
}
|
||||
|
||||
slot2.a(entityhuman, playerinventory.getCarried());
|
||||
@ -177,7 +183,7 @@
|
||||
}
|
||||
}
|
||||
} else if (k == 2 && j >= 0 && j < 9) {
|
||||
@@ -411,17 +497,20 @@
|
||||
@@ -411,17 +496,20 @@
|
||||
if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
|
||||
int l = itemstack1.count + itemstack.count;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerAnvil.java 2014-11-28 17:43:42.993707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerAnvil.java 2014-11-28 17:38:20.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerAnvil.java 2015-02-26 22:40:22.375608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerAnvil.java 2015-02-26 22:40:22.375608142 +0000
|
||||
@@ -6,6 +6,8 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -9,7 +9,7 @@
|
||||
public class ContainerAnvil extends Container {
|
||||
|
||||
private static final Logger f = LogManager.getLogger();
|
||||
@@ -17,8 +19,13 @@
|
||||
@@ -22,8 +24,13 @@
|
||||
private int k;
|
||||
private String l;
|
||||
private final EntityHuman m;
|
||||
@ -18,12 +18,12 @@
|
||||
+ private PlayerInventory player;
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ContainerAnvil(PlayerInventory playerinventory, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
public ContainerAnvil(PlayerInventory playerinventory, final World world, final BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
+ this.player = playerinventory; // CraftBukkit
|
||||
this.j = blockposition;
|
||||
this.i = world;
|
||||
this.m = entityhuman;
|
||||
@@ -265,6 +272,7 @@
|
||||
@@ -317,6 +324,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
@ -31,9 +31,9 @@
|
||||
return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.e((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@@ -328,4 +336,17 @@
|
||||
static int b(ContainerAnvil containeranvil) {
|
||||
return containeranvil.k;
|
||||
@@ -372,4 +380,17 @@
|
||||
|
||||
this.e();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,58 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerAnvilInventory.java 2014-11-28 17:43:42.993707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerAnvilInventory.java 2014-11-28 17:38:20.000000000 +0000
|
||||
@@ -1,8 +1,43 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ContainerAnvilInventory extends InventorySubcontainer {
|
||||
|
||||
final ContainerAnvil a;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ public org.bukkit.entity.Player player;
|
||||
+ private int maxStack = MAX_STACK;
|
||||
+
|
||||
+ public ItemStack[] getContents() {
|
||||
+ return this.items;
|
||||
+ }
|
||||
+
|
||||
+ public void onOpen(CraftHumanEntity who) {
|
||||
+ transaction.add(who);
|
||||
+ }
|
||||
+
|
||||
+ public void onClose(CraftHumanEntity who) {
|
||||
+ transaction.remove(who);
|
||||
+ }
|
||||
+
|
||||
+ public List<HumanEntity> getViewers() {
|
||||
+ return transaction;
|
||||
+ }
|
||||
+
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ maxStack = size;
|
||||
+ }
|
||||
|
||||
ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) {
|
||||
super(s, flag, i);
|
||||
@@ -13,4 +48,11 @@
|
||||
super.update();
|
||||
this.a.a((IInventory) this);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - override inherited maxStack from InventorySubcontainer
|
||||
+ @Override
|
||||
+ public int getMaxStackSize() {
|
||||
+ return maxStack;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerBeacon.java 2014-11-28 17:43:42.997707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerBeacon.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerBeacon.java 2015-02-26 22:40:22.379608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerBeacon.java 2015-02-26 22:40:22.379608142 +0000
|
||||
@@ -1,11 +1,18 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
public class ContainerBeacon extends Container {
|
||||
|
||||
private IInventory a;
|
||||
private final SlotBeacon f;
|
||||
private final ContainerBeacon.SlotBeacon f;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
@ -17,9 +17,9 @@
|
||||
public ContainerBeacon(IInventory iinventory, IInventory iinventory1) {
|
||||
+ player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this
|
||||
this.a = iinventory1;
|
||||
this.a((Slot) (this.f = new SlotBeacon(this, iinventory1, 0, 136, 110)));
|
||||
this.a((Slot) (this.f = new ContainerBeacon.SlotBeacon(iinventory1, 0, 136, 110)));
|
||||
byte b0 = 36;
|
||||
@@ -35,6 +42,7 @@
|
||||
@@ -47,6 +54,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
@ -27,9 +27,9 @@
|
||||
return this.a.a(entityhuman);
|
||||
}
|
||||
|
||||
@@ -83,4 +91,17 @@
|
||||
|
||||
return itemstack;
|
||||
@@ -110,4 +118,17 @@
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerBrewingStand.java 2014-11-28 17:43:42.997707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerBrewingStand.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerBrewingStand.java 2015-02-26 22:40:22.379608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerBrewingStand.java 2015-02-26 22:40:22.383608142 +0000
|
||||
@@ -1,12 +1,23 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -13,17 +13,17 @@
|
||||
private IInventory brewingStand;
|
||||
private final Slot f;
|
||||
private int g;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public ContainerBrewingStand(PlayerInventory playerinventory, IInventory iinventory) {
|
||||
+ player = playerinventory; // CraftBukkit
|
||||
this.brewingStand = iinventory;
|
||||
this.a((Slot) (new SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46)));
|
||||
this.a((Slot) (new SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53)));
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46)));
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53)));
|
||||
@@ -47,6 +58,7 @@
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
return this.brewingStand.a(entityhuman);
|
||||
}
|
||||
|
||||
@@ -101,4 +113,17 @@
|
||||
|
||||
return itemstack;
|
||||
@@ -146,4 +158,17 @@
|
||||
return itemstack != null && (itemstack.getItem() == Items.POTION || itemstack.getItem() == Items.GLASS_BOTTLE);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerChest.java 2014-11-28 17:43:43.001707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerChest.java 2014-11-28 17:38:23.000000000 +0000
|
||||
@@ -1,15 +1,48 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerChest.java 2015-02-26 22:40:22.387608142 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerChest.java 2015-02-26 22:40:22.387608142 +0000
|
||||
@@ -1,9 +1,37 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
@ -10,7 +10,7 @@
|
||||
+
|
||||
public class ContainerChest extends Container {
|
||||
|
||||
public IInventory container;
|
||||
private IInventory container;
|
||||
private int f;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
@ -38,17 +38,18 @@
|
||||
|
||||
public ContainerChest(IInventory iinventory, IInventory iinventory1, EntityHuman entityhuman) {
|
||||
this.container = iinventory1;
|
||||
this.f = iinventory1.getSize() / 9;
|
||||
@@ -11,6 +39,11 @@
|
||||
iinventory1.startOpen(entityhuman);
|
||||
int i = (this.f - 4) * 18;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Save player
|
||||
+ // TODO: Should we check to make sure it really is an InventoryPlayer?
|
||||
+ this.player = (PlayerInventory) iinventory;
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
int j;
|
||||
int k;
|
||||
|
||||
@@ -33,6 +66,7 @@
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerDispenser.java 2014-11-28 17:43:43.001707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerDispenser.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerDispenser.java 2015-02-26 22:40:22.395608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerDispenser.java 2015-02-26 22:40:22.395608141 +0000
|
||||
@@ -1,11 +1,24 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015
|
||||
+++ src/main/java/net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015
|
||||
@@ -3,15 +3,31 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerEnchantTable.java 2015-02-27 17:02:15.091159962 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerEnchantTable.java 2015-02-27 17:02:15.091159962 +0000
|
||||
@@ -3,9 +3,21 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -17,12 +17,13 @@
|
||||
+
|
||||
public class ContainerEnchantTable extends Container {
|
||||
|
||||
- public IInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 2);
|
||||
- public IInventory enchantSlots = new InventorySubcontainer("Enchant", true, 2) {
|
||||
+ // CraftBukkit - make type specific (changed from IInventory)
|
||||
+ public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 2);
|
||||
private World world;
|
||||
private BlockPosition position;
|
||||
private Random k = new Random();
|
||||
+ public InventorySubcontainer enchantSlots = new InventorySubcontainer("Enchant", true, 2) {
|
||||
public int getMaxStackSize() {
|
||||
return 64;
|
||||
}
|
||||
@@ -21,6 +33,10 @@
|
||||
public int f;
|
||||
public int[] costs = new int[3];
|
||||
public int[] h = new int[] { -1, -1, -1};
|
||||
@ -33,33 +34,29 @@
|
||||
|
||||
public ContainerEnchantTable(PlayerInventory playerinventory, World world, BlockPosition blockposition) {
|
||||
this.world = world;
|
||||
@@ -31,7 +47,11 @@
|
||||
for (i = 0; i < 9; ++i) {
|
||||
@@ -53,6 +69,9 @@
|
||||
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
-
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ player = (Player) playerinventory.player.getBukkitEntity();
|
||||
+ enchantSlots.player = player;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
@@ -67,7 +87,7 @@
|
||||
@@ -88,7 +107,7 @@
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
int i;
|
||||
|
||||
- if (itemstack != null && itemstack.v()) {
|
||||
+ if (itemstack != null) { // CraftBukkit - relax condition
|
||||
if (!this.world.isStatic) {
|
||||
if (!this.world.isClientSide) {
|
||||
i = 0;
|
||||
|
||||
@@ -114,6 +134,20 @@
|
||||
this.costs[j] = 0;
|
||||
@@ -136,6 +155,20 @@
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
||||
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, this.costs, i);
|
||||
@ -73,12 +70,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
for (j = 0; j < 3; ++j) {
|
||||
if (this.costs[j] > 0) {
|
||||
@@ -149,24 +183,56 @@
|
||||
List list = this.a(itemstack, j, this.costs[j]);
|
||||
@@ -170,24 +203,55 @@
|
||||
} else if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= j && entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
|
||||
if (!this.world.isStatic) {
|
||||
if (!this.world.isClientSide) {
|
||||
List list = this.a(itemstack, i, this.costs[i]);
|
||||
+ // CraftBukkit start - Provide an empty enchantment list
|
||||
+ if (list == null) {
|
||||
@ -104,11 +102,12 @@
|
||||
+ if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || event.getEnchantsToAdd().isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (flag) {
|
||||
itemstack.setItem(Items.ENCHANTED_BOOK);
|
||||
}
|
||||
+
|
||||
|
||||
- for (int k = 0; k < list.size(); ++k) {
|
||||
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
|
||||
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
|
||||
+ try {
|
||||
+ if (flag) {
|
||||
@ -117,9 +116,6 @@
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- for (int k = 0; k < list.size(); ++k) {
|
||||
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
|
||||
-
|
||||
- if (flag) {
|
||||
- Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant);
|
||||
- } else {
|
||||
@ -133,15 +129,15 @@
|
||||
+ /* Just swallow invalid enchantments */
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ entityhuman.b(j);
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
+ // CraftBukkit - TODO: let plugins change this
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1.count -= j;
|
||||
if (itemstack1.count <= 0) {
|
||||
@@ -199,6 +265,11 @@
|
||||
@@ -221,6 +285,11 @@
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
super.b(entityhuman);
|
||||
@ -150,10 +146,10 @@
|
||||
+ this.world = entityhuman.getWorld();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.world.isStatic) {
|
||||
if (!this.world.isClientSide) {
|
||||
for (int i = 0; i < this.enchantSlots.getSize(); ++i) {
|
||||
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i);
|
||||
@@ -212,6 +283,7 @@
|
||||
@@ -234,6 +303,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
@ -161,11 +157,10 @@
|
||||
return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@@ -263,5 +335,18 @@
|
||||
}
|
||||
@@ -286,4 +356,17 @@
|
||||
|
||||
return itemstack;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
@ -177,6 +172,6 @@
|
||||
+ CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
||||
+ return bukkitEntity;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTableInventory.java 2014-11-28 17:43:43.005707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java 2014-11-28 17:38:23.000000000 +0000
|
||||
@@ -1,8 +1,45 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
-class ContainerEnchantTableInventory extends InventorySubcontainer {
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+// CraftBukkit -> public
|
||||
+public class ContainerEnchantTableInventory extends InventorySubcontainer {
|
||||
|
||||
final ContainerEnchantTable enchantTable;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ public org.bukkit.entity.Player player;
|
||||
+ private int maxStack = MAX_STACK;
|
||||
+
|
||||
+ public ItemStack[] getContents() {
|
||||
+ return this.items;
|
||||
+ }
|
||||
+
|
||||
+ public void onOpen(CraftHumanEntity who) {
|
||||
+ transaction.add(who);
|
||||
+ }
|
||||
+
|
||||
+ public void onClose(CraftHumanEntity who) {
|
||||
+ transaction.remove(who);
|
||||
+ }
|
||||
+
|
||||
+ public List<HumanEntity> getViewers() {
|
||||
+ return transaction;
|
||||
+ }
|
||||
+
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ maxStack = size;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, boolean flag, int i) {
|
||||
super(s, flag, i);
|
||||
@@ -10,7 +47,7 @@
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
- return 64;
|
||||
+ return maxStack; // CraftBukkit
|
||||
}
|
||||
|
||||
public void update() {
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerFurnace.java 2014-11-28 17:43:43.009707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerFurnace.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerFurnace.java 2015-02-26 22:40:22.407608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerFurnace.java 2015-02-26 22:40:22.407608141 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -11,11 +11,10 @@
|
||||
public class ContainerFurnace extends Container {
|
||||
|
||||
private final IInventory furnace;
|
||||
@@ -7,12 +12,29 @@
|
||||
private int g;
|
||||
@@ -8,11 +13,28 @@
|
||||
private int h;
|
||||
private int i;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
@ -31,7 +30,7 @@
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public ContainerFurnace(PlayerInventory playerinventory, IInventory iinventory) {
|
||||
this.furnace = iinventory;
|
||||
this.a(new Slot(iinventory, 0, 56, 17));
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerHopper.java 2014-11-28 17:43:43.009707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerHopper.java 2014-11-28 17:38:18.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerHopper.java 2015-02-26 22:40:22.407608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerHopper.java 2015-02-26 22:40:22.411608141 +0000
|
||||
@@ -1,11 +1,33 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
public class ContainerHopper extends Container {
|
||||
|
||||
private final IInventory hopper;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
@ -27,7 +27,7 @@
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory, EntityHuman entityhuman) {
|
||||
this.hopper = iinventory;
|
||||
+ this.player = playerinventory; // CraftBukkit - save player
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerHorse.java 2014-11-28 17:43:43.013707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerHorse.java 2014-11-28 17:38:17.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerHorse.java 2015-02-26 22:40:22.411608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerHorse.java 2015-02-26 22:40:22.415608141 +0000
|
||||
@@ -1,11 +1,33 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
private IInventory a;
|
||||
private EntityHorse f;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity;
|
||||
+ PlayerInventory player;
|
||||
@ -27,8 +27,8 @@
|
||||
+ CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryHorse(this.a);
|
||||
+ return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), inventory, this);
|
||||
+ }
|
||||
|
||||
public ContainerHorse(IInventory iinventory, IInventory iinventory1, EntityHorse entityhorse, EntityHuman entityhuman) {
|
||||
+
|
||||
public ContainerHorse(IInventory iinventory, final IInventory iinventory1, final EntityHorse entityhorse, EntityHuman entityhuman) {
|
||||
+ player = (PlayerInventory) iinventory;
|
||||
+ // CraftBukkit end
|
||||
this.a = iinventory1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerMerchant.java 2014-11-28 17:43:43.017707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerMerchant.java 2014-11-28 17:38:16.000000000 +0000
|
||||
@@ -1,10 +1,25 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerMerchant.java 2015-02-26 22:40:22.423608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerMerchant.java 2015-02-26 22:40:22.423608141 +0000
|
||||
@@ -1,11 +1,26 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
@ -10,7 +10,7 @@
|
||||
private IMerchant merchant;
|
||||
private InventoryMerchant f;
|
||||
private final World g;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
@ -23,9 +23,10 @@
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
|
||||
this.merchant = imerchant;
|
||||
this.g = world;
|
||||
@@ -13,6 +28,7 @@
|
||||
this.a(new Slot(this.f, 0, 36, 53));
|
||||
this.a(new Slot(this.f, 1, 62, 53));
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerPlayer.java 2014-11-28 17:43:43.021707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerPlayer.java 2014-11-28 17:38:19.000000000 +0000
|
||||
@@ -1,15 +1,28 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerPlayer.java 2015-02-26 22:40:22.427608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerPlayer.java 2015-02-26 22:40:22.427608141 +0000
|
||||
@@ -1,28 +1,42 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
@ -19,7 +19,7 @@
|
||||
+ private PlayerInventory player;
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
|
||||
public ContainerPlayer(final PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
|
||||
this.g = flag;
|
||||
this.h = entityhuman;
|
||||
+ this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
|
||||
@ -28,8 +28,38 @@
|
||||
+ this.player = playerinventory; // CraftBukkit - save player
|
||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
|
||||
|
||||
int i;
|
||||
@@ -35,11 +48,22 @@
|
||||
- final int i;
|
||||
+ // CraftBukkit - fixed multiple decompiler errors below, good luck
|
||||
int j;
|
||||
|
||||
- for (i = 0; i < 2; ++i) {
|
||||
+ for (int i = 0; i < 2; ++i) {
|
||||
for (j = 0; j < 2; ++j) {
|
||||
this.a(new Slot(this.craftInventory, j + i * 2, 88 + j * 18, 26 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
- for (i = 0; i < 4; ++i) {
|
||||
- this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - i, 8, 8 + i * 18) {
|
||||
+ for (int ii = 0; ii < 4; ++ii) {
|
||||
+ final int i = ii;
|
||||
+ this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - ii, 8, 8 + ii * 18) {
|
||||
public int getMaxStackSize() {
|
||||
return 1;
|
||||
}
|
||||
@@ -33,21 +47,32 @@
|
||||
});
|
||||
}
|
||||
|
||||
- for (i = 0; i < 3; ++i) {
|
||||
+ for (int i = 0; i < 3; ++i) {
|
||||
for (j = 0; j < 9; ++j) {
|
||||
this.a(new Slot(playerinventory, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
- for (i = 0; i < 9; ++i) {
|
||||
+ for (int i = 0; i < 9; ++i) {
|
||||
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
@ -54,7 +84,7 @@
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
@@ -119,4 +143,17 @@
|
||||
@@ -127,4 +152,17 @@
|
||||
public boolean a(ItemStack itemstack, Slot slot) {
|
||||
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:49.302794059 +1100
|
||||
+++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:29.771003013 +1100
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerWorkbench.java 2015-02-26 22:40:22.427608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2015-02-26 22:40:22.431608141 +0000
|
||||
@@ -1,13 +1,28 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ControllerLook.java 2014-11-28 17:43:43.025707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ControllerLook.java 2014-11-28 17:38:21.000000000 +0000
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.TrigMath; // CraftBukkit
|
||||
+
|
||||
public class ControllerLook {
|
||||
|
||||
private EntityInsentient a;
|
||||
@@ -45,8 +47,10 @@
|
||||
double d1 = this.f - (this.a.locY + (double) this.a.getHeadHeight());
|
||||
double d2 = this.g - this.a.locZ;
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
- float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
- float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
|
||||
+ // CraftBukkit start - Math -> TrigMath
|
||||
+ float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
+ float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.a.pitch = this.a(this.a.pitch, f1, this.c);
|
||||
this.a.aI = this.a(this.a.aI, f, this.b);
|
@ -1,12 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/ControllerMove.java 2014-11-28 17:43:43.025707437 +0000
|
||||
+++ src/main/java/net/minecraft/server/ControllerMove.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -43,7 +43,8 @@
|
||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||
|
||||
if (d3 >= 2.500000277905201E-7D) {
|
||||
- float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
+ // CraftBukkit - Math -> TrigMath
|
||||
+ float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
|
||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||
this.a.j((float) (this.e * this.a.getAttributeInstance(GenericAttributes.d).getValue()));
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/CraftingManager.java 2014-11-28 17:43:43.029707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/CraftingManager.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -8,10 +8,16 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CraftingManager.java 2015-02-26 22:40:22.431608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/CraftingManager.java 2015-02-26 22:40:22.435608141 +0000
|
||||
@@ -9,16 +9,22 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
public class CraftingManager {
|
||||
|
||||
private static final CraftingManager a = new CraftingManager();
|
||||
public List recipes = Lists.newArrayList();
|
||||
- private final List<IRecipe> recipes = Lists.newArrayList();
|
||||
+ public List<IRecipe> recipes = Lists.newArrayList(); // CraftBukkit - public, removed final
|
||||
+ // CraftBukkit start
|
||||
+ public IRecipe lastRecipe;
|
||||
+ public org.bukkit.inventory.InventoryView lastCraftView;
|
||||
@ -17,23 +18,28 @@
|
||||
|
||||
public static CraftingManager getInstance() {
|
||||
return CraftingManager.a;
|
||||
@@ -166,8 +172,15 @@
|
||||
}
|
||||
|
||||
- private CraftingManager() {
|
||||
+ public CraftingManager() { // CraftBukkit - public
|
||||
(new RecipesTools()).a(this);
|
||||
(new RecipesWeapons()).a(this);
|
||||
(new RecipeIngots()).a(this);
|
||||
@@ -167,7 +173,12 @@
|
||||
this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOODEN_SLAB});
|
||||
this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
|
||||
this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, EnumStoneSlabVariant.STONE.a())});
|
||||
+ // Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
|
||||
this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, BlockDoubleStepAbstract.EnumStoneSlabVariant.STONE.a())});
|
||||
- Collections.sort(this.recipes, new Comparator() {
|
||||
+ sort();
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void sort() {
|
||||
Collections.sort(this.recipes, new RecipeSorter(this));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ShapedRecipes registerShapedRecipe(ItemStack itemstack, Object... aobject) {
|
||||
String s = "";
|
||||
@@ -265,13 +278,18 @@
|
||||
+ Collections.sort(this.recipes, new Comparator() {
|
||||
public int a(IRecipe irecipe, IRecipe irecipe1) {
|
||||
return irecipe instanceof ShapelessRecipes && irecipe1 instanceof ShapedRecipes ? 1 : (irecipe1 instanceof ShapelessRecipes && irecipe instanceof ShapedRecipes ? -1 : (irecipe1.a() < irecipe.a() ? -1 : (irecipe1.a() > irecipe.a() ? 1 : 0)));
|
||||
}
|
||||
@@ -274,13 +285,18 @@
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
@ -42,11 +48,9 @@
|
||||
}
|
||||
|
||||
irecipe = (IRecipe) iterator.next();
|
||||
- } while (!irecipe.a(inventorycrafting, world));
|
||||
-
|
||||
} while (!irecipe.a(inventorycrafting, world));
|
||||
|
||||
- return irecipe.a(inventorycrafting);
|
||||
+ } while (!irecipe.a(inventorycrafting, world));
|
||||
+
|
||||
+ // CraftBukkit start - INVENTORY_PRE_CRAFT event
|
||||
+ inventorycrafting.currentRecipe = irecipe;
|
||||
+ ItemStack result = irecipe.a(inventorycrafting);
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/CrashReport.java 2014-11-28 17:43:43.029707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/CrashReport.java 2014-11-28 17:38:17.000000000 +0000
|
||||
@@ -40,6 +40,7 @@
|
||||
this.d.a("Memory", (Callable) (new CrashReportMemory(this)));
|
||||
this.d.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
|
||||
this.d.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/CrashReport.java 2015-02-26 22:40:22.435608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/CrashReport.java 2015-02-26 22:40:22.439608141 +0000
|
||||
@@ -133,6 +133,7 @@
|
||||
return this.a();
|
||||
}
|
||||
});
|
||||
+ this.d.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DedicatedServer.java 2014-11-28 17:43:43.033707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DedicatedServer.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -13,6 +13,14 @@
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/DedicatedServer.java 2015-02-26 22:40:22.443608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/DedicatedServer.java 2015-02-26 22:40:22.443608141 +0000
|
||||
@@ -15,20 +15,32 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -10,31 +10,68 @@
|
||||
+
|
||||
+import org.bukkit.craftbukkit.LoggerOutputStream;
|
||||
+import org.bukkit.event.server.ServerCommandEvent;
|
||||
+import org.bukkit.craftbukkit.util.Waitable;
|
||||
+import org.bukkit.event.server.RemoteServerCommandEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -25,23 +33,48 @@
|
||||
private EnumGamemode q;
|
||||
private boolean r;
|
||||
- private final List<ServerCommand> l = Collections.synchronizedList(Lists.newArrayList());
|
||||
+ private final List<ServerCommand> l = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
|
||||
private RemoteStatusListener m;
|
||||
private RemoteControlListener n;
|
||||
- private PropertyManager propertyManager;
|
||||
+ public PropertyManager propertyManager; // CraftBukkit - public
|
||||
private EULA p;
|
||||
private boolean generateStructures;
|
||||
private WorldSettings.EnumGamemode r;
|
||||
private boolean s;
|
||||
|
||||
- public DedicatedServer(File file) {
|
||||
- super(file, Proxy.NO_PROXY, DedicatedServer.a);
|
||||
+ // CraftBukkit start - Signature changed
|
||||
+ public DedicatedServer(joptsimple.OptionSet options) {
|
||||
+ super(options, Proxy.NO_PROXY, a);
|
||||
+ // super(file, Proxy.NO_PROXY, a);
|
||||
+ super(options, Proxy.NO_PROXY, DedicatedServer.a);
|
||||
+ // CraftBukkit end
|
||||
new ThreadSleepForever(this, "Server Infinisleeper");
|
||||
}
|
||||
Thread thread = new Thread("Server Infinisleeper") {
|
||||
{
|
||||
this.setDaemon(true);
|
||||
@@ -50,13 +62,27 @@
|
||||
protected boolean init() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.Main.useConsole) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- protected boolean init() {
|
||||
+ protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
|
||||
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler");
|
||||
+ jline.console.ConsoleReader bufferedreader = reader; // CraftBukkit
|
||||
String s;
|
||||
|
||||
threadcommandreader.setDaemon(true);
|
||||
threadcommandreader.start();
|
||||
try {
|
||||
- while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning() && (s = bufferedreader.readLine()) != null) {
|
||||
- DedicatedServer.this.issueCommand(s, DedicatedServer.this);
|
||||
+ // CraftBukkit start - JLine disabling compatibility
|
||||
+ while (!isStopped() && isRunning()) {
|
||||
+ if (org.bukkit.craftbukkit.Main.useJline) {
|
||||
+ s = bufferedreader.readLine(">", null);
|
||||
+ } else {
|
||||
+ s = bufferedreader.readLine();
|
||||
+ }
|
||||
+ if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces
|
||||
+ issueCommand(s, DedicatedServer.this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -67,13 +93,35 @@
|
||||
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
+
|
||||
+ // CraftBukkit start - TODO: handle command-line logging arguments
|
||||
+ java.util.logging.Logger global = java.util.logging.Logger.getLogger("");
|
||||
@ -57,7 +94,7 @@
|
||||
+ System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
DedicatedServer.LOGGER.info("Starting minecraft server version 1.8");
|
||||
DedicatedServer.LOGGER.info("Starting minecraft server version 1.8.3");
|
||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
|
||||
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
@ -65,18 +102,10 @@
|
||||
DedicatedServer.LOGGER.info("Loading properties");
|
||||
- this.propertyManager = new PropertyManager(new File("server.properties"));
|
||||
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
|
||||
this.o = new EULA(new File("eula.txt"));
|
||||
if (!this.o.a()) {
|
||||
this.p = new EULA(new File("eula.txt"));
|
||||
if (!this.p.a()) {
|
||||
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||
@@ -90,13 +123,15 @@
|
||||
|
||||
try {
|
||||
this.ao().a(inetaddress, this.Q());
|
||||
- } catch (IOException ioexception) {
|
||||
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||||
DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
|
||||
DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
|
||||
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
||||
@@ -129,6 +177,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -85,23 +114,22 @@
|
||||
if (!this.getOnlineMode()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -111,7 +146,8 @@
|
||||
@@ -143,7 +193,7 @@
|
||||
if (!NameReferencingFileConverter.a(this.propertyManager)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this)));
|
||||
+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
|
||||
+ this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
|
||||
long j = System.nanoTime();
|
||||
|
||||
if (this.T() == null) {
|
||||
@@ -166,7 +202,18 @@
|
||||
@@ -198,8 +248,19 @@
|
||||
DedicatedServer.LOGGER.info("Starting remote control listener");
|
||||
this.m = new RemoteControlListener(this);
|
||||
this.m.a();
|
||||
this.n = new RemoteControlListener(this);
|
||||
this.n.a();
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (this.server.getBukkitSpawnRadius() > -1) {
|
||||
+ DedicatedServer.LOGGER.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
|
||||
@ -109,12 +137,13 @@
|
||||
+ this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
|
||||
+ this.server.removeBukkitSpawnRadius();
|
||||
+ this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.aR() > 0L) {
|
||||
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
||||
|
||||
if (this.aQ() > 0L) {
|
||||
Thread thread = new Thread(new ThreadWatchdog(this));
|
||||
@@ -181,6 +228,12 @@
|
||||
@@ -213,6 +274,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,29 +153,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void setGamemode(EnumGamemode enumgamemode) {
|
||||
super.setGamemode(enumgamemode);
|
||||
this.q = enumgamemode;
|
||||
@@ -203,6 +256,7 @@
|
||||
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
|
||||
super.setGamemode(worldsettings_enumgamemode);
|
||||
this.r = worldsettings_enumgamemode;
|
||||
@@ -265,7 +332,7 @@
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
protected void a(CrashReport crashreport) {
|
||||
+ /* CraftBukkit start - not sure why you would want to continue running commands once the server crashed
|
||||
while (this.isRunning()) {
|
||||
this.aM();
|
||||
|
||||
@@ -212,7 +266,7 @@
|
||||
;
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // CraftBukkit end */
|
||||
- protected void A() {
|
||||
+ public void A() { // CraftBukkit - fix decompile error
|
||||
super.A();
|
||||
this.aN();
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
@@ -257,7 +311,14 @@
|
||||
while (!this.k.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.k.remove(0);
|
||||
@@ -296,7 +363,14 @@
|
||||
while (!this.l.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
|
||||
|
||||
- this.getCommandHandler().a(servercommand.source, servercommand.command);
|
||||
+ // CraftBukkit start - ServerCommand for preprocessing
|
||||
@ -160,3 +181,67 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,13 +561,57 @@
|
||||
}
|
||||
|
||||
public String getPlugins() {
|
||||
- return "";
|
||||
- }
|
||||
+ // CraftBukkit start - Whole method
|
||||
+ StringBuilder result = new StringBuilder();
|
||||
+ org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins();
|
||||
+
|
||||
+ result.append(server.getName());
|
||||
+ result.append(" on Bukkit ");
|
||||
+ result.append(server.getBukkitVersion());
|
||||
+
|
||||
+ if (plugins.length > 0 && server.getQueryPlugins()) {
|
||||
+ result.append(": ");
|
||||
+
|
||||
+ for (int i = 0; i < plugins.length; i++) {
|
||||
+ if (i > 0) {
|
||||
+ result.append("; ");
|
||||
+ }
|
||||
|
||||
- public String executeRemoteCommand(String s) {
|
||||
- RemoteControlCommandListener.getInstance().i();
|
||||
- this.b.a(RemoteControlCommandListener.getInstance(), s);
|
||||
- return RemoteControlCommandListener.getInstance().j();
|
||||
+ result.append(plugins[i].getDescription().getName());
|
||||
+ result.append(" ");
|
||||
+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return result.toString();
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - fire RemoteServerCommandEvent
|
||||
+ public String executeRemoteCommand(final String s) {
|
||||
+ Waitable<String> waitable = new Waitable<String>() {
|
||||
+ @Override
|
||||
+ protected String evaluate() {
|
||||
+ RemoteControlCommandListener.getInstance().i();
|
||||
+ // Event changes start
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ // Event change end
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.getInstance());
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ return RemoteControlCommandListener.getInstance().j();
|
||||
+ }
|
||||
+ };
|
||||
+ processQueue.add(waitable);
|
||||
+ try {
|
||||
+ return waitable.get();
|
||||
+ } catch (java.util.concurrent.ExecutionException e) {
|
||||
+ throw new RuntimeException("Exception processing rcon command " + s, e.getCause());
|
||||
+ } catch (InterruptedException e) {
|
||||
+ Thread.currentThread().interrupt(); // Maintain interrupted state
|
||||
+ throw new RuntimeException("Interrupted processing rcon command " + s, e);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public PlayerList getPlayerList() {
|
||||
|
@ -1,59 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorArmor.java 2014-11-28 17:43:43.033707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorArmor.java 2014-11-28 17:38:17.000000000 +0000
|
||||
@@ -3,6 +3,11 @@
|
||||
import com.google.common.base.Predicates;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorArmor extends DispenseBehaviorItem {
|
||||
|
||||
DispenseBehaviorArmor() {}
|
||||
@@ -19,15 +24,42 @@
|
||||
EntityLiving entityliving = (EntityLiving) list.get(0);
|
||||
int l = entityliving instanceof EntityHuman ? 1 : 0;
|
||||
int i1 = EntityInsentient.c(itemstack);
|
||||
- ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ World world = isourceblock.i();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
itemstack1.count = 1;
|
||||
entityliving.setEquipment(i1 - l, itemstack1);
|
||||
if (entityliving instanceof EntityInsentient) {
|
||||
((EntityInsentient) entityliving).a(i1, 2.0F);
|
||||
}
|
||||
|
||||
- --itemstack.count;
|
||||
+ // --itemstack.count; // CraftBukkit - handled above
|
||||
return itemstack;
|
||||
} else {
|
||||
return super.b(isourceblock, itemstack);
|
@ -1,54 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorBoat.java 2014-11-28 17:43:43.037707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorBoat.java 2014-11-28 17:38:18.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorBoat extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
|
||||
@@ -26,10 +31,38 @@
|
||||
d3 = 0.0D;
|
||||
}
|
||||
|
||||
- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
|
||||
world.addEntity(entityboat);
|
||||
- itemstack.a(1);
|
||||
+ // itemstack.a(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorBonemeal.java 2014-11-28 17:43:43.037707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java 2014-11-28 17:38:23.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
|
||||
|
||||
private boolean b = true;
|
||||
@@ -10,6 +15,30 @@
|
||||
if (EnumColor.WHITE == EnumColor.fromInvColorIndex(itemstack.getData())) {
|
||||
World world = isourceblock.i();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem());
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (ItemDye.a(itemstack, world, blockposition)) {
|
||||
if (!world.isStatic) {
|
@ -1,11 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorCommandBlock.java 2014-12-27 14:19:29.609280038 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorCommandBlock.java 2014-12-27 14:19:29.609280038 +0000
|
||||
@@ -8,7 +8,7 @@
|
||||
World world = isourceblock.i();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
|
||||
- if (world.isEmpty(blockposition)) {
|
||||
+ if (world.isEmpty(blockposition) && false) { // Craftbukkit - yeah... no
|
||||
if (!world.isStatic) {
|
||||
IBlockData iblockdata = Blocks.COMMAND_BLOCK.getBlockData().set(BlockCommand.TRIGGERED, Boolean.valueOf(false));
|
||||
|
@ -1,44 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorEmptyBucket.java 2014-11-28 17:43:43.041707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java 2014-11-28 17:38:18.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
|
||||
@@ -23,6 +28,30 @@
|
||||
|
||||
item = Items.LAVA_BUCKET;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().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) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
world.setAir(blockposition);
|
||||
if (--itemstack.count == 0) {
|
@ -1,65 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFilledBucket.java 2014-11-28 17:43:43.041707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
|
||||
@@ -9,10 +14,49 @@
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.i();
|
||||
+ int x = blockposition.getX();
|
||||
+ int y = blockposition.getY();
|
||||
+ int z = blockposition.getZ();
|
||||
+ if (world.isEmpty(blockposition) || !world.getType(blockposition).getBlock().getMaterial().isBuildable()) {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itembucket = (ItemBucket) CraftItemStack.asNMSCopy(event.getItem()).getItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itembucket.a(isourceblock.i(), blockposition)) {
|
||||
- itemstack.setItem(Items.BUCKET);
|
||||
- itemstack.count = 1;
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
+ Item item = Items.BUCKET;
|
||||
+ if (--itemstack.count == 0) {
|
||||
+ itemstack.setItem(Items.BUCKET);
|
||||
+ itemstack.count = 1;
|
||||
+ } else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
+ this.b.a(isourceblock, new ItemStack(item));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
} else {
|
||||
return this.b.a(isourceblock, itemstack);
|
@ -1,55 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFireball.java 2014-11-28 17:43:43.045707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorFireball.java 2014-11-28 17:38:20.000000000 +0000
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorFireball extends DispenseBehaviorItem {
|
||||
|
||||
DispenseBehaviorFireball() {}
|
||||
@@ -18,8 +23,38 @@
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
|
||||
|
||||
- world.addEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
|
||||
- itemstack.a(1);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
+
|
||||
+ world.addEntity(entitysmallfireball);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFireworks.java Sat Dec 6 21:12:00 2014
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java Sat Dec 6 21:11:47 2014
|
||||
@@ -1,5 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+
|
||||
final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
|
||||
|
||||
DispenseBehaviorFireworks() {}
|
||||
@@ -9,10 +12,38 @@
|
||||
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
|
||||
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
|
||||
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
|
||||
- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.i();
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack);
|
||||
isourceblock.i().addEntity(entityfireworks);
|
||||
- itemstack.a(1);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFlintAndSteel.java 2014-11-28 17:43:43.045707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java 2014-11-28 17:38:23.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
|
||||
|
||||
private boolean b = true;
|
||||
@@ -10,11 +15,39 @@
|
||||
World world = isourceblock.i();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
|
||||
- if (world.isEmpty(blockposition)) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
||||
- if (itemstack.isDamaged(1, world.random)) {
|
||||
- itemstack.count = 0;
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (world.isEmpty(blockposition)) {
|
||||
+ // CraftBukkit start - Ignition by dispensing flint and steel
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()).isCancelled()) {
|
||||
+ world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
||||
+ if (itemstack.isDamaged(1, world.random)) {
|
||||
+ itemstack.count = 0;
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
} else if (world.getType(blockposition).getBlock() == Blocks.TNT) {
|
||||
Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
||||
world.setAir(blockposition);
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorItem.java 2015-01-04 20:42:23.769644196 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorItem.java 2015-01-04 20:42:23.769644196 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/DispenseBehaviorItem.java 2015-02-26 22:40:22.447608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorItem.java 2015-02-26 22:40:22.447608141 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
+ if (!event.getItem().getType().equals(craftItem.getType())) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior.getClass() != DispenseBehaviorItem.class) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ } else {
|
||||
|
@ -1,58 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorMinecart.java 2014-11-28 17:43:43.049707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
|
||||
@@ -38,14 +43,42 @@
|
||||
}
|
||||
}
|
||||
|
||||
- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ItemMinecart.a((ItemMinecart) itemstack.getItem()));
|
||||
+ // CraftBukkit start
|
||||
+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ItemMinecart.a((ItemMinecart) itemstack.getItem()));
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ItemMinecart.a((ItemMinecart) itemstack1.getItem()));
|
||||
|
||||
if (itemstack.hasName()) {
|
||||
entityminecartabstract.setCustomName(itemstack.getName());
|
||||
}
|
||||
|
||||
world.addEntity(entityminecartabstract);
|
||||
- itemstack.a(1);
|
||||
+ // itemstack.a(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorMonsterEgg.java 2014-11-28 17:43:43.053707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java 2014-11-28 17:38:22.000000000 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
|
||||
|
||||
DispenseBehaviorMonsterEgg() {}
|
||||
@@ -9,13 +14,45 @@
|
||||
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
|
||||
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
|
||||
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
|
||||
- Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2);
|
||||
+ // Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.i();
|
||||
+ ItemStack itemstack1 = itemstack.a(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.i(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG);
|
||||
|
||||
if (entity instanceof EntityLiving && itemstack.hasName()) {
|
||||
((EntityInsentient) entity).setCustomName(itemstack.getName());
|
||||
}
|
||||
|
||||
- itemstack.a(1);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorProjectile.java 2014-11-28 17:43:43.053707436 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java 2014-11-28 17:38:23.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/DispenseBehaviorProjectile.java 2015-02-26 22:40:22.447608141 +0000
|
||||
+++ src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java 2015-02-26 22:40:22.451608141 +0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren