mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
90ac03522a
This reverts commit d6e3dff7d8
.
118 lines
6.7 KiB
Diff
118 lines
6.7 KiB
Diff
--- ../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;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|
+// CraftBukkit end
|
|
+
|
|
public class BlockPumpkin extends BlockDirectional {
|
|
|
|
private ShapeDetector snowGolemPart;
|
|
@@ -29,31 +35,45 @@
|
|
int j;
|
|
|
|
if ((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);
|
|
|
|
- world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
|
|
+ // CraftBukkit start
|
|
+ // world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
|
|
+ BlockPosition pos = shapedetectorblock.d();
|
|
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
EntitySnowman entitysnowman = new EntitySnowman(world);
|
|
BlockPosition blockposition1 = 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);
|
|
+ // CraftBukkit start
|
|
+ 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 < 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);
|
|
+ }
|
|
}
|
|
+ // CraftBukkit end
|
|
} else if ((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);
|
|
+ // CraftBukkit start
|
|
+ // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
|
|
+ BlockPosition pos = shapedetectorcollection.a(i, k, 0).d();
|
|
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -62,22 +82,38 @@
|
|
|
|
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);
|
|
+ }
|
|
}
|
|
}
|
|
+ // 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());
|