Update to Minecraft 1.12-pre2

This commit is contained in:
md_5 2017-05-14 12:00:00 +10:00
parent 6e3cec8bc7
commit 5195487ec6
210 changed files with 2280 additions and 1974 deletions

View File

@ -30,3 +30,5 @@ If you submit a PR involving both Bukkit and CraftBukkit, it's appreciated if ea
entity.k.get(i).f(); // PAIL pathfinders, navigateToHome
```
Also, make sure to include `// Craftbukkit` comments to indicate modified NMS sources.
Although the minimum requirement for compilation & usage is Java 8, we prefer all contributions to be written in Java 7 style code unless there is a compelling reason otherwise.

View File

@ -0,0 +1,10 @@
--- a/net/minecraft/server/Advancement.java
+++ b/net/minecraft/server/Advancement.java
@@ -24,6 +24,7 @@
private final String[][] f;
private final Set<Advancement> g = Sets.newLinkedHashSet();
private final IChatBaseComponent h;
+ public final org.bukkit.advancement.Advancement bukkit = new org.bukkit.craftbukkit.advancement.CraftAdvancement(this); // CraftBukkit
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring) {
this.d = minecraftkey;

View File

@ -0,0 +1,68 @@
--- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -29,7 +29,7 @@
private static final Logger a = LogManager.getLogger();
private static final Gson b = (new GsonBuilder()).registerTypeAdapter(AdvancementProgress.class, new AdvancementProgress.a()).registerTypeAdapter(MinecraftKey.class, new MinecraftKey.a()).setPrettyPrinting().create();
- private static final TypeToken<Map<MinecraftKey, AdvancementProgress>> c = new TypeToken() {
+ private static final TypeToken<Map<MinecraftKey, AdvancementProgress>> c = new TypeToken<Map<MinecraftKey, AdvancementProgress>>() { // CraftBukkit - decompile error
};
private final MinecraftServer d;
private final File e;
@@ -68,7 +68,7 @@
this.g.clear();
this.h.clear();
this.i.clear();
- this.k = true;
+ // this.k = true; // CraftBukkit - don't change flag on reload
this.g();
}
@@ -88,7 +88,7 @@
Iterator iterator = this.data.entrySet().iterator();
while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
+ Entry<Advancement, AdvancementProgress> entry = (Entry) iterator.next(); // CraftBukkit - decompile error
if (((AdvancementProgress) entry.getValue()).isDone()) {
arraylist.add(entry.getKey());
@@ -124,13 +124,15 @@
if (this.e.isFile()) {
try {
String s = Files.toString(this.e, StandardCharsets.UTF_8);
- Map map = (Map) ChatDeserializer.a(AdvancementDataPlayer.b, s, AdvancementDataPlayer.c.getType());
+ // CraftBukkit start
+ Map<MinecraftKey, AdvancementProgress> map = (Map) ChatDeserializer.a(AdvancementDataPlayer.b, s, AdvancementDataPlayer.c.getType());
if (map == null) {
throw new JsonParseException("Found null for advancements");
}
- Stream stream = map.entrySet().stream().sorted(Comparator.comparing(apply<invokedynamic>()));
+ Stream stream = map.entrySet().stream().sorted(Comparator.comparing(Entry::getValue));
+ // CraftBukkit end
Iterator iterator = ((List) stream.collect(Collectors.toList())).iterator();
while (iterator.hasNext()) {
@@ -138,7 +140,11 @@
Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey());
if (advancement == null) {
- AdvancementDataPlayer.a.warn("Ignored advancement \'" + entry.getKey() + "\' in progress file " + this.e + " - it doesn\'t exist anymore?");
+ // CraftBukkit start
+ if (((MinecraftKey) entry.getKey()).b().equals("minecraft")) {
+ AdvancementDataPlayer.a.warn("Ignored advancement \'" + entry.getKey() + "\' in progress file " + this.e + " - it doesn\'t exist anymore?");
+ }
+ // CraftBukkit end
} else {
this.a(advancement, (AdvancementProgress) entry.getValue());
}
@@ -190,6 +196,7 @@
this.i.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {
+ this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
advancement.d().a(this.player);
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean("announceAdvancements")) {
this.d.getPlayerList().sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[] { this.player.getScoreboardDisplayName(), advancement.j()}));

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/server/Advancements.java
+++ b/net/minecraft/server/Advancements.java
@@ -71,7 +71,7 @@
}
}
- Advancements.a.info("Loaded " + this.advancements.size() + " advancements");
+ // Advancements.a.info("Loaded " + this.b.size() + " advancements"); // CraftBukkit - moved to AdvancementDataWorld#reload
}
public void a() {

View File

@ -9,7 +9,7 @@
}
public static int getCombinedId(IBlockData iblockdata) {
@@ -334,7 +334,8 @@
@@ -343,7 +343,8 @@
int j = this.getDropCount(i, world.random);
for (int k = 0; k < j; ++k) {
@ -19,7 +19,7 @@
Item item = this.getDropType(iblockdata, world.random, i);
if (item != Items.a) {
@@ -896,7 +897,7 @@
@@ -923,7 +924,7 @@
if (hashset.contains(block16)) {
for (int i = 0; i < 15; ++i) {
@ -28,7 +28,7 @@
Block.REGISTRY_ID.a(block16.fromLegacyData(i), j);
}
@@ -905,7 +906,7 @@
@@ -932,7 +933,7 @@
while (unmodifiableiterator.hasNext()) {
IBlockData iblockdata = (IBlockData) unmodifiableiterator.next();
@ -37,7 +37,7 @@
Block.REGISTRY_ID.a(iblockdata, k);
}
@@ -914,6 +915,12 @@
@@ -941,6 +942,12 @@
}

View File

@ -12,7 +12,7 @@
public abstract class BlockButtonAbstract extends BlockDirectional {
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
@@ -123,6 +128,19 @@
@@ -126,6 +131,19 @@
if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
return true;
} else {
@ -32,7 +32,7 @@
world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3);
world.b(blockposition, blockposition);
this.a(entityhuman, world, blockposition);
@@ -164,6 +182,16 @@
@@ -167,6 +185,16 @@
if (this.I) {
this.d(iblockdata, world, blockposition);
} else {
@ -49,7 +49,7 @@
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
this.b(world, blockposition);
@@ -189,7 +217,41 @@
@@ -192,7 +220,41 @@
boolean flag = !list.isEmpty();
boolean flag1 = ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue();
@ -91,7 +91,7 @@
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)));
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
world.b(blockposition, blockposition);
@@ -197,6 +259,16 @@
@@ -200,6 +262,16 @@
}
if (!flag && flag1) {

View File

@ -39,7 +39,7 @@
- this.a(world, blockposition, iblockdata, 3);
+ // this.a(world, blockposition, iblockdata, 3);
+ // CraftBukkit end
world.a((EntityHuman) null, blockposition, SoundEffects.N, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.Q, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
return true;
@ -59,7 +59,7 @@
- this.a(world, blockposition, iblockdata, 0);
+ // this.a(world, blockposition, iblockdata, 0);
+ // CraftBukkit end
world.a((EntityHuman) null, blockposition, SoundEffects.P, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.S, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -92,6 +108,10 @@
@ -76,7 +76,7 @@
@@ -106,12 +126,17 @@
}
world.a((EntityHuman) null, blockposition, SoundEffects.K, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.N, SoundCategory.BLOCKS, 1.0F, 1.0F);
- this.a(world, blockposition, iblockdata, i - 1);
+ // this.a(world, blockposition, iblockdata, i - 1);
+ // CraftBukkit end
@ -95,7 +95,7 @@
@@ -122,7 +147,8 @@
}
world.a((EntityHuman) null, blockposition, SoundEffects.J, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.M, SoundCategory.BLOCKS, 1.0F, 1.0F);
- this.a(world, blockposition, iblockdata, i + 1);
+ // this.a(world, blockposition, iblockdata, i + 1);
+ // CraftBukkit end

View File

@ -1,38 +1,27 @@
--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
@@ -2,6 +2,8 @@
import java.util.Random;
@@ -4,6 +4,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommand extends BlockTileEntity {
public static final BlockStateDirection a = BlockDirectional.FACING;
@@ -29,7 +31,16 @@
private static final Logger c = LogManager.getLogger();
@@ -30,6 +32,15 @@
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
boolean flag = world.isBlockIndirectlyPowered(blockposition);
boolean flag1 = tileentitycommand.f();
boolean flag2 = tileentitycommand.h();
- if (flag && !flag1) {
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ // CraftBukkit end
+
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
tileentitycommand.a(true);
if (tileentitycommand.k() != TileEntityCommand.Type.SEQUENCE && !flag2) {
boolean flag3 = !tileentitycommand.l() || this.e(world, blockposition, iblockdata);
@@ -40,7 +51,7 @@
this.c(world, blockposition);
}
}
- } else if (!flag && flag1) {
+ } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
tileentitycommand.a(false);
}
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
tileentitycommand.a(flag);
if (!flag1 && !tileentitycommand.h() && tileentitycommand.l() != TileEntityCommand.Type.SEQUENCE) {

View File

@ -12,11 +12,11 @@
@@ -37,6 +39,10 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.aX() && !world.isClientSide && entity.getBoundingBox().c(iblockdata.d(world, blockposition).a(blockposition))) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.bd() && !world.isClientSide && entity.getBoundingBox().c(iblockdata.d(world, blockposition).a(blockposition))) {
+ // 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);
+ // CraftBukkit end
entity.c(1);
entity.b(1);
}

View File

@ -25,7 +25,7 @@
@@ -108,7 +114,7 @@
int i = ((Integer) iblockdata.get(BlockFire.AGE)).intValue();
if (!flag && world.W() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
if (!flag && world.Y() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
- world.setAir(blockposition);
+ fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain
} else {
@ -103,7 +103,7 @@
- private void a(World world, BlockPosition blockposition, int i, Random random, int j) {
+ private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
int k = this.c(world.getType(blockposition).getBlock());
int k = this.e(world.getType(blockposition).getBlock());
if (random.nextInt(i) < k) {
IBlockData iblockdata = world.getType(blockposition);
@ -141,9 +141,9 @@
} else {
world.a(blockposition, (Block) this, this.a(world) + world.random.nextInt(10));
}
@@ -306,4 +345,12 @@
protected BlockStateList getStateList() {
return new BlockStateList(this, new IBlockState[] { BlockFire.AGE, BlockFire.NORTH, BlockFire.EAST, BlockFire.SOUTH, BlockFire.WEST, BlockFire.UPPER});
@@ -310,4 +349,12 @@
public EnumBlockFaceShape a(IBlockAccess iblockaccess, IBlockData iblockdata, BlockPosition blockposition, EnumDirection enumdirection) {
return EnumBlockFaceShape.UNDEFINED;
}
+
+ // CraftBukkit start

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockFluids.java
+++ b/net/minecraft/server/BlockFluids.java
@@ -163,14 +163,20 @@
@@ -175,14 +175,20 @@
Integer integer = (Integer) iblockdata.get(BlockFluids.LEVEL);
if (integer.intValue() == 0) {

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockJukeBox.java
+++ b/net/minecraft/server/BlockJukeBox.java
@@ -143,6 +143,11 @@
@@ -141,6 +141,11 @@
}
public void setRecord(ItemStack itemstack) {

View File

@ -42,12 +42,12 @@
}
}
- if (!flag1 && iblockdata1.getMaterial() != Material.AIR && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
+ if (!flag1 && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
- if (!flag1 && iblockdata1.getMaterial() != Material.AIR && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
+ if (!flag1 && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
this.a(world, blockposition, enumdirection, false);
}
} else {
@@ -274,6 +298,48 @@
@@ -277,6 +301,48 @@
int j = list.size() + list1.size();
IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();

View File

@ -19,7 +19,7 @@
+ Entity entity = ItemMonsterEgg.spawnCreature(world, EntityTypes.getName(EntityPigZombie.class), (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.aE();
entity.portalCooldown = entity.aK();
@@ -70,14 +74,16 @@
BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X);
@ -44,7 +44,7 @@
@@ -108,6 +114,10 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.aX()) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.bd()) {
+ // 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);
@ -52,7 +52,7 @@
entity.e(blockposition);
}
@@ -212,6 +222,7 @@
@@ -216,6 +226,7 @@
private BlockPosition position;
private int height;
private int width;
@ -60,7 +60,7 @@
public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
this.a = world;
@@ -270,6 +281,10 @@
@@ -274,6 +285,10 @@
}
protected int c() {
@ -71,7 +71,7 @@
int i;
label56:
@@ -290,11 +305,21 @@
@@ -294,11 +309,21 @@
block = this.a.getType(blockposition.shift(this.d)).getBlock();
if (block != Blocks.OBSIDIAN) {
break label56;
@ -93,7 +93,7 @@
}
}
}
@@ -304,6 +329,11 @@
@@ -308,6 +333,11 @@
if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
this.height = 0;
break;
@ -105,7 +105,7 @@
}
}
@@ -325,7 +355,27 @@
@@ -329,7 +359,27 @@
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
@ -134,7 +134,7 @@
for (int i = 0; i < this.width; ++i) {
BlockPosition blockposition = this.position.shift(this.c, i);
@@ -334,6 +384,7 @@
@@ -338,6 +388,7 @@
}
}

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/server/BlockPumpkin.java
+++ b/net/minecraft/server/BlockPumpkin.java
@@ -3,6 +3,12 @@
import com.google.common.base.Predicate;
@@ -4,6 +4,12 @@
import java.util.Iterator;
import javax.annotation.Nullable;
+// CraftBukkit start
@ -13,8 +13,8 @@
public class BlockPumpkin extends BlockFacingHorizontal {
private ShapeDetector snowGolemPart;
@@ -40,18 +46,25 @@
int i;
@@ -43,18 +49,25 @@
EntityPlayer entityplayer;
int j;
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
@ -38,10 +38,10 @@
+ // CraftBukkit start
+ if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
+ blockList.updateList();
iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator();
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]);
@@ -62,12 +75,17 @@
while (iterator.hasNext()) {
@@ -71,12 +84,17 @@
world.update(shapedetectorblock1.getPosition(), Blocks.AIR, false);
}
@ -60,7 +60,7 @@
}
}
@@ -76,7 +94,9 @@
@@ -85,7 +103,9 @@
entityirongolem.setPlayerCreated(true);
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
@ -68,10 +68,10 @@
+ // CraftBukkit start
+ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ blockList.updateList();
iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator();
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]);
@@ -90,6 +110,7 @@
while (iterator.hasNext()) {
@@ -105,6 +125,7 @@
}
}
}

View File

@ -43,7 +43,7 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
if (this.a(world, blockposition, true)) {
world.a((EntityHuman) null, blockposition, SoundEffects.fl, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
world.a((EntityHuman) null, blockposition, SoundEffects.gm, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
@@ -114,6 +133,15 @@
}
}

View File

@ -1,16 +1,7 @@
--- a/net/minecraft/server/BlockShulkerBox.java
+++ b/net/minecraft/server/BlockShulkerBox.java
@@ -3,7 +3,7 @@
public class BlockShulkerBox extends BlockTileEntity {
@@ -92,7 +92,32 @@
public static final BlockStateEnum<EnumDirection> a = BlockStateDirection.of("facing");
- private final EnumColor b;
+ public final EnumColor b; // PAIL: public, rename
public BlockShulkerBox(EnumColor enumcolor) {
super(Material.STONE, MaterialMapColor.b);
@@ -89,7 +89,32 @@
tileentityshulkerbox.d(entityhuman);
}
- public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {}
@ -30,7 +21,7 @@
+ itemstack.setTag(nbttagcompound);
+ if (tileentityshulkerbox.hasCustomName()) {
+ itemstack.g(tileentityshulkerbox.getName());
+ tileentityshulkerbox.a("");
+ tileentityshulkerbox.setCustomName("");
+ }
+
+ a(world, blockposition, itemstack);
@ -43,7 +34,7 @@
public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) {
if (itemstack.hasName()) {
@@ -105,7 +130,7 @@
@@ -108,7 +133,7 @@
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
TileEntity tileentity = world.getTileEntity(blockposition);
@ -52,7 +43,7 @@
TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox) tileentity;
if (!tileentityshulkerbox.r() && tileentityshulkerbox.F()) {
@@ -123,8 +148,8 @@
@@ -126,8 +151,8 @@
a(world, blockposition, itemstack);
}

View File

@ -95,17 +95,17 @@
}
@@ -157,14 +199,16 @@
entitywither.o();
Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().g(50.0D)).iterator();
entitywither.p();
Iterator iterator = world.a(EntityPlayer.class, entitywither.getBoundingBox().g(50.0D)).iterator();
+ // CraftBukkit start
+ if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ blockList.updateList();
+
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
entityhuman.b((Statistic) AchievementList.I);
CriterionTriggers.m.a(entityplayer, (Entity) entitywither);
}
- world.addEntity(entitywither);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockSnow.java
+++ b/net/minecraft/server/BlockSnow.java
@@ -81,6 +81,11 @@
@@ -91,6 +91,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {

View File

@ -9,7 +9,7 @@
public class BlockTripwireHook extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -155,6 +157,17 @@
@@ -159,6 +161,17 @@
this.a(world, blockposition1, flag4, flag5, flag2, flag3);
}

View File

@ -9,7 +9,7 @@
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockStateBoolean.of("up");
@@ -174,7 +176,13 @@
@@ -176,7 +178,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 @@
}
}
@@ -196,17 +204,29 @@
@@ -198,17 +206,29 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection2);
BlockPosition blockposition4 = blockposition2.shift(enumdirection3);
@ -32,34 +32,34 @@
+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ());
+
if (flag2 && this.z(world.getType(blockposition3))) {
if (flag2 && this.a(world, blockposition3.shift(enumdirection2), enumdirection2)) {
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true))));
} else if (flag3 && this.z(world.getType(blockposition4))) {
} else if (flag3 && this.a(world, blockposition4.shift(enumdirection3), enumdirection3)) {
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true))));
} else if (flag2 && world.isEmpty(blockposition3) && this.z(world.getType(blockposition.shift(enumdirection2)))) {
} else if (flag2 && world.isEmpty(blockposition3) && this.a(world, blockposition3, enumdirection)) {
- world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
+ // world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
+ bukkitBlock = world.getWorld().getBlockAt(blockposition3.getX(), blockposition3.getY(), blockposition3.getZ());
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
} else if (flag3 && world.isEmpty(blockposition4) && this.z(world.getType(blockposition.shift(enumdirection3)))) {
} else if (flag3 && world.isEmpty(blockposition4) && this.a(world, blockposition4, enumdirection)) {
- world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
+ // world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
+ bukkitBlock = world.getWorld().getBlockAt(blockposition4.getX(), blockposition4.getY(), blockposition4.getZ());
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
} else if (this.z(world.getType(blockposition2.up()))) {
} else if (this.a(world, blockposition2.up(), EnumDirection.DOWN)) {
- world.setTypeAndData(blockposition2, this.getBlockData(), 2);
+ // world.setTypeAndData(blockposition2, this.getBlockData(), 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData()));
}
+ // CraftBukkit end
} else if (block.material.k() && iblockdata2.h()) {
} else if (iblockdata2.d(world, blockposition2, enumdirection) == EnumBlockFaceShape.SOLID) {
world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2);
}
@@ -233,7 +253,12 @@
@@ -235,7 +255,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()) {

View File

@ -201,6 +201,6 @@
+ BlockSand.instaFall = false;
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
+ // CraftBukkit end
this.e();
this.markDirty();
}

View File

@ -22,7 +22,7 @@
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
+ loader = (ChunkRegionLoader) this.chunkLoader;
+ }
+ if (loader != null && loader.a(i, j)) {
+ if (loader != null && loader.chunkExists(i, j)) {
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
+ }
+ }
@ -72,7 +72,7 @@
+
+ }
+ // We can only use the queue for already generated chunks
+ if (chunk == null && loader != null && loader.a(i, j)) {
+ if (chunk == null && loader != null && loader.chunkExists(i, j)) {
+ if (runnable != null) {
+ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
+ return null;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java
@@ -29,25 +29,41 @@
@@ -29,19 +29,35 @@
this.e = dataconvertermanager;
}
@ -39,13 +39,6 @@
}
return this.a(world, i, j, nbttagcompound);
}
- public boolean a(int i, int j) {
+ public boolean a(int i, int j) { // PAIL chunkExists (also in IChunkLoader)
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
@@ -55,7 +71,7 @@
}
@ -53,10 +46,10 @@
- protected Chunk a(World world, int i, int j, NBTTagCompound nbttagcompound) {
+ protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", new Object[] { Integer.valueOf(i), Integer.valueOf(j)});
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j));
return null;
@@ -72,10 +88,28 @@
ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", new Object[] { Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(chunk.locX), Integer.valueOf(chunk.locZ)});
ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(chunk.locX), Integer.valueOf(chunk.locZ));
nbttagcompound1.setInt("xPos", i);
nbttagcompound1.setInt("zPos", j);
+
@ -88,14 +81,14 @@
@@ -106,20 +140,27 @@
}
public boolean c() {
public boolean a() {
- if (this.b.isEmpty()) {
+ // CraftBukkit start
+ Iterator<Map.Entry<ChunkCoordIntPair, NBTTagCompound>> iter = this.b.entrySet().iterator();
+ if (!iter.hasNext()) {
+ // CraftBukkit end
if (this.f) {
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", new Object[] { this.d.getName()});
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.d.getName());
}
return false;
@ -133,7 +126,7 @@
public void b(World world, Chunk chunk) throws IOException {}
@@ -157,6 +202,7 @@
if (this.c()) {
if (this.a()) {
continue;
}
+ break; // CraftBukkit - Fix infinite loop when saving chunks
@ -198,6 +191,6 @@
+ public static void a(Entity entity, World world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ if (world.addEntity(entity, reason) && entity.isVehicle()) {
+ // CraftBukkit end
Iterator iterator = entity.bx().iterator();
Iterator iterator = entity.bD().iterator();
while (iterator.hasNext()) {

View File

@ -14,26 +14,26 @@
public abstract class CommandBlockListenerAbstract implements ICommandListener {
private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss");
@@ -13,6 +20,7 @@
private String e = "";
private String f = "@";
private final CommandObjectiveExecutor g = new CommandObjectiveExecutor();
@@ -15,6 +22,7 @@
private String g = "";
private String h = "@";
private final CommandObjectiveExecutor i = new CommandObjectiveExecutor();
+ protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender
public CommandBlockListenerAbstract() {}
@@ -92,7 +100,9 @@
try {
this.d = null;
- this.b = icommandhandler.a(this, this.e);
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
+ this.b = executeSafely(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");
@@ -124,6 +134,138 @@
@@ -107,7 +115,9 @@
if (minecraftserver != null && minecraftserver.M() && minecraftserver.getEnableCommandBlock()) {
try {
this.f = null;
- this.d = minecraftserver.getCommandHandler().b(this, this.g);
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
+ this.d = executeSafely(this, sender, this.g);
+ // CraftBukkit end
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -149,6 +159,138 @@
}
}
@ -170,5 +170,5 @@
+ // CraftBukkit end
+
public String getName() {
return this.f;
return this.h;
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandDebug.java
+++ b/net/minecraft/server/CommandDebug.java
@@ -32,6 +32,14 @@
@@ -34,6 +34,14 @@
}
public void execute(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring) throws CommandException {
@ -15,7 +15,7 @@
if (astring.length < 1) {
throw new ExceptionUsage("commands.debug.usage", new Object[0]);
} else {
@@ -140,6 +148,13 @@
@@ -142,6 +150,13 @@
}
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {

View File

@ -11,7 +11,7 @@
public class CommandExecute extends CommandAbstract {
@@ -58,7 +62,10 @@
@@ -59,7 +63,10 @@
}
String s = a(astring, b0);
@ -23,15 +23,15 @@
public String getName() {
return entity.getName();
}
@@ -103,25 +110,59 @@
return entity.B_();
@@ -104,25 +111,59 @@
return entity.C_();
}
};
+ ICommandListener icommandlistener1 = new ProxyListener(); // CraftBukkit
ICommandHandler icommandhandler = minecraftserver.getCommandHandler();
try {
- int i = icommandhandler.a(icommandlistener1, s);
- int i = icommandhandler.b(icommandlistener1, s);
+ // CraftBukkit start
+ org.bukkit.command.CommandSender sender = null;
+ ICommandListener listener = icommandlistener;

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
@@ -28,6 +28,12 @@
EntityPlayer entityplayer = astring.length >= 2 ? a(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener);
EntityPlayer entityplayer = astring.length >= 2 ? b(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener);
entityplayer.a(enumgamemode);
+ // CraftBukkit start - handle event cancelling the change

View File

@ -2,7 +2,7 @@
+++ b/net/minecraft/server/CommandTp.java
@@ -53,17 +53,11 @@
} else {
Entity entity = b(minecraftserver, icommandlistener, astring[astring.length - 1]);
Entity entity = c(minecraftserver, icommandlistener, astring[astring.length - 1]);
- if (entity.world != ((Entity) object).world) {
- throw new CommandException("commands.tp.notSameDimension", new Object[0]);
@ -28,7 +28,7 @@
entity.stopRiding();
- ((EntityPlayer) entity).playerConnection.a(commandabstract_commandnumber.b(), commandabstract_commandnumber1.b(), commandabstract_commandnumber2.b(), f, f1, enumset);
+ ((EntityPlayer) entity).playerConnection.a(commandabstract_commandnumber.b(), commandabstract_commandnumber1.b(), commandabstract_commandnumber2.b(), f, f1, enumset, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
entity.h(f);
entity.setHeadRotation(f);
} else {
float f2 = (float) MathHelper.g(commandabstract_commandnumber3.a());
@@ -126,10 +120,17 @@

View File

@ -52,9 +52,11 @@
- slot1.set(itemstack4);
+ // slot1.set(itemstack4);
+ draggedSlots.put(slot1.rawSlotIndex, itemstack4); // CraftBukkit - Put in map instead of setting
+ }
+ }
+
}
}
- itemstack2.setCount(l);
- playerinventory.setCarried(itemstack2);
+ // CraftBukkit start - InventoryDragEvent
+ InventoryView view = getBukkitView();
+ org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack2);
@ -83,13 +85,11 @@
+ if (playerinventory.getCarried() != null) {
+ playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor()));
+ needsUpdate = true;
}
+ }
+ } else {
+ playerinventory.setCarried(oldCursor);
}
- itemstack2.setCount(l);
- playerinventory.setCarried(itemstack2);
+ }
+
+ if (needsUpdate && entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).updateInventory(this);
+ }
@ -110,7 +110,7 @@
}
if (j == 1) {
@@ -258,6 +321,15 @@
@@ -254,6 +317,15 @@
}
slot2.f();
@ -126,3 +126,11 @@
}
}
} else if (inventoryclicktype == InventoryClickType.SWAP && j >= 0 && j < 9) {
@@ -575,6 +647,7 @@
inventorycraftresult.a(irecipe);
itemstack = irecipe.craftItem(inventorycrafting);
}
+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, itemstack, getBukkitView(), false); // CraftBukkit
inventorycraftresult.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, itemstack));

View File

@ -11,12 +11,9 @@
public class ContainerAnvil extends Container {
private static final Logger f = LogManager.getLogger();
@@ -20,10 +24,15 @@
private final BlockPosition j;
public int a;
@@ -22,8 +26,13 @@
private int k;
- private String l;
+ public String l; // PAIL: private -> public
public String renameText;
private final EntityHuman m;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
@ -28,43 +25,43 @@
this.j = blockposition;
this.i = world;
this.m = entityhuman;
@@ -117,7 +126,7 @@
@@ -110,7 +119,7 @@
byte b1 = 0;
if (itemstack.isEmpty()) {
- this.g.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.a = 0;
this.levelCost = 0;
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
@@ -140,7 +149,7 @@
@@ -128,7 +137,7 @@
if (itemstack1.f() && itemstack1.getItem().a(itemstack, itemstack2)) {
k = Math.min(itemstack1.i(), itemstack1.k() / 4);
if (k <= 0) {
- this.g.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.a = 0;
this.levelCost = 0;
return;
}
@@ -155,7 +164,7 @@
@@ -143,7 +152,7 @@
this.k = l;
} else {
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.f())) {
- this.g.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.a = 0;
this.levelCost = 0;
return;
}
@@ -245,7 +254,7 @@
@@ -236,7 +245,7 @@
}
if (flag2 && !flag1) {
- this.g.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.a = 0;
this.levelCost = 0;
return;
}
@@ -292,7 +301,7 @@
@@ -283,7 +292,7 @@
EnchantmentManager.a(map, itemstack1);
}
@ -73,7 +70,7 @@
this.b();
}
}
@@ -317,6 +326,7 @@
@@ -301,6 +310,7 @@
}
public boolean a(EntityHuman entityhuman) {
@ -81,7 +78,7 @@
return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
}
@@ -372,4 +382,29 @@
@@ -356,4 +366,29 @@
this.e();
}
@ -94,7 +91,7 @@
+ for (int i = 0; i < this.listeners.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.listeners.get(i);
+
+ icrafting.setContainerData(this, 0, this.a);
+ icrafting.setContainerData(this, 0, this.levelCost);
+ }
+ }
+

View File

@ -106,14 +106,15 @@
this.b();
}
} else {
@@ -176,25 +238,50 @@
@@ -176,25 +238,52 @@
if (!this.world.isClientSide) {
List list = this.a(itemstack, i, this.costs[i]);
- if (!list.isEmpty()) {
- entityhuman.enchantDone(j);
- entityhuman.enchantDone(itemstack, j);
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.enchantDone(itemstack, j); // Moved down
boolean flag = itemstack.getItem() == Items.BOOK;
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
@ -124,11 +125,12 @@
+
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, this.costs[i], enchants, i);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || event.getEnchantsToAdd().isEmpty()) {
+ return false;
+ }
if (flag) {
itemstack = new ItemStack(Items.ENCHANTED_BOOK);
this.enchantSlots.setItem(0, itemstack);
@ -158,14 +160,14 @@
}
}
+ entityhuman.enchantDone(j);
+ entityhuman.enchantDone(itemstack, j);
+ // CraftBukkit end
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1.subtract(j);
if (itemstack1.isEmpty()) {
@@ -229,6 +316,11 @@
@@ -233,12 +322,18 @@
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
@ -175,9 +177,8 @@
+ }
+ // CraftBukkit end
if (!this.world.isClientSide) {
for (int i = 0; i < this.enchantSlots.getSize(); ++i) {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i);
@@ -242,6 +334,7 @@
this.a(entityhuman, entityhuman.world, this.enchantSlots);
}
}
public boolean a(EntityHuman entityhuman) {
@ -185,7 +186,7 @@
return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.d((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
}
@@ -294,4 +387,17 @@
@@ -291,4 +386,17 @@
return itemstack;
}

View File

@ -12,7 +12,7 @@
private static final EnumItemSlot[] h = new EnumItemSlot[] { EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
@@ -7,10 +12,20 @@
public IInventory resultInventory = new InventoryCraftResult();
public InventoryCraftResult resultInventory = new InventoryCraftResult();
public boolean g;
private final EntityHuman owner;
+ // CraftBukkit start
@ -50,32 +50,7 @@
}
public boolean isAllowed(EntityHuman entityhuman) {
@@ -54,11 +69,22 @@
this.a(new Slot(playerinventory, 40, 77, 62) {
});
- this.a((IInventory) this.craftInventory);
+ // this.a((IInventory) this.craftInventory); // CraftBukkit - unneeded since it just sets result slot to empty
}
public void a(IInventory iinventory) {
- this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.owner.world));
+ // this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.owner.world));
+ // CraftBukkit start (Note: the following line would cause an error if called during construction)
+ CraftingManager.getInstance().lastCraftView = getBukkitView();
+ ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.owner.world);
+ this.resultInventory.setItem(0, craftResult);
+ if (super.listeners.size() < 1) {
+ return;
+ }
+
+ EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
+ player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
+ // CraftBukkit end
}
public void b(EntityHuman entityhuman) {
@@ -148,4 +174,17 @@
@@ -141,4 +156,17 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ContainerWorkbench.java
+++ b/net/minecraft/server/ContainerWorkbench.java
@@ -1,13 +1,28 @@
@@ -1,14 +1,29 @@
package net.minecraft.server;
+// CraftBukkit start
@ -11,11 +11,12 @@
public class ContainerWorkbench extends Container {
- public InventoryCrafting craftInventory = new InventoryCrafting(this, 3, 3);
- public IInventory resultInventory = new InventoryCraftResult();
- public InventoryCraftResult resultInventory = new InventoryCraftResult();
+ public InventoryCrafting craftInventory; // CraftBukkit - move initialization into constructor
+ public IInventory resultInventory; // CraftBukkit - move initialization into constructor
+ public InventoryCraftResult resultInventory; // CraftBukkit - move initialization into constructor
private final World g;
private final BlockPosition h;
private final EntityHuman i;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
@ -30,31 +31,8 @@
+ // CraftBukkit end
this.g = world;
this.h = blockposition;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
@@ -35,7 +50,21 @@
}
public void a(IInventory iinventory) {
- this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.g));
+ // this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.g));
+ // CraftBukkit start
+ CraftingManager.getInstance().lastCraftView = getBukkitView();
+ ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.g);
+ this.resultInventory.setItem(0, craftResult);
+ if (super.listeners.size() < 1) {
+ return;
+ }
+ // See CraftBukkit PR #39
+ if (craftResult != null && craftResult.getItem() == Items.FILLED_MAP) {
+ return;
+ }
+ EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
+ player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
+ // CraftBukkit end
}
public void b(EntityHuman entityhuman) {
@@ -53,6 +82,7 @@
this.i = playerinventory.player;
@@ -47,6 +62,7 @@
}
public boolean a(EntityHuman entityhuman) {
@ -62,7 +40,7 @@
return this.g.getType(this.h).getBlock() != Blocks.CRAFTING_TABLE ? false : entityhuman.d((double) this.h.getX() + 0.5D, (double) this.h.getY() + 0.5D, (double) this.h.getZ() + 0.5D) <= 64.0D;
}
@@ -106,4 +136,17 @@
@@ -100,4 +116,17 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}

View File

@ -1,37 +1,6 @@
--- a/net/minecraft/server/CraftingManager.java
+++ b/net/minecraft/server/CraftingManager.java
@@ -9,10 +9,16 @@
import java.util.Iterator;
import java.util.List;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class CraftingManager {
private static final CraftingManager a = new CraftingManager();
public List<IRecipe> recipes = Lists.newArrayList();
+ // CraftBukkit start
+ public IRecipe lastRecipe;
+ public org.bukkit.inventory.InventoryView lastCraftView;
+ // CraftBukkit end
public static CraftingManager getInstance() {
return CraftingManager.a;
@@ -179,7 +185,12 @@
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())});
this.registerShapedRecipe(new ItemStack(Blocks.END_ROD, 4), new Object[] { "/", "#", Character.valueOf('/'), Items.BLAZE_ROD, Character.valueOf('#'), Items.CHORUS_FRUIT_POPPED});
this.registerShapedRecipe(new ItemStack(Blocks.di, 1), new Object[] { "XXX", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Items.DYE, 1, EnumColor.WHITE.getInvColorIndex())});
- Collections.sort(this.recipes, new Comparator() {
+ sort();
+ }
+
+ // CraftBukkit start
+ public void sort() {
+ 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)));
}
@@ -290,13 +301,18 @@
@@ -158,12 +158,14 @@
do {
if (!iterator.hasNext()) {
@ -42,12 +11,31 @@
irecipe = (IRecipe) iterator.next();
} while (!irecipe.a(inventorycrafting, world));
- return irecipe.craftItem(inventorycrafting);
+ // CraftBukkit start - INVENTORY_PRE_CRAFT event
+ inventorycrafting.currentRecipe = irecipe;
+ ItemStack result = irecipe.craftItem(inventorycrafting);
+ return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
+ // CraftBukkit end
+ inventorycrafting.currentRecipe = irecipe; // CraftBukkit
return irecipe.craftItem(inventorycrafting);
}
public NonNullList<ItemStack> b(InventoryCrafting inventorycrafting, World world) {
@@ -175,12 +177,14 @@
do {
if (!iterator.hasNext()) {
+ inventorycrafting.currentRecipe = null; // CraftBukkit - Clear recipe when no recipe is found
return null;
}
irecipe = (IRecipe) iterator.next();
} while (!irecipe.a(inventorycrafting, world));
+ inventorycrafting.currentRecipe = irecipe; // CraftBukkit
return irecipe;
}
@@ -210,7 +214,7 @@
}
public static int a(IRecipe irecipe) {
- return CraftingManager.recipes.a((Object) irecipe);
+ return CraftingManager.recipes.a(irecipe); // CraftBukkit - decompile error
}
@Nullable

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CrashReport.java
+++ b/net/minecraft/server/CrashReport.java
@@ -123,6 +123,7 @@
@@ -125,6 +125,7 @@
return this.a();
}
});

View File

@ -0,0 +1,29 @@
--- a/net/minecraft/server/CustomFunctionData.java
+++ b/net/minecraft/server/CustomFunctionData.java
@@ -31,7 +31,7 @@
}
public World getWorld() {
- return CustomFunctionData.this.c.worldServer[0];
+ return CustomFunctionData.this.c.worlds.get(0); // CraftBukkit
}
public MinecraftServer C_() {
@@ -55,7 +55,7 @@
}
public int c() {
- return this.c.worldServer[0].getGameRules().c("maxCommandChainLength");
+ return this.c.worlds.get(0).getGameRules().c("maxCommandChainLength"); // CraftBukkit
}
public Map<MinecraftKey, CustomFunction> d() {
@@ -63,7 +63,7 @@
}
public void e() {
- String s = this.c.worldServer[0].getGameRules().get("gameLoopFunction");
+ String s = this.c.worlds.get(0).getGameRules().get("gameLoopFunction"); // CraftBukkit
if (!s.equals(this.e)) {
this.e = s;

View File

@ -4,9 +4,9 @@
boolean flag;
if (s1 == null) {
- DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s});
- DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s);
+ // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item)
+ // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s});
+ // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s);
flag = false;
} else {
flag = !nbttagcompound2.hasKey("id");

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DedicatedServer.java
+++ b/net/minecraft/server/DedicatedServer.java
@@ -18,11 +18,21 @@
@@ -19,11 +19,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -23,7 +23,7 @@
private RemoteStatusListener n;
public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
private RemoteControlListener p;
@@ -32,8 +42,10 @@
@@ -33,8 +43,10 @@
private EnumGamemode t;
private boolean u;
@ -36,22 +36,22 @@
Thread thread = new Thread("Server Infinisleeper") {
{
this.setDaemon(true);
@@ -52,16 +64,30 @@
@@ -53,16 +65,30 @@
};
}
- protected boolean init() throws IOException {
+ public boolean init() throws IOException {
+ public boolean init() throws IOException { // CraftBukkit - decompile error
Thread thread = new Thread("Server console handler") {
public void run() {
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.Main.useConsole) {
+ return;
+ }
+ jline.console.ConsoleReader bufferedreader = reader;
+ // CraftBukkit end
+ jline.console.ConsoleReader bufferedreader = reader; // CraftBukkit
String s;
try {
@ -71,7 +71,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -70,6 +96,27 @@
@@ -71,6 +97,27 @@
}
};
@ -98,8 +98,8 @@
+
thread.setDaemon(true);
thread.start();
DedicatedServer.LOGGER.info("Starting minecraft server version 1.11.2");
@@ -78,7 +125,7 @@
DedicatedServer.LOGGER.info("Starting minecraft server version 1.12-pre2");
@@ -79,7 +126,7 @@
}
DedicatedServer.LOGGER.info("Loading properties");
@ -108,7 +108,7 @@
this.r = new EULA(new File("eula.txt"));
if (!this.r.a()) {
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
@@ -135,6 +182,8 @@
@@ -136,6 +183,8 @@
return false;
}
@ -117,16 +117,25 @@
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.");
@@ -149,7 +198,7 @@
@@ -150,7 +199,7 @@
if (!NameReferencingFileConverter.a(this.propertyManager)) {
return false;
} else {
- this.a((PlayerList) (new DedicatedPlayerList(this)));
+ this.convertable = new WorldLoaderServer(server.getWorldContainer(), this.getDataConverterManager()); // CraftBukkit - moved from MinecraftServer constructor
+ this.convertable = new WorldLoaderServer(server.getWorldContainer(), this.dataConverterManager); // CraftBukkit - moved from MinecraftServer constructor
long j = System.nanoTime();
if (this.S() == null) {
@@ -207,7 +256,18 @@
@@ -198,7 +247,7 @@
DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\" or \"?\"", s3);
if (this.propertyManager.a("announce-player-achievements")) {
- this.worldServer[0].getGameRules().set("announceAdvancements", this.propertyManager.getBoolean("announce-player-achievements", true) ? "true" : "false");
+ this.worlds.get(0).getGameRules().set("announceAdvancements", this.propertyManager.getBoolean("announce-player-achievements", true) ? "true" : "false"); // CraftBukkit
this.propertyManager.b("announce-player-achievements");
this.propertyManager.savePropertiesFile();
}
@@ -213,7 +262,18 @@
DedicatedServer.LOGGER.info("Starting remote control listener");
this.p = new RemoteControlListener(this);
this.p.a();
@ -143,9 +152,9 @@
}
+ // CraftBukkit end
if (this.aQ() > 0L) {
if (this.aT() > 0L) {
Thread thread1 = new Thread(new ThreadWatchdog(this));
@@ -292,11 +352,11 @@
@@ -298,11 +358,11 @@
return crashreport;
}
@ -157,26 +166,26 @@
- protected void D() {
+ public void D() { // CraftBukkit - fix decompile error
super.D();
this.aM();
this.aP();
}
@@ -327,7 +387,15 @@
@@ -333,7 +393,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
- this.getCommandHandler().a(servercommand.source, servercommand.command);
- this.getCommandHandler().b(servercommand.source, servercommand.command);
+ // CraftBukkit start - ServerCommand for preprocessing
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
+ server.getPluginManager().callEvent(event);
+ if (event.isCancelled()) continue;
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source);
+
+ // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
+ // this.getCommandHandler().b(servercommand.source, servercommand.command); // Called in dispatchServerCommand
+ server.dispatchServerCommand(console, servercommand);
+ // CraftBukkit end
}
}
@@ -534,16 +602,70 @@
@@ -536,16 +604,70 @@
}
public String getPlugins() {
@ -197,17 +206,17 @@
+ if (i > 0) {
+ result.append("; ");
+ }
- public String executeRemoteCommand(String s) {
- this.remoteControlCommandListener.clearMessages();
- this.b.a(this.remoteControlCommandListener, s);
- return this.remoteControlCommandListener.getMessages();
+
+ result.append(plugins[i].getDescription().getName());
+ result.append(" ");
+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
+ }
+ }
+
- public String executeRemoteCommand(String s) {
- this.remoteControlCommandListener.clearMessages();
- this.b.b(this.remoteControlCommandListener, s);
- return this.remoteControlCommandListener.getMessages();
+ return result.toString();
+ // CraftBukkit end
+ }
@ -243,7 +252,7 @@
}
public PlayerList getPlayerList() {
return this.aN();
return this.aQ();
}
+
+ // CraftBukkit start

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DispenserRegistry.java
+++ b/net/minecraft/server/DispenserRegistry.java
@@ -7,6 +7,15 @@
@@ -8,6 +8,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -16,7 +16,7 @@
public class DispenserRegistry {
public static final PrintStream a = System.out;
@@ -69,7 +78,7 @@
@@ -70,7 +79,7 @@
BlockDispenser.REGISTRY.a(Items.SPLASH_POTION, new IDispenseBehavior() {
public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) {
return (new DispenseBehaviorProjectile() {
@ -25,7 +25,7 @@
return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack());
}
@@ -86,7 +95,7 @@
@@ -87,7 +96,7 @@
BlockDispenser.REGISTRY.a(Items.LINGERING_POTION, new IDispenseBehavior() {
public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) {
return (new DispenseBehaviorProjectile() {
@ -34,7 +34,7 @@
return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack());
}
@@ -106,14 +115,46 @@
@@ -107,14 +116,46 @@
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
double d1 = (double) ((float) (isourceblock.getBlockPosition().getY() + enumdirection.getAdjacentY()) + 0.2F);
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
@ -83,7 +83,7 @@
return itemstack;
}
});
@@ -123,10 +164,39 @@
@@ -124,10 +165,39 @@
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
@ -125,7 +125,7 @@
return itemstack;
}
@@ -147,8 +217,38 @@
@@ -148,8 +218,38 @@
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
@ -166,7 +166,7 @@
return itemstack;
}
@@ -169,7 +269,53 @@
@@ -170,7 +270,53 @@
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
@ -221,7 +221,7 @@
}
};
@@ -196,6 +342,30 @@
@@ -197,6 +343,30 @@
item = Items.LAVA_BUCKET;
}
@ -252,7 +252,7 @@
world.setAir(blockposition);
itemstack.subtract(1);
if (itemstack.isEmpty()) {
@@ -213,14 +383,42 @@
@@ -214,14 +384,42 @@
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
@ -285,12 +285,12 @@
if (world.isEmpty(blockposition)) {
- world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
- if (itemstack.isDamaged(1, world.random)) {
- if (itemstack.isDamaged(1, world.random, (EntityPlayer) null)) {
- itemstack.setCount(0);
+ // 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)) {
+ if (itemstack.isDamaged(1, world.random, (EntityPlayer) null)) {
+ itemstack.setCount(0);
+ }
}
@ -298,7 +298,7 @@
} 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);
@@ -238,6 +436,32 @@
@@ -239,6 +437,32 @@
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
@ -331,7 +331,7 @@
if (ItemDye.a(itemstack, world, blockposition)) {
if (!world.isClientSide) {
world.triggerEffect(2005, blockposition, 0);
@@ -245,6 +469,26 @@
@@ -246,6 +470,26 @@
} else {
this.b = false;
}
@ -358,7 +358,7 @@
return itemstack;
} else {
@@ -256,11 +500,40 @@
@@ -257,11 +501,40 @@
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
@ -395,13 +395,13 @@
+ // CraftBukkit end
world.addEntity(entitytntprimed);
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gV, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.hW, SoundCategory.BLOCKS, 1.0F, 1.0F);
- itemstack.subtract(1);
+ // itemstack.subtract(1); // CraftBukkit - handled above
return itemstack;
}
});
@@ -271,6 +544,30 @@
@@ -272,6 +545,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
BlockSkull blockskull = Blocks.SKULL;
@ -432,7 +432,7 @@
this.b = true;
if (world.isEmpty(blockposition) && blockskull.b(world, blockposition, itemstack)) {
if (!world.isClientSide) {
@@ -319,6 +616,30 @@
@@ -320,6 +617,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
BlockPumpkin blockpumpkin = (BlockPumpkin) Blocks.PUMPKIN;
@ -463,7 +463,7 @@
this.b = true;
if (world.isEmpty(blockposition) && blockpumpkin.b(world, blockposition)) {
if (!world.isClientSide) {
@@ -388,6 +709,30 @@
@@ -403,6 +724,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
@ -494,7 +494,7 @@
this.b = world.a(block, blockposition, false, EnumDirection.DOWN, (Entity) null);
if (this.b) {
EnumDirection enumdirection1 = world.isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
@@ -456,12 +801,40 @@
@@ -471,12 +816,40 @@
d3 = 0.0D;
}

View File

@ -49,17 +49,17 @@
private static final Logger a = LogManager.getLogger();
private static final List<ItemStack> b = Collections.emptyList();
private static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -101,6 +141,9 @@
private boolean aH;
private double[] aI;
private long aJ;
@@ -102,6 +142,9 @@
private boolean aI;
private final double[] aJ;
private long aK;
+ public boolean valid; // CraftBukkit
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
+ public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
public Entity(World world) {
this.id = Entity.entityCount++;
@@ -206,6 +249,33 @@
@@ -208,6 +251,33 @@
}
protected void setYawPitch(float f, float f1) {
@ -93,8 +93,8 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -228,6 +298,51 @@
this.U();
@@ -230,6 +300,51 @@
this.Y();
}
+ // CraftBukkit start
@ -107,11 +107,11 @@
+
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit
+ if (!this.isPassenger()) {
+ int i = this.V();
+ int i = this.Z();
+
+ if (this.al++ >= i) {
+ this.al = i;
+ this.portalCooldown = this.aE();
+ this.portalCooldown = this.aK();
+ byte b0;
+
+ if (this.world.worldProvider.getDimensionManager().getDimensionID() == -1) {
@ -120,7 +120,7 @@
+ b0 = -1;
+ }
+
+ this.c(b0);
+ this.b(b0);
+ }
+ }
+
@ -136,16 +136,16 @@
+ }
+ }
+
+ this.H();
+ this.I();
+ this.world.methodProfiler.b();
+ }
+ }
+ // CraftBukkit end
+
public void U() {
public void Y() {
this.world.methodProfiler.a("entityBaseTick");
if (this.isPassenger() && this.bB().dead) {
@@ -244,12 +359,14 @@
if (this.isPassenger() && this.bH().dead) {
@@ -246,6 +361,8 @@
this.lastZ = this.locZ;
this.lastPitch = this.pitch;
this.lastYaw = this.yaw;
@ -154,22 +154,15 @@
if (!this.world.isClientSide && this.world instanceof WorldServer) {
this.world.methodProfiler.a("portal");
if (this.ak) {
MinecraftServer minecraftserver = this.world.getMinecraftServer();
- if (minecraftserver.getAllowNether()) {
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit
if (!this.isPassenger()) {
int i = this.V();
@@ -283,6 +400,7 @@
this.H();
@@ -285,6 +402,7 @@
this.I();
this.world.methodProfiler.b();
}
+ */
this.am();
this.ak();
@@ -334,6 +452,27 @@
this.as();
this.aq();
@@ -336,6 +454,27 @@
protected void burnFromLava() {
if (!this.fireProof) {
this.damageEntity(DamageSource.LAVA, 4.0F);
@ -197,7 +190,7 @@
this.setOnFire(15);
}
}
@@ -374,6 +513,22 @@
@@ -376,6 +515,22 @@
this.a(this.getBoundingBox().d(d0, d1, d2));
this.recalcPosition();
} else {
@ -220,7 +213,7 @@
if (enummovetype == EnumMoveType.PISTON) {
long i = this.world.getTime();
@@ -515,7 +670,7 @@
@@ -517,7 +672,7 @@
}
}
@ -229,7 +222,7 @@
double d11;
if (this.P > 0.0F && flag && (d7 != d0 || d9 != d2)) {
@@ -613,7 +768,7 @@
@@ -615,7 +770,7 @@
this.world.methodProfiler.a("rest");
this.recalcPosition();
this.positionChanged = d7 != d0 || d9 != d2;
@ -238,7 +231,7 @@
this.onGround = this.B && d8 < 0.0D;
this.C = this.positionChanged || this.B;
l = MathHelper.floor(this.locX);
@@ -648,6 +803,28 @@
@@ -650,6 +805,28 @@
block1.a(this.world, this);
}
@ -267,7 +260,7 @@
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
double d22 = this.locX - d4;
double d23 = this.locY - d5;
@@ -681,6 +858,8 @@
@@ -685,6 +862,8 @@
}
}
@ -276,16 +269,16 @@
try {
this.checkBlockCollisions();
} catch (Throwable throwable) {
@@ -690,6 +869,8 @@
@@ -694,6 +873,8 @@
this.appendEntityCrashDetails(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
+ */
+ // CraftBukkit end
boolean flag1 = this.ai();
boolean flag1 = this.an();
@@ -698,7 +879,14 @@
@@ -702,7 +883,14 @@
if (!flag1) {
++this.fireTicks;
if (this.fireTicks == 0) {
@ -301,7 +294,7 @@
}
}
} else if (this.fireTicks <= 0) {
@@ -819,7 +1007,7 @@
@@ -834,7 +1022,7 @@
return null;
}
@ -310,7 +303,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
@@ -987,6 +1175,13 @@
@@ -1008,6 +1196,13 @@
}
public void spawnIn(World world) {
@ -324,7 +317,7 @@
this.world = world;
}
@@ -1219,6 +1414,18 @@
@@ -1245,6 +1440,18 @@
try {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
@ -343,7 +336,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1228,6 +1435,12 @@
@@ -1254,6 +1461,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -356,24 +349,24 @@
if (this.hasCustomName()) {
nbttagcompound.setString("CustomName", this.getCustomName());
}
@@ -1303,6 +1516,8 @@
this.motX = nbttaglist1.e(0);
this.motY = nbttaglist1.e(1);
this.motZ = nbttaglist1.e(2);
@@ -1329,6 +1542,8 @@
this.motX = nbttaglist1.f(0);
this.motY = nbttaglist1.f(1);
this.motZ = nbttaglist1.f(2);
+
+ /* CraftBukkit start - Moved section down
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
@@ -1314,6 +1529,7 @@
@@ -1340,6 +1555,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
+ // CraftBukkit end */
this.locX = nbttaglist.e(0);
this.locY = nbttaglist.e(1);
@@ -1371,6 +1587,58 @@
this.locX = nbttaglist.f(0);
this.locY = nbttaglist.f(1);
@@ -1397,6 +1613,58 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@ -432,7 +425,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1438,6 +1706,12 @@
@@ -1464,6 +1732,12 @@
if (itemstack.isEmpty()) {
return null;
} else {
@ -445,8 +438,8 @@
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.q();
@@ -1563,6 +1837,24 @@
if (entity.bB() != this) {
@@ -1589,6 +1863,24 @@
if (entity.bH() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
+ // CraftBukkit start
@ -467,11 +460,11 @@
+ }
+ }
+ // CraftBukkit end
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bw() instanceof EntityHuman)) {
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bC() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1576,6 +1868,22 @@
if (entity.bB() == this) {
@@ -1602,6 +1894,22 @@
if (entity.bH() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
+ // CraftBukkit start
@ -493,18 +486,18 @@
this.passengers.remove(entity);
entity.j = 60;
}
@@ -1715,14 +2023,49 @@
@@ -1741,14 +2049,49 @@
}
public void setAirTicks(int i) {
- this.datawatcher.set(Entity.az, Integer.valueOf(i));
- this.datawatcher.set(Entity.aA, Integer.valueOf(i));
+ // CraftBukkit start
+ EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i);
+ event.getEntity().getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ this.datawatcher.set(Entity.az, Integer.valueOf(event.getAmount()));
+ this.datawatcher.set(Entity.aA, Integer.valueOf(event.getAmount()));
+ // CraftBukkit end
}
@ -546,10 +539,10 @@
}
}
@@ -1867,19 +2210,70 @@
@@ -1893,19 +2236,70 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.B_();
MinecraftServer minecraftserver = this.C_();
- int j = this.dimension;
- WorldServer worldserver = minecraftserver.getWorldServer(j);
- WorldServer worldserver1 = minecraftserver.getWorldServer(i);
@ -620,7 +613,7 @@
BlockPosition blockposition;
if (i == 1) {
@@ -1908,12 +2302,18 @@
@@ -1934,12 +2328,18 @@
blockposition = new BlockPosition(this);
}
@ -640,7 +633,7 @@
if (j == 1 && i == 1) {
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
@@ -1921,6 +2321,7 @@
@@ -1947,6 +2347,7 @@
} else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
}
@ -648,7 +641,7 @@
boolean flag = entity.attachedToPlayer;
@@ -1928,13 +2329,21 @@
@@ -1954,13 +2355,21 @@
worldserver1.addEntity(entity);
entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false);
@ -671,7 +664,7 @@
return entity;
} else {
return null;
@@ -2038,6 +2447,11 @@
@@ -2064,6 +2473,11 @@
}
public void setCustomName(String s) {
@ -680,10 +673,10 @@
+ s = s.substring(0, 256);
+ }
+ // CraftBukkit end
this.datawatcher.set(Entity.aA, s);
this.datawatcher.set(Entity.aB, s);
}
@@ -2095,7 +2509,26 @@
@@ -2121,7 +2535,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {
@ -711,8 +704,8 @@
}
public float getHeadHeight() {
@@ -2269,7 +2702,7 @@
for (Iterator iterator = this.bx().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
@@ -2295,7 +2728,7 @@
for (Iterator iterator = this.bD().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
entity = (Entity) iterator.next();
if (oclass.isAssignableFrom(entity.getClass())) {
- set.add(entity);

View File

@ -2,8 +2,8 @@
+++ b/net/minecraft/server/EntityAgeable.java
@@ -10,6 +10,7 @@
protected int c;
private float bx = -1.0F;
private float by;
private float by = -1.0F;
private float bz;
+ public boolean ageLocked; // CraftBukkit
public EntityAgeable(World world) {

View File

@ -1,14 +1,14 @@
--- a/net/minecraft/server/EntityAnimal.java
+++ b/net/minecraft/server/EntityAnimal.java
@@ -5,6 +5,7 @@
protected Block bz;
private int bw;
private EntityHuman bx;
@@ -8,6 +8,7 @@
protected Block bA;
private int bx;
private UUID by;
+ public ItemStack breedItem; // CraftBukkit - Add breedItem variable
public EntityAnimal(World world) {
super(world);
@@ -38,6 +39,9 @@
@@ -41,6 +42,9 @@
}
@ -18,19 +18,19 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
@@ -46,6 +50,7 @@
@@ -49,6 +53,7 @@
return super.damageEntity(damagesource, f);
}
}
+ // CraftBukkit end */
public float a(BlockPosition blockposition) {
return this.world.getType(blockposition.down()).getBlock() == this.bz ? 10.0F : this.world.n(blockposition) - 0.5F;
@@ -120,6 +125,7 @@
public void c(EntityHuman entityhuman) {
this.bw = 600;
this.bx = entityhuman;
return this.world.getType(blockposition.down()).getBlock() == this.bA ? 10.0F : this.world.n(blockposition) - 0.5F;
@@ -130,6 +135,7 @@
if (entityhuman != null) {
this.by = entityhuman.getUniqueID();
}
+ this.breedItem = entityhuman.inventory.getItemInHand(); // CraftBukkit
this.world.broadcastEntityEffect(this, (byte) 18);
}

View File

@ -15,10 +15,10 @@
+
public class EntityArmorStand extends EntityLiving {
private static final Vector3f bq = new Vector3f(0.0F, 0.0F, 0.0F);
private static final Vector3f br = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -364,6 +373,21 @@
if (itemstack1.isEmpty() || (this.bA & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bA & 1 << enumitemslot.c() + 16) == 0) {
if (itemstack1.isEmpty() || (this.bB & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bB & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
@ -50,22 +50,22 @@
if (!this.world.isClientSide && !this.dead) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
- this.die();
+ this.Q(); // CraftBukkit - this.die() -> this.Q()
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
return false;
} else if (!this.isInvulnerable(damagesource) && !this.bz && !this.isMarker()) {
} else if (!this.isInvulnerable(damagesource) && !this.bA && !this.isMarker()) {
if (damagesource.isExplosion()) {
this.G();
this.F();
- this.die();
+ this.Q(); // CraftBukkit - this.die() -> this.Q()
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
return false;
} else if (DamageSource.FIRE.equals(damagesource)) {
if (this.isBurning()) {
@@ -421,7 +450,7 @@
} else if (damagesource.u()) {
this.I();
this.H();
this.D();
- this.die();
+ this.Q(); // CraftBukkit - this.die() -> this.Q()
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
return false;
} else {
long i = this.world.getTime();
@ -74,44 +74,29 @@
this.E();
this.D();
- this.die();
+ this.Q(); // CraftBukkit - this.die() -> this.Q()
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
}
return false;
@@ -460,19 +489,19 @@
@@ -460,7 +489,7 @@
f1 -= f;
if (f1 <= 0.5F) {
this.G();
this.F();
- this.die();
+ this.Q(); // CraftBukkit - this.die() -> this.Q()
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
} else {
this.setHealth(f1);
}
@@ -468,7 +497,7 @@
}
- private void E() {
private void E() {
- Block.a(this.world, new BlockPosition(this), new ItemStack(Items.ARMOR_STAND));
+ private void E() { // PAIL: Rename dropLoot
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
this.G();
this.F();
}
- private void G() {
+ private void G() { // PAIL: Rename dropEquippedItems
this.I();
int i;
@@ -481,7 +510,7 @@
for (i = 0; i < this.bx.size(); ++i) {
itemstack = (ItemStack) this.bx.get(i);
if (!itemstack.isEmpty()) {
- Block.a(this.world, (new BlockPosition(this)).up(), itemstack);
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
this.bx.set(i, ItemStack.a);
}
}
@@ -489,7 +518,7 @@
for (i = 0; i < this.by.size(); ++i) {
itemstack = (ItemStack) this.by.get(i);
if (!itemstack.isEmpty()) {
@ -120,13 +105,12 @@
this.by.set(i, ItemStack.a);
}
}
@@ -600,7 +629,8 @@
return this.isSmall();
}
- public void Q() {
+ public void Q() { // PAIL: Rename killEntity (super)
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event
this.die();
}
@@ -489,7 +518,7 @@
for (i = 0; i < this.bz.size(); ++i) {
itemstack = (ItemStack) this.bz.get(i);
if (!itemstack.isEmpty()) {
- Block.a(this.world, (new BlockPosition(this)).up(), itemstack);
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
this.bz.set(i, ItemStack.a);
}
}

View File

@ -48,13 +48,13 @@
+ // f = event.getDamage(); // TODO Why don't we do this?
+ // CraftBukkit end
+
this.d(-this.q());
this.b(10);
this.setDamage(this.n() + f * 10.0F);
this.d(-this.r());
this.c(10);
this.setDamage(this.p() + f * 10.0F);
@@ -102,6 +132,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.n() > 40.0F) {
if (flag || this.p() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
@ -98,12 +98,12 @@
}
+ private Location lastLocation; // CraftBukkit
public void A_() {
public void B_() {
this.aH = this.aG;
this.aG = this.t();
this.aG = this.u();
@@ -178,7 +234,6 @@
if (this.n() > 0.0F) {
this.setDamage(this.n() - 1.0F);
if (this.p() > 0.0F) {
this.setDamage(this.p() - 1.0F);
}
-
this.lastX = this.locX;
@ -131,8 +131,8 @@
+
for (int i = 0; i <= 1; ++i) {
if (this.a(i)) {
this.f[i] = (float) ((double) this.f[i] + 0.01D);
@@ -593,6 +664,11 @@
if (!this.isSilent() && (double) (this.f[i] % 6.2831855F) <= 0.7853981852531433D && ((double) this.f[i] + 0.39269909262657166D) % 6.2831854820251465D >= 0.7853981852531433D) {
@@ -622,6 +693,11 @@
this.e(this.fallDistance, 1.0F);
if (!this.world.isClientSide && !this.dead) {
@ -144,7 +144,7 @@
this.die();
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
int i;
@@ -606,6 +682,7 @@
@@ -635,6 +711,7 @@
}
}
}

View File

@ -10,15 +10,15 @@
+ }
+ // CraftBukkit end
super.n();
this.bA = this.bw;
this.by = this.bx;
this.bB = this.bx;
this.bz = this.by;
@@ -61,7 +66,9 @@
this.bw += this.bB * 2.0F;
if (!this.world.isClientSide && !this.isBaby() && !this.isChickenJockey() && --this.bC <= 0) {
this.a(SoundEffects.ac, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.bx += this.bC * 2.0F;
if (!this.world.isClientSide && !this.isBaby() && !this.isChickenJockey() && --this.bD <= 0) {
this.a(SoundEffects.af, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit
this.a(Items.EGG, 1);
+ this.forceDrops = false; // CraftBukkit
this.bC = this.random.nextInt(6000) + 6000;
this.bD = this.random.nextInt(6000) + 6000;
}

View File

@ -24,7 +24,7 @@
+ }
+
+ ItemStack result = CraftItemStack.asNMSCopy(event.getItemStack());
entityhuman.a(SoundEffects.ar, 1.0F, 1.0F);
entityhuman.a(SoundEffects.au, 1.0F, 1.0F);
itemstack.subtract(1);
if (itemstack.isEmpty()) {
- entityhuman.a(enumhand, new ItemStack(Items.MILK_BUCKET));

View File

@ -10,7 +10,7 @@
+
public abstract class EntityCreature extends EntityInsentient {
public static final UUID bu = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
public static final UUID bv = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
@@ -68,6 +72,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
@ -21,7 +21,7 @@
@@ -76,6 +81,7 @@
this.q(f);
this.s(f);
if (f > 10.0F) {
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);

View File

@ -56,7 +56,7 @@
- this.aU = true;
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
- this.die();
- this.do_();
- this.dq();
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+ this.world.getServer().getPluginManager().callEvent(event);
@ -64,7 +64,7 @@
+ this.aU = true;
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
+ this.die();
+ this.do_();
+ this.dq();
+ } else {
+ fuseTicks = 0;
+ }

View File

@ -12,11 +12,11 @@
+// PAIL: Fixme
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
private static final Logger bI = LogManager.getLogger();
private static final Logger bJ = LogManager.getLogger();
@@ -33,6 +38,7 @@
private final PathPoint[] bN = new PathPoint[24];
private final int[] bO = new int[24];
private final Path bP = new Path();
private final PathPoint[] bO = new PathPoint[24];
private final int[] bP = new int[24];
private final Path bQ = new Path();
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public EntityEnderDragon(World world) {

View File

@ -13,7 +13,7 @@
public class EntityEnderPearl extends EntityProjectile {
private EntityLiving d;
@@ -55,21 +62,35 @@
@@ -59,21 +66,35 @@
EntityPlayer entityplayer = (EntityPlayer) entityliving;
if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) {

View File

@ -1,15 +0,0 @@
--- a/net/minecraft/server/EntityEvoker.java
+++ b/net/minecraft/server/EntityEvoker.java
@@ -76,6 +76,12 @@
this.datawatcher.set(EntityEvoker.a, Byte.valueOf((byte) i));
}
+ // CraftBukkit start
+ public int getSpell() {
+ return this.datawatcher.get(EntityEvoker.a).intValue();
+ }
+ // CraftBukkit end
+
private int di() {
return this.b;
}

View File

@ -14,8 +14,8 @@
public int a;
@@ -34,6 +40,7 @@
public void A_() {
super.A_();
public void B_() {
super.B_();
+ EntityHuman prevTarget = this.targetPlayer;// CraftBukkit - store old target
if (this.c > 0) {
--this.c;

View File

@ -9,7 +9,7 @@
public class EntityFallingBlock extends Entity {
private IBlockData block;
@@ -65,7 +67,7 @@
@@ -69,7 +71,7 @@
if (this.ticksLived++ == 0) {
blockposition = new BlockPosition(this);
@ -18,31 +18,31 @@
this.world.setAir(blockposition);
} else if (!this.world.isClientSide) {
this.die();
@@ -88,7 +90,7 @@
@@ -110,7 +112,7 @@
if (BlockFalling.i(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
if (!flag1 && BlockFalling.i(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
this.onGround = false;
- return;
+ // return; // CraftBukkit
}
this.motX *= 0.699999988079071D;
@@ -97,7 +99,13 @@
@@ -119,7 +121,13 @@
if (iblockdata.getBlock() != Blocks.PISTON_EXTENSION) {
this.die();
if (!this.f) {
- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && !BlockFalling.i(this.world.getType(blockposition.down())) && this.world.setTypeAndData(blockposition, this.block, 3)) {
- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.i(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) {
+ // CraftBukkit start
+ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && !BlockFalling.i(this.world.getType(blockposition.down()))) {
+ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null) && (flag1 || !BlockFalling.i(this.world.getType(blockposition.down())))) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) {
+ return;
+ }
+ this.world.setTypeAndData(blockposition, this.block, 3);
+ // CraftBukkit end
if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata);
}
@@ -156,7 +164,9 @@
@@ -175,7 +183,9 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@ -52,14 +52,14 @@
this.locX += this.motX;
@@ -150,6 +167,11 @@
} else {
this.ap();
this.av();
if (damagesource.getEntity() != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = damagesource.getEntity().aB();
Vec3D vec3d = damagesource.getEntity().aH();
if (vec3d != null) {
@@ -163,6 +185,7 @@

View File

@ -43,7 +43,7 @@
+ }
+ // CraftBukkit end
this.motY = (double) (-0.4F * MathHelper.a(this.random, 0.6F, 1.0F));
this.a(SoundEffects.H, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
this.a(SoundEffects.K, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
double d3 = this.getBoundingBox().b + 0.5D;
@@ -384,6 +401,14 @@
int i = 0;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityGhast.java
+++ b/net/minecraft/server/EntityGhast.java
@@ -159,7 +159,8 @@
@@ -158,7 +158,8 @@
world.a((EntityHuman) null, 1016, new BlockPosition(this.ghast), 0);
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);

View File

@ -143,7 +143,7 @@
+ // CraftBukkit end
+
this.die();
this.ap();
this.av();
this.a(damagesource.getEntity());
@@ -151,6 +199,18 @@

View File

@ -9,23 +9,19 @@
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable {
@@ -39,6 +40,7 @@
private float bS;
protected boolean bE = true;
protected int bF;
private float bT;
protected boolean bF = true;
protected int bG;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
public EntityHorseAbstract(World world) {
super(world);
@@ -211,10 +213,10 @@
return 2;
}
- protected void dx() {
+ public void dx() { // PAIL: protected-> public, rename
@@ -214,7 +216,7 @@
public void loadChest() {
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
- this.inventoryChest = new InventoryHorseChest("HorseChest", this.di());
+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.di(), this); // CraftBukkit
- this.inventoryChest = new InventoryHorseChest("HorseChest", this.dl());
+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.dl(), this); // CraftBukkit
this.inventoryChest.a(this.getName());
if (inventoryhorsechest != null) {
inventoryhorsechest.b(this);
@ -37,7 +33,7 @@
+ return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
}
protected float ci() {
protected float co() {
@@ -414,7 +416,7 @@
}
@ -72,8 +68,8 @@
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
}
if (this.dE()) {
@@ -719,6 +722,7 @@
if (this.dH()) {
@@ -723,6 +726,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
}
@ -81,7 +77,7 @@
if (!this.inventoryChest.getItem(0).isEmpty()) {
nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound()));
@@ -745,6 +749,11 @@
@@ -749,6 +753,11 @@
if (!s.isEmpty()) {
this.setOwnerUUID(UUID.fromString(s));
}
@ -93,10 +89,10 @@
AttributeInstance attributeinstance = this.getAttributeMap().a("Speed");
@@ -797,6 +806,18 @@
@@ -801,6 +810,18 @@
}
public void b(int i) {
public void b_(int i) {
+ // CraftBukkit start
+ float power;
+ if (i >= 90) {
@ -110,5 +106,5 @@
+ }
+ // CraftBukkit end
this.canSlide = true;
this.dL();
this.dr();
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityHuman.java
+++ b/net/minecraft/server/EntityHuman.java
@@ -9,6 +9,18 @@
@@ -9,6 +9,19 @@
import java.util.UUID;
import javax.annotation.Nullable;
@ -8,6 +8,7 @@
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.entity.CraftItem;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.player.PlayerBedEnterEvent;
+import org.bukkit.event.player.PlayerBedLeaveEvent;
@ -19,20 +20,20 @@
public abstract class EntityHuman extends EntityLiving {
private static final DataWatcherObject<Float> a = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c);
@@ -16,10 +28,10 @@
protected static final DataWatcherObject<Byte> bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
protected static final DataWatcherObject<Byte> br = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
@@ -18,10 +31,10 @@
protected static final DataWatcherObject<NBTTagCompound> bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.n);
protected static final DataWatcherObject<NBTTagCompound> bu = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.n);
public PlayerInventory inventory = new PlayerInventory(this);
- private InventoryEnderChest enderChest = new InventoryEnderChest();
+ private InventoryEnderChest enderChest = new InventoryEnderChest(this); // CraftBukkit - add "this" to constructor
- protected InventoryEnderChest enderChest = new InventoryEnderChest();
+ protected InventoryEnderChest enderChest = new InventoryEnderChest(this); // CraftBukkit - add "this" to constructor
public Container defaultContainer;
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected int bw;
public float bx;
public float by;
@@ -52,6 +64,17 @@
protected int bA;
public float bB;
public float bC;
@@ -53,6 +66,17 @@
@Nullable
public EntityFishingHook hookedFish;
@ -50,7 +51,7 @@
protected ItemCooldown l() {
return new ItemCooldown();
}
@@ -312,7 +335,8 @@
@@ -311,7 +335,8 @@
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) {
if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) {
@ -60,69 +61,16 @@
}
if (this.foodData.c() && this.ticksLived % 10 == 0) {
@@ -336,7 +360,7 @@
@@ -335,7 +360,7 @@
this.l((float) attributeinstance.getValue());
this.m((float) attributeinstance.getValue());
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- float f1 = (float) (Math.atan(-this.motY * 0.20000000298023224D) * 15.0D);
+ float f1 = (float) ( org.bukkit.craftbukkit.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0D); // CraftBukkit
if (f > 0.1F) {
f = 0.1F;
@@ -442,28 +466,34 @@
public void b(Entity entity, int i) {
if (entity != this) {
this.addScore(i);
- Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f);
+ // CraftBukkit - Get our scores instead
+ Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, this.getName(), new java.util.ArrayList<ScoreboardScore>());
if (entity instanceof EntityHuman) {
this.b(StatisticList.D);
- collection.addAll(this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.e));
+ // CraftBukkit - Get our scores instead
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getName(), collection);
+ // collection.addAll(this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.e));
+ // CraftBukkit end
} else {
this.b(StatisticList.B);
}
collection.addAll(this.d(entity));
- Iterator iterator = collection.iterator();
+ Iterator<ScoreboardScore> iterator = collection.iterator();
while (iterator.hasNext()) {
- ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+ // CraftBukkit start
+ // ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
- this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).incrementScore();
+ iterator.next().incrementScore();
+ // CraftBukkit end
}
}
}
- private Collection<ScoreboardObjective> d(Entity entity) {
+ private Collection<ScoreboardScore> d(Entity entity) { // CraftBukkit
String s = entity instanceof EntityHuman ? entity.getName() : entity.bf();
ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName());
@@ -488,7 +518,10 @@
int j = scoreboardteam1.m().b();
if (j >= 0 && j < IScoreboardCriteria.m.length) {
- return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]);
+ // CraftBukkit - Get our scores instead
+ return this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.m[j], this.getName(), new java.util.ArrayList<ScoreboardScore>());
+ // return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]);
+ // CraftBukkit end
}
}
@@ -497,6 +530,7 @@
@@ -457,6 +482,7 @@
@Nullable
public EntityItem a(boolean flag) {
@ -130,7 +78,7 @@
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true);
}
@@ -539,6 +573,30 @@
@@ -499,6 +525,30 @@
entityitem.motZ += Math.sin((double) f1) * (double) f;
}
@ -161,7 +109,7 @@
ItemStack itemstack1 = this.a(entityitem);
if (flag1) {
@@ -646,6 +704,13 @@
@@ -614,6 +664,13 @@
this.a(true, true, false);
}
@ -173,18 +121,18 @@
+ // CraftBukkit end
+
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.e = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.f = nbttagcompound.getBoolean("SpawnForced");
@@ -683,6 +748,7 @@
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
nbttagcompound.set("EnderItems", this.enderChest.i());
this.d = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.e = nbttagcompound.getBoolean("SpawnForced");
@@ -666,6 +723,7 @@
if (!this.getShoulderEntityRight().isEmpty()) {
nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight());
}
+ nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds
}
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -701,7 +767,7 @@
@@ -686,7 +744,7 @@
this.releaseShoulderEntities();
if (damagesource.r()) {
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
- f = 0.0F;
@ -192,7 +140,7 @@
}
if (this.world.getDifficulty() == EnumDifficulty.EASY) {
@@ -713,7 +779,7 @@
@@ -698,7 +756,7 @@
}
}
@ -201,12 +149,12 @@
}
}
}
@@ -727,10 +793,29 @@
@@ -712,10 +770,29 @@
}
public boolean a(EntityHuman entityhuman) {
- ScoreboardTeamBase scoreboardteambase = this.aQ();
- ScoreboardTeamBase scoreboardteambase1 = entityhuman.aQ();
- ScoreboardTeamBase scoreboardteambase = this.aW();
- ScoreboardTeamBase scoreboardteambase1 = entityhuman.aW();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
@ -234,7 +182,7 @@
}
protected void damageArmor(float f) {
@@ -773,7 +858,12 @@
@@ -758,7 +835,12 @@
return (float) i / (float) this.inventory.armor.size();
}
@ -248,7 +196,7 @@
if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f);
@@ -793,6 +883,7 @@
@@ -778,6 +860,7 @@
}
}
@ -256,7 +204,7 @@
}
public void openSign(TileEntitySign tileentitysign) {}
@@ -914,8 +1005,15 @@
@@ -899,8 +982,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@ -274,7 +222,7 @@
}
}
@@ -946,8 +1044,11 @@
@@ -931,8 +1021,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) {
@ -287,7 +235,7 @@
}
}
@@ -956,11 +1057,28 @@
@@ -941,11 +1034,28 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@ -316,7 +264,7 @@
}
if (flag2) {
@@ -1013,7 +1131,14 @@
@@ -994,7 +1104,14 @@
this.a(StatisticList.y, Math.round(f5 * 10.0F));
if (j > 0) {
@ -332,7 +280,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1029,6 +1154,11 @@
@@ -1010,6 +1127,11 @@
if (flag4) {
entity.extinguish();
}
@ -344,7 +292,7 @@
}
}
@@ -1119,6 +1249,20 @@
@@ -1100,6 +1222,20 @@
this.stopRiding();
}
@ -362,10 +310,10 @@
+ }
+ // CraftBukkit end
+
this.releaseShoulderEntities();
this.setSize(0.2F, 0.2F);
if (this.world.isLoaded(blockposition)) {
float f = 0.5F + (float) enumdirection.getAdjacentX() * 0.4F;
@@ -1178,6 +1322,23 @@
@@ -1160,6 +1296,23 @@
this.world.everyoneSleeping();
}
@ -389,15 +337,59 @@
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
this.setRespawnPosition(this.bedPosition, false);
@@ -1229,9 +1390,11 @@
@@ -1211,9 +1364,11 @@
if (blockposition != null) {
this.e = blockposition;
this.f = flag;
this.d = blockposition;
this.e = flag;
+ this.spawnWorld = this.world.worldData.getName(); // CraftBukkit
} else {
this.e = null;
this.f = false;
this.d = null;
this.e = false;
+ this.spawnWorld = ""; // CraftBukkit
}
}
@@ -1537,13 +1692,17 @@
}
protected void releaseShoulderEntities() {
- this.spawnEntityFromShoulder(this.getShoulderEntityLeft());
- this.setShoulderEntityLeft(new NBTTagCompound());
- this.spawnEntityFromShoulder(this.getShoulderEntityRight());
- this.setShoulderEntityRight(new NBTTagCompound());
+ // CraftBukkit start
+ if (this.spawnEntityFromShoulder(this.getShoulderEntityLeft())) {
+ this.setShoulderEntityLeft(new NBTTagCompound());
+ }
+ if (this.spawnEntityFromShoulder(this.getShoulderEntityRight())) {
+ this.setShoulderEntityRight(new NBTTagCompound());
+ }
+ // CraftBukkit end
}
- private void spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) {
+ private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean
if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
Entity entity = EntityTypes.a(nbttagcompound, this.world);
@@ -1552,9 +1711,10 @@
}
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
- this.world.addEntity(entity);
+ return this.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
}
+ return true; // CraftBukkit
}
public abstract boolean isSpectator();
@@ -1756,7 +1916,7 @@
return entitymonster.c(this.a);
}
- public boolean apply(@Nullable Object object) {
+ public boolean apply(@Nullable EntityMonster object) { // CraftBukkit - decompile error
return this.a((EntityMonster) object);
}

View File

@ -88,7 +88,7 @@
NBTTagList nbttaglist;
int i;
@@ -521,7 +573,9 @@
@@ -525,7 +577,9 @@
}
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
@ -97,8 +97,8 @@
+ this.forceDrops = false; // CraftBukkit
}
if (itemstack.getItem() == Items.DIAMOND && entityitem.n() != null) {
@@ -569,11 +623,11 @@
this.setSlot(enumitemslot, itemstack);
@@ -565,11 +619,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@ -112,7 +112,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
@@ -942,12 +996,24 @@
@@ -938,12 +992,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@ -137,9 +137,9 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
@@ -968,10 +1034,12 @@
@@ -964,10 +1030,12 @@
if (this.bD) {
if (this.bE) {
if (!this.isAlive()) {
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit
this.unleash(true, true);
@ -150,8 +150,8 @@
this.unleash(true, true);
}
}
@@ -982,7 +1050,9 @@
this.bD = false;
@@ -978,7 +1046,9 @@
this.bE = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
@ -160,7 +160,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1052,6 +1122,7 @@
@@ -1048,6 +1118,7 @@
this.setLeashHolder(entityleash, true);
} else {

View File

@ -19,7 +19,7 @@
@@ -54,9 +56,12 @@
this.die();
} else {
super.A_();
super.B_();
- if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
- --this.pickupDelay;
- }
@ -42,7 +42,7 @@
}
+ // Craftbukkit end */
this.ak();
this.aq();
if (!this.world.isClientSide) {
@@ -121,6 +128,12 @@
}
@ -74,7 +74,7 @@
+ return false;
+ }
+ // CraftBukkit end
this.ap();
this.av();
this.f = (int) ((float) this.f - f);
if (this.f <= 0) {
@@ -270,6 +289,26 @@
@ -102,5 +102,5 @@
+ // CraftBukkit end
+
if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) {
if (item == Item.getItemOf(Blocks.LOG)) {
entityhuman.b((Statistic) AchievementList.g);
entityhuman.receive(this, i);
if (itemstack.isEmpty()) {

View File

@ -10,5 +10,5 @@
+ }
+ // CraftBukkit end
this.b(damagesource.getEntity(), false);
this.a(SoundEffects.dh, 1.0F, 1.0F);
this.a(SoundEffects.du, 1.0F, 1.0F);
this.setItem(ItemStack.a);

View File

@ -46,12 +46,12 @@
}
}
@@ -41,7 +53,24 @@
public void A_() {
super.A_();
public void B_() {
super.B_();
if (this.lifeTicks == 2) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dx, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dK, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
+ // CraftBukkit start - Use relative location for far away sounds
+ // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dv, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
+ // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dG, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
+ float pitch = 0.8F + this.random.nextFloat() * 0.2F;
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
+ for (EntityPlayer player : (List<EntityPlayer>) (List) this.world.players) {
@ -62,13 +62,13 @@
+ double deltaLength = Math.sqrt(distanceSquared);
+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dx, SoundCategory.WEATHER, relativeX, this.locY, relativeZ, 10000.0F, pitch));
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dK, SoundCategory.WEATHER, relativeX, this.locY, relativeZ, 10000.0F, pitch));
+ } else {
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dx, SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 10000.0F, pitch));
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dK, SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 10000.0F, pitch));
+ }
+ }
+ // CraftBukkit end
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dw, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dJ, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
}
@@ -57,13 +86,17 @@

View File

@ -25,10 +25,10 @@
public abstract class EntityLiving extends Entity {
private static final Logger a = LogManager.getLogger();
@@ -87,6 +105,14 @@
private BlockPosition bE;
private DamageSource bF;
private long bG;
@@ -88,6 +106,14 @@
private BlockPosition bF;
private DamageSource bG;
private long bH;
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
@ -38,9 +38,9 @@
+ public boolean collides = true;
+ // CraftBukkit end
public void Q() {
public void killEntity() {
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
@@ -101,7 +127,8 @@
@@ -102,7 +128,8 @@
this.updateEffects = true;
this.activeItem = ItemStack.a;
this.initAttributes();
@ -50,7 +50,7 @@
this.i = true;
this.aM = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.setPosition(this.locX, this.locY, this.locZ);
@@ -139,7 +166,13 @@
@@ -140,7 +167,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -65,7 +65,7 @@
}
}
@@ -201,7 +234,11 @@
@@ -202,7 +235,11 @@
this.stopRiding();
}
} else {
@ -78,7 +78,7 @@
}
if (!this.world.isClientSide) {
@@ -258,6 +295,18 @@
@@ -259,6 +296,18 @@
this.world.methodProfiler.b();
}
@ -97,9 +97,9 @@
protected void b(BlockPosition blockposition) {
int i = EnchantmentManager.a(Enchantments.j, this);
@@ -273,19 +322,19 @@
@@ -274,19 +323,19 @@
protected void bG() {
protected void bM() {
++this.deathTicks;
- if (this.deathTicks == 20) {
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
@ -107,14 +107,14 @@
- if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot"))) {
- i = this.getExpValue(this.killer);
-
- while (i > 0) {
- int j = EntityExperienceOrb.getOrbValue(i);
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
+ i = this.expToDrop;
+ while (i > 0) {
+ int j = EntityExperienceOrb.getOrbValue(i);
- while (i > 0) {
- int j = EntityExperienceOrb.getOrbValue(i);
-
- i -= j;
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
- }
@ -126,7 +126,7 @@
this.die();
@@ -441,6 +490,17 @@
@@ -442,6 +491,17 @@
}
}
@ -144,7 +144,7 @@
if (nbttagcompound.hasKeyOfType("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -463,9 +523,15 @@
@@ -464,9 +524,15 @@
}
@ -160,7 +160,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -483,6 +549,17 @@
@@ -484,6 +550,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@ -178,7 +178,7 @@
if (this.updateEffects) {
if (!this.world.isClientSide) {
@@ -580,6 +657,12 @@
@@ -585,6 +662,12 @@
}
public void addEffect(MobEffect mobeffect) {
@ -191,7 +191,7 @@
if (this.d(mobeffect)) {
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
@@ -612,6 +695,12 @@
@@ -617,6 +700,12 @@
@Nullable
public MobEffect c(@Nullable MobEffectList mobeffectlist) {
@ -204,7 +204,7 @@
return (MobEffect) this.effects.remove(mobeffectlist);
}
@@ -651,20 +740,52 @@
@@ -656,20 +745,52 @@
}
@ -258,10 +258,10 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
@@ -680,14 +801,16 @@
} else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -687,14 +808,16 @@
} else {
float f1 = f;
- if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
@ -278,7 +278,7 @@
this.damageShield(f);
f = 0.0F;
if (!damagesource.a()) {
@@ -706,20 +829,39 @@
@@ -713,20 +836,39 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
@ -320,37 +320,37 @@
this.aA = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -806,18 +948,27 @@
@@ -833,18 +975,26 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
+ // CraftBukkit start
+ ItemStack itemstack = ItemStack.a;
+ ItemStack itemstack1 = ItemStack.a;
for (int j = 0; j < i; ++j) {
EnumHand enumhand = aenumhand[j];
- ItemStack itemstack = this.b(enumhand);
+ itemstack = this.b(enumhand);
- ItemStack itemstack1 = this.b(enumhand);
+ itemstack1 = this.b(enumhand);
if (itemstack.getItem() == Items.cY) {
- itemstack.subtract(1);
+ // itemstack.subtract(1);
flag = true;
if (itemstack1.getItem() == Items.cY) {
itemstack = itemstack1.cloneItemStack();
- itemstack1.subtract(1);
+ // itemstack1.subtract(1); // CraftBukkit
break;
}
}
- if (itemstack != null) {
+ EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity());
+ event.setCancelled(!flag);
+ event.setCancelled(itemstack == null);
+ this.world.getServer().getPluginManager().callEvent(event);
+ flag = !event.isCancelled();
+
if (flag) {
+ itemstack.subtract(1);
+ if (itemstack != null && !event.isCancelled()) {
+ itemstack1.subtract(1);
+ // CraftBukkit end
if (this instanceof EntityHuman) {
((EntityHuman) this).b(StatisticList.b(Items.cY));
}
@@ -914,6 +1065,12 @@
if (this instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) this;
@@ -944,6 +1094,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@ -363,7 +363,7 @@
}
}
@@ -1003,8 +1160,13 @@
@@ -1033,8 +1189,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@ -378,16 +378,16 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
@@ -1031,7 +1193,7 @@
@@ -1061,7 +1222,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
- this.damageArmor(f);
+ // this.damageArmor(f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.h).getValue());
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.i).getValue());
}
@@ -1044,7 +1206,8 @@
@@ -1074,7 +1235,8 @@
} else {
int i;
@ -397,7 +397,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1065,22 +1228,129 @@
@@ -1095,22 +1257,142 @@
}
}
@ -529,7 +529,20 @@
+
+ return true;
+ } else {
+ return (event.getDamage(DamageModifier.BLOCKING) < 0) ? false : originalDamage > 0;
+ // Duplicate triggers if blocking
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ if (this instanceof EntityPlayer) {
+ CriterionTriggers.h.a((EntityPlayer) this, damagesource, f, originalDamage, true);
+ }
+
+ if (damagesource.getEntity() instanceof EntityPlayer) {
+ CriterionTriggers.g.a((EntityPlayer) damagesource.getEntity(), this, damagesource, f, originalDamage, true);
+ }
+
+ return false;
+ } else {
+ return originalDamage > 0;
+ }
+ // CraftBukkit end
}
}
@ -537,7 +550,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1147,6 +1417,7 @@
@@ -1177,6 +1459,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@ -545,7 +558,7 @@
}
return this.attributeMap;
@@ -1438,6 +1709,7 @@
@@ -1469,6 +1752,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -553,7 +566,7 @@
this.setFlag(7, false);
}
} else {
@@ -1798,6 +2070,7 @@
@@ -1838,6 +2122,7 @@
}
if (!this.world.isClientSide) {
@ -561,7 +574,7 @@
this.setFlag(7, flag);
}
@@ -1895,11 +2168,11 @@
@@ -1931,11 +2216,11 @@
}
public boolean isInteractable() {
@ -574,12 +587,12 @@
+ return this.isAlive() && !this.m_() && this.collides; // CraftBukkit
}
protected void ap() {
@@ -2036,7 +2309,27 @@
protected void av() {
@@ -2072,7 +2357,27 @@
protected void v() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.a(this.activeItem, 16);
- this.a(this.cz(), this.activeItem.a(this.world, this));
this.b(this.activeItem, 16);
- this.a(this.cF(), this.activeItem.a(this.world, this));
+ // CraftBukkit start - fire PlayerItemConsumeEvent
+ ItemStack itemstack;
+ if (this instanceof EntityPlayer) {
@ -599,12 +612,12 @@
+ itemstack = this.activeItem.a(this.world, this);
+ }
+
+ this.a(this.cz(), itemstack);
+ this.a(this.cF(), itemstack);
+ // CraftBukkit end
this.cF();
this.cL();
}
@@ -2115,10 +2408,18 @@
@@ -2151,10 +2456,18 @@
}
if (flag1) {

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/server/EntityLlama.java
+++ b/net/minecraft/server/EntityLlama.java
@@ -20,7 +20,7 @@
this.setSize(0.9F, 1.87F);
}
- private void p(int i) {
+ public void p(int i) { // PAIL: private-> public, rename
this.datawatcher.set(EntityLlama.bG, Integer.valueOf(Math.max(1, Math.min(5, i))));
}
@@ -30,7 +30,7 @@
this.p(1 + this.random.nextInt(i));
}
- public int dL() {
+ public int dL() { // PAIL: rename
return ((Integer) this.datawatcher.get(EntityLlama.bG)).intValue();
}

View File

@ -53,7 +53,7 @@
+ // CraftBukkit end
this.e(-this.u());
this.d(10);
this.ap();
this.av();
@@ -108,6 +141,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
@ -67,13 +67,13 @@
+ return true;
+ }
+ // CraftBukkit end
this.az();
this.aF();
if (flag && !this.hasCustomName()) {
this.die();
@@ -146,6 +188,14 @@
}
public void A_() {
public void B_() {
+ // CraftBukkit start
+ double prevX = this.locX;
+ double prevY = this.locY;
@ -87,13 +87,13 @@
}
@@ -166,7 +216,7 @@
i = this.V();
i = this.Z();
if (this.ak) {
- if (minecraftserver.getAllowNether()) {
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled
if (!this.isPassenger() && this.al++ >= i) {
this.al = i;
this.portalCooldown = this.aE();
this.portalCooldown = this.aK();
@@ -266,6 +316,18 @@
}
@ -156,7 +156,7 @@
@@ -297,7 +383,7 @@
}
protected double o() {
protected double p() {
- return 0.4D;
+ return this.maxSpeed; // CraftBukkit
}

View File

@ -34,10 +34,10 @@
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.setTamed(true);
this.c(entityhuman);
this.setCatType(1 + this.world.random.nextInt(3));
this.setOwnerUUID(entityhuman.getUniqueID());
@@ -238,7 +243,7 @@
this.p(true);
@@ -237,7 +242,7 @@
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPainting.java
+++ b/net/minecraft/server/EntityPainting.java
@@ -10,6 +10,7 @@
@@ -11,6 +11,7 @@
public EntityPainting(World world) {
super(world);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPig.java
+++ b/net/minecraft/server/EntityPig.java
@@ -5,6 +5,8 @@
@@ -4,6 +4,8 @@
import java.util.Set;
import javax.annotation.Nullable;
@ -8,8 +8,8 @@
+
public class EntityPig extends EntityAnimal {
private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityPig.class, DataWatcherRegistry.h);
@@ -125,13 +127,14 @@
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityPig.class, DataWatcherRegistry.h);
@@ -124,13 +126,14 @@
}
public void die(DamageSource damagesource) {
@ -25,7 +25,7 @@
}
@Nullable
@@ -156,6 +159,12 @@
@@ -155,6 +158,12 @@
if (!this.world.isClientSide && !this.dead) {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
@ -38,7 +38,7 @@
entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitypigzombie.setAI(this.hasAI());
@@ -164,7 +173,8 @@
@@ -163,7 +172,8 @@
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}

View File

@ -22,8 +22,8 @@
+
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bR = LogManager.getLogger();
@@ -44,6 +60,19 @@
private static final Logger bW = LogManager.getLogger();
@@ -51,6 +67,19 @@
public int ping;
public boolean viewingCredits;
@ -43,10 +43,10 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile);
playerinteractmanager.player = this;
@@ -67,13 +96,18 @@
@@ -75,13 +104,18 @@
this.server = minecraftserver;
this.bU = minecraftserver.getPlayerList().a((EntityHuman) this);
this.ca = minecraftserver.getPlayerList().a((EntityHuman) this);
this.bZ = minecraftserver.getPlayerList().h(this);
- this.P = 0.0F;
+ this.P = 1.0F; // CraftBukkit - hit when sneaking
this.setPositionRotation(blockposition, 0.0F, 0.0F);
@ -63,20 +63,20 @@
}
public void a(NBTTagCompound nbttagcompound) {
@@ -86,6 +120,7 @@
}
@@ -104,6 +138,7 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.cs.a(nbttagcompound.getCompound("recipeBook"));
}
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
}
public static void a(DataConverterManager dataconvertermanager) {
@@ -119,8 +154,33 @@
nbttagcompound1.set("Entity", nbttagcompound2);
nbttagcompound.set("RootVehicle", nbttagcompound1);
@@ -150,8 +185,34 @@
}
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
+ }
nbttagcompound.set("recipeBook", this.cs.e());
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
+ public void spawnIn(World world) {
@ -100,15 +100,16 @@
+ }
+ this.dimension = ((WorldServer) this.world).dimension;
+ this.playerInteractManager.a((WorldServer) world);
}
+ }
+ // CraftBukkit end
+
public void levelDown(int i) {
super.levelDown(i);
@@ -151,6 +211,11 @@
this.lastSentExp = -1;
@@ -185,6 +246,11 @@
}
public void A_() {
public void B_() {
+ // CraftBukkit start
+ if (this.joining) {
+ this.joining = false;
@ -117,17 +118,17 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
@@ -210,7 +275,7 @@
@@ -250,7 +316,7 @@
}
if (this.getHealth() != this.lastHealthSent || this.cc != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cd) {
if (this.getHealth() != this.lastHealthSent || this.ci != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cj) {
- this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel()));
+ this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); // CraftBukkit
this.lastHealthSent = this.getHealth();
this.cc = this.foodData.getFoodLevel();
this.cd = this.foodData.getSaturationLevel() == 0.0F;
@@ -231,6 +296,12 @@
this.a(IScoreboardCriteria.i, MathHelper.f((float) this.bX));
this.ci = this.foodData.getFoodLevel();
this.cj = this.foodData.getSaturationLevel() == 0.0F;
@@ -271,6 +337,12 @@
this.a(IScoreboardCriteria.i, MathHelper.f((float) this.cd));
}
+ // CraftBukkit start - Force max health updates
@ -136,11 +137,11 @@
+ }
+ // CraftBukkit end
+
if (this.getArmorStrength() != this.bY) {
this.bY = this.getArmorStrength();
this.a(IScoreboardCriteria.j, MathHelper.f((float) this.bY));
@@ -255,6 +326,16 @@
this.o();
if (this.getArmorStrength() != this.ce) {
this.ce = this.getArmorStrength();
this.a(IScoreboardCriteria.j, MathHelper.f((float) this.ce));
@@ -295,6 +367,16 @@
CriterionTriggers.o.a(this);
}
+ // CraftBukkit start - initialize oldLevel and fire PlayerLevelChangeEvent
@ -156,7 +157,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -265,12 +346,11 @@
@@ -305,12 +387,11 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -171,42 +172,42 @@
scoreboardscore.setScore(i);
}
@@ -319,31 +399,61 @@
@@ -321,32 +402,62 @@
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag));
- if (flag) {
- ScoreboardTeamBase scoreboardteambase = this.aQ();
- ScoreboardTeamBase scoreboardteambase = this.aW();
+ // CraftBukkit start - fire PlayerDeathEvent
+ if (this.dead) {
+ return;
+ }
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.inventory.getSize());
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory");
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory") || this.isSpectator();
+
+ if (!keepInventory) {
+ for (ItemStack item : this.inventory.getContents()) {
+ if (!item.isEmpty() && !EnchantmentManager.e(item)) { // PAIL: shouldNotDrop (Vanishing enchant)
+ if (!item.isEmpty() && !EnchantmentManager.shouldNotDrop(item)) {
+ loot.add(CraftItemStack.asCraftMirror(item));
+ }
+ }
+ }
+
+ IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage();
+
+ String deathmessage = chatmessage.toPlainText();
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
- if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
- if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
- this.server.getPlayerList().a((EntityHuman) this, this.getCombatTracker().getDeathMessage());
- } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
- this.server.getPlayerList().b((EntityHuman) this, this.getCombatTracker().getDeathMessage());
+ String deathmessage = chatmessage.toPlainText();
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
+
+ String deathMessage = event.getDeathMessage();
+
+ if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override?
+ if (deathMessage.equals(deathmessage)) {
+ ScoreboardTeamBase scoreboardteambase = this.aQ();
+ ScoreboardTeamBase scoreboardteambase = this.aW();
+
+ if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
+ if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
@ -223,8 +224,9 @@
}
}
this.releaseShoulderEntities();
- if (!this.world.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) {
- this.cN();
- this.cT();
- this.inventory.o();
+ // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
+ if (!event.getKeepInventory()) {
@ -247,7 +249,62 @@
scoreboardscore.incrementScore();
}
@@ -402,13 +512,16 @@
@@ -374,29 +485,36 @@
if (entity != this) {
super.a(entity, i, damagesource);
this.addScore(i);
- Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f);
+ // CraftBukkit - Get our scores instead
+ Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, this.getName(), new java.util.ArrayList<ScoreboardScore>());
if (entity instanceof EntityHuman) {
this.b(StatisticList.D);
- collection.addAll(this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.e));
+ // CraftBukkit - Get our scores instead
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getName(), collection);
+ // collection.addAll(this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.e));
+ // CraftBukkit end
} else {
this.b(StatisticList.B);
}
collection.addAll(this.E(entity));
- Iterator iterator = collection.iterator();
+ Iterator<ScoreboardScore> iterator = collection.iterator(); // CraftBukkit
while (iterator.hasNext()) {
- ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+ // CraftBukkit start
+ // ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
- this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).incrementScore();
+ // this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).incrementScore();
+ iterator.next().incrementScore();
+ // CraftBukkit end
}
CriterionTriggers.b.a(this, entity, damagesource);
}
}
- private Collection<ScoreboardObjective> E(Entity entity) {
+ private Collection<ScoreboardScore> E(Entity entity) { // CraftBukkit
String s = entity instanceof EntityHuman ? entity.getName() : entity.bl();
ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName());
@@ -421,7 +539,10 @@
int j = scoreboardteam1.m().b();
if (j >= 0 && j < IScoreboardCriteria.m.length) {
- return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]);
+ // CraftBukkit - Get our scores instead
+ return this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.m[j], this.getName(), new java.util.ArrayList<ScoreboardScore>());
+ // return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]);
+ // CraftBukkit end
}
}
@@ -463,12 +584,14 @@
}
private boolean canPvP() {
@ -257,17 +314,23 @@
}
@Nullable
public Entity c(int i) {
public Entity b(int i) {
- this.worldChangeInvuln = true;
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
+ // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
if (this.dimension == 0 && i == -1) {
this.cw = new Vec3D(this.locX, this.locY, this.locZ);
} else if (this.dimension != -1 && i != 0) {
@@ -476,6 +599,7 @@
}
if (this.dimension == 1 && i == 1) {
+ this.worldChangeInvuln = true; // CraftBukkit - Moved down from above
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
@@ -429,7 +542,10 @@
this.b((Statistic) AchievementList.y);
@@ -489,7 +613,10 @@
i = 1;
}
- this.server.getPlayerList().a(this, i);
@ -278,7 +341,7 @@
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
@@ -474,6 +590,7 @@
@@ -535,6 +662,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@ -286,7 +349,7 @@
if (this.isSleeping()) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
@@ -552,23 +669,55 @@
@@ -613,23 +741,55 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@ -345,10 +408,10 @@
if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)), true);
} else {
@@ -582,18 +731,21 @@
@@ -643,18 +803,21 @@
if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.Y, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ab, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
+ iinventory.closeContainer(this); // CraftBukkit
return;
}
@ -369,7 +432,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -601,8 +753,14 @@
@@ -662,8 +825,14 @@
}
public void openTrade(IMerchant imerchant) {
@ -385,7 +448,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e();
@@ -622,13 +780,20 @@
@@ -683,13 +852,20 @@
}
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -407,7 +470,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -665,6 +830,11 @@
@@ -730,6 +906,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@ -419,15 +482,24 @@
}
public void setContainerData(Container container, int i, int j) {
@@ -679,6 +849,7 @@
@@ -744,6 +925,7 @@
}
public void closeInventory() {
+ CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.s();
this.r();
}
@@ -760,7 +931,16 @@
@@ -818,7 +1000,7 @@
arraylist.add(CraftingManager.a(minecraftkey));
}
- this.a((List) arraylist);
+ this.a((List<IRecipe>) arraylist); // CraftBukkit - decompile error
}
public void b(List<IRecipe> list) {
@@ -840,7 +1022,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@ -443,8 +515,8 @@
+ // CraftBukkit end
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, (byte) (flag ? 2 : 0)));
@@ -821,6 +1001,18 @@
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
@@ -939,6 +1130,18 @@
}
public void a(EnumGamemode enumgamemode) {
@ -463,7 +535,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -846,6 +1038,7 @@
@@ -965,6 +1168,7 @@
}
public boolean a(int i, String s) {
@ -471,7 +543,7 @@
if ("seed".equals(s) && !this.server.aa()) {
return true;
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
@@ -859,6 +1052,15 @@
@@ -978,6 +1182,15 @@
} else {
return true;
}
@ -487,7 +559,7 @@
}
public String A() {
@@ -870,6 +1072,12 @@
@@ -989,6 +1202,12 @@
}
public void a(PacketPlayInSettings packetplayinsettings) {
@ -498,18 +570,18 @@
+ }
+ // CraftBukkit end
this.locale = packetplayinsettings.a();
this.cg = packetplayinsettings.c();
this.ch = packetplayinsettings.d();
@@ -931,7 +1139,7 @@
this.cj = (Entity) (entity == null ? this : entity);
if (entity1 != this.cj) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cj));
- this.enderTeleportTo(this.cj.locX, this.cj.locY, this.cj.locZ);
+ this.playerConnection.a(this.cj.locX, this.cj.locY, this.cj.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
this.cm = packetplayinsettings.c();
this.cn = packetplayinsettings.d();
@@ -1054,7 +1273,7 @@
this.cp = (Entity) (entity == null ? this : entity);
if (entity1 != this.cp) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cp));
- this.enderTeleportTo(this.cp.locX, this.cp.locY, this.cp.locZ);
+ this.playerConnection.a(this.cp.locX, this.cp.locY, this.cp.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
}
}
@@ -958,7 +1166,7 @@
@@ -1081,7 +1300,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@ -518,24 +590,28 @@
}
public void a(EnumHand enumhand) {
@@ -975,11 +1183,151 @@
@@ -1098,12 +1317,17 @@
}
public void M() {
public void N() {
+ if (!CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) // CraftBukkit
this.setFlag(7, true);
}
public void N() {
- this.setFlag(7, true);
- this.setFlag(7, false);
public void O() {
+ // CraftBukkit start
+ if (!CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) {
+ this.setFlag(7, true);
+ this.setFlag(7, false);
this.setFlag(7, true);
this.setFlag(7, false);
+ }
+ // CraftBukkit end
+ }
}
public AdvancementDataPlayer getAdvancementData() {
@@ -1114,4 +1338,139 @@
public Vec3D Q() {
return this.cw;
}
+
+ // CraftBukkit start - Add per-player time and weather.
+ public long timeOffset = 0;
@ -669,6 +745,6 @@
+ @Override
+ public CraftPlayer getBukkitEntity() {
+ return (CraftPlayer) super.getBukkitEntity();
}
+ }
+ // CraftBukkit end
}

View File

@ -12,7 +12,7 @@
+
public class EntitySheep extends EntityAnimal {
private static final DataWatcherObject<Byte> bw = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
private static final DataWatcherObject<Byte> bx = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
@@ -12,6 +18,13 @@
public boolean a(EntityHuman entityhuman) {
return false;
@ -25,9 +25,9 @@
+ }
+ // CraftBukkit end
}, 2, 1);
private static final Map<EnumColor, float[]> by = Maps.newEnumMap(EnumColor.class);
private int bA;
@@ -26,6 +39,7 @@
private static final Map<EnumColor, float[]> bz = Maps.newEnumMap(EnumColor.class);
private int bB;
@@ -29,6 +42,7 @@
this.setSize(0.9F, 1.3F);
this.container.setItem(0, new ItemStack(Items.DYE));
this.container.setItem(1, new ItemStack(Items.DYE));
@ -35,7 +35,7 @@
}
protected void r() {
@@ -128,11 +142,22 @@
@@ -131,11 +145,22 @@
if (itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) {
if (!this.world.isClientSide) {
@ -58,7 +58,7 @@
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
@@ -219,6 +244,12 @@
@@ -222,6 +247,12 @@
}
public void A() {

View File

@ -11,33 +11,6 @@
public class EntityShulker extends EntityGolem implements IMonster {
@@ -14,7 +18,7 @@
protected static final DataWatcherObject<EnumDirection> a = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.l);
protected static final DataWatcherObject<Optional<BlockPosition>> b = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.k);
protected static final DataWatcherObject<Byte> c = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
- protected static final DataWatcherObject<Byte> bw = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
+ public static final DataWatcherObject<Byte> bw = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a); // PAIL: protected -> public, rename COLOR
public static final EnumColor bx = EnumColor.PURPLE;
private float bA;
private float bB;
@@ -65,7 +69,7 @@
}
public void D() {
- if (!this.do()) {
+ if (!this.do_()) {
super.D();
}
@@ -76,7 +80,7 @@
}
protected SoundEffect bW() {
- return this.do() ? SoundEffects.fH : SoundEffects.fG;
+ return this.do_() ? SoundEffects.fH : SoundEffects.fG;
}
protected void i() {
@@ -112,7 +116,7 @@
this.datawatcher.set(EntityShulker.b, Optional.of(new BlockPosition(i, j, k)));
@ -67,21 +40,3 @@
break;
}
}
@@ -390,7 +403,7 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
- if (this.do()) {
+ if (this.do_()) {
Entity entity = damagesource.i();
if (entity instanceof EntityArrow) {
@@ -409,7 +422,7 @@
}
}
- private boolean do() {
+ private boolean do_() {
return this.dj() == 0;
}

View File

@ -9,12 +9,12 @@
public abstract class EntitySkeletonAbstract extends EntityMonster implements IRangedEntity {
private static final DataWatcherObject<Boolean> a = DataWatcher.a(EntitySkeletonAbstract.class, DataWatcherRegistry.h);
private final PathfinderGoalBowShoot b = new PathfinderGoalBowShoot(this, 1.0D, 20, 15.0F);
private final PathfinderGoalBowShoot<EntitySkeletonAbstract> b = new PathfinderGoalBowShoot(this, 1.0D, 20, 15.0F);
- private final PathfinderGoalMeleeAttack c = new PathfinderGoalMeleeAttack(this, 1.2D, flag) {
+ private final PathfinderGoalMeleeAttack c = new PathfinderGoalMeleeAttack(this, 1.2D, false) { // CraftBukkit - decompile error
public void d() {
super.d();
EntitySkeletonAbstract.this.a(false);
EntitySkeletonAbstract.this.p(false);
@@ -80,7 +81,14 @@
}
@ -31,24 +31,7 @@
}
}
}
@@ -99,7 +107,7 @@
}
public void die(DamageSource damagesource) {
- super.die(damagesource);
+ // super.die(damagesource); // CraftBukkit
if (damagesource.i() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
@@ -109,6 +117,7 @@
entityhuman.b((Statistic) AchievementList.v);
}
}
+ super.die(damagesource); // CraftBukkit - moved from above
}
@@ -166,8 +175,19 @@
@@ -152,8 +160,19 @@
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
@ -63,7 +46,7 @@
+ world.addEntity(entityarrow);
+ }
+ // CraftBukkit end
this.a(SoundEffects.fV, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
this.a(SoundEffects.gW, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
- this.world.addEntity(entityarrow);
+ // this.world.addEntity(entityarrow); // CraftBukkit - moved up
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntitySlice.java
+++ b/net/minecraft/server/EntitySlice.java
@@ -12,7 +12,7 @@
@@ -13,7 +13,7 @@
public class EntitySlice<T> extends AbstractSet<T> {
@ -9,7 +9,7 @@
private final Map<Class<?>, List<T>> b = Maps.newHashMap();
private final Set<Class<?>> c = Sets.newIdentityHashSet();
private final Class<T> d;
@@ -40,7 +40,7 @@
@@ -41,7 +41,7 @@
Object object = iterator.next();
if (oclass.isAssignableFrom(object.getClass())) {
@ -18,7 +18,7 @@
}
}
@@ -77,7 +77,7 @@
@@ -78,7 +78,7 @@
List list = (List) this.b.get(oclass);
if (list == null) {
@ -27,12 +27,3 @@
} else {
list.add(t0);
}
@@ -125,7 +125,7 @@
}
public Iterator<T> iterator() {
- return this.e.isEmpty() ? Iterators.emptyIterator() : Iterators.unmodifiableIterator(this.e.iterator());
+ return this.e.isEmpty() ? Iterators.<T>emptyIterator() : Iterators.unmodifiableIterator(this.e.iterator());
}
public int size() {

View File

@ -17,7 +17,7 @@
public EntityTNTPrimed(World world) {
super(world);
@@ -63,10 +66,13 @@
@@ -64,10 +67,13 @@
--this.c;
if (this.c <= 0) {
@ -30,9 +30,9 @@
+ this.die();
+ // CraftBukkit end
} else {
this.ak();
this.aq();
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]);
@@ -75,9 +81,17 @@
@@ -76,9 +82,17 @@
}
private void explode() {

View File

@ -1,10 +1,9 @@
--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
@@ -116,11 +116,30 @@
@@ -116,6 +116,25 @@
}
}
- public int o() {
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
@ -24,12 +23,6 @@
+ }
+ // CraftBukkit end
+
+ public int o() { // PAIL: rename getColor
public int getColor() {
return ((Integer) this.datawatcher.get(EntityTippedArrow.f)).intValue();
}
- private void d(int i) {
+ public void d(int i) { // PAIL: private -> public, rename setColor
this.at = true;
this.datawatcher.set(EntityTippedArrow.f, Integer.valueOf(i));
}

View File

@ -15,7 +15,7 @@
public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
@@ -36,7 +44,7 @@
@@ -37,7 +45,7 @@
public EntityVillager(World world, int i) {
super(world);
@ -24,7 +24,7 @@
this.setProfession(i);
this.setSize(0.6F, 1.95F);
((Navigation) this.getNavigation()).a(true);
@@ -118,7 +126,14 @@
@@ -119,7 +127,14 @@
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
if (merchantrecipe.h()) {
@ -40,7 +40,7 @@
}
}
@@ -454,7 +469,20 @@
@@ -460,7 +475,20 @@
for (int l = 0; l < k; ++l) {
EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l];

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityWither.java
+++ b/net/minecraft/server/EntityWither.java
@@ -6,6 +6,12 @@
@@ -5,6 +5,12 @@
import java.util.List;
import javax.annotation.Nullable;
@ -13,9 +13,9 @@
public class EntityWither extends EntityMonster implements IRangedEntity {
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
@@ -193,13 +199,38 @@
if (this.dh() > 0) {
i = this.dh() - 1;
@@ -192,13 +198,38 @@
if (this.dk() > 0) {
i = this.dk() - 1;
if (i <= 0) {
- this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
- this.world.a(1023, new BlockPosition(this), 0);
@ -55,7 +55,7 @@
}
} else {
@@ -290,6 +321,11 @@
@@ -289,6 +320,11 @@
Block block = iblockdata.getBlock();
if (iblockdata.getMaterial() != Material.AIR && a(block)) {
@ -67,7 +67,7 @@
flag = this.world.setAir(blockposition, true) || flag;
}
}
@@ -303,7 +339,7 @@
@@ -302,7 +338,7 @@
}
if (this.ticksLived % 20 == 0) {
@ -75,4 +75,4 @@
+ this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
}
this.bF.setProgress(this.getHealth() / this.getMaxHealth());
this.bG.setProgress(this.getHealth() / this.getMaxHealth());

View File

@ -60,25 +60,25 @@
@@ -266,7 +288,7 @@
this.goalSit.setSitting(!this.isSitting());
this.bd = false;
this.navigation.o();
this.navigation.p();
- this.setGoalTarget((EntityLiving) null);
+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
}
} else if (itemstack.getItem() == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -274,12 +296,14 @@
@@ -274,12 +296,13 @@
}
if (!this.world.isClientSide) {
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.setTamed(true);
this.navigation.o();
this.c(entityhuman);
this.navigation.p();
this.setGoalTarget((EntityLiving) null);
this.goalSit.setSitting(true);
this.setHealth(20.0F);
- this.setHealth(20.0F);
+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth()
this.setOwnerUUID(entityhuman.getUniqueID());
this.p(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {

View File

@ -1,17 +1,17 @@
--- a/net/minecraft/server/EntityZombieVillager.java
+++ b/net/minecraft/server/EntityZombieVillager.java
@@ -7,6 +7,7 @@
private static final DataWatcherObject<Boolean> b = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.h);
@@ -9,6 +9,7 @@
private static final DataWatcherObject<Integer> c = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.b);
private int conversionTime;
private UUID by;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombieVillager(World world) {
super(world);
@@ -54,6 +55,11 @@
public void A_() {
@@ -60,6 +61,11 @@
public void B_() {
if (!this.world.isClientSide && this.isConverting()) {
int i = this.dq();
int i = this.ds();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.lastTick = MinecraftServer.currentTick;
@ -20,12 +20,12 @@
this.conversionTime -= i;
if (this.conversionTime <= 0) {
@@ -116,7 +122,7 @@
@@ -123,7 +129,7 @@
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
}
- this.world.addEntity(entityvillager);
+ this.world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
this.world.a((EntityHuman) null, 1027, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
EntityHuman entityhuman = this.world.b(this.by);
if (entityhuman instanceof EntityPlayer) {

View File

@ -64,7 +64,7 @@
this.a(f);
this.foodTickTimer = 0;
}
} else if (flag && this.foodLevel >= 18 && entityhuman.db()) {
} else if (flag && this.foodLevel >= 18 && entityhuman.dh()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- entityhuman.heal(1.0F);

View File

@ -57,8 +57,8 @@
+ }
+ // CraftBukkit end
+
if (packethandshakinginsetprotocol.b() > 316) {
chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.11.2");
if (packethandshakinginsetprotocol.b() > 329) {
chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.12-pre2");
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
@@ -26,6 +71,7 @@
this.b.close(chatcomponenttext);

View File

@ -1,9 +1,13 @@
--- a/net/minecraft/server/IRecipe.java
+++ b/net/minecraft/server/IRecipe.java
@@ -11,4 +11,6 @@
ItemStack b();
@@ -28,7 +28,9 @@
return ((MinecraftKey) CraftingManager.recipes.b(this)).a((MinecraftKey) CraftingManager.recipes.b(irecipe));
}
NonNullList<ItemStack> b(InventoryCrafting inventorycrafting);
- public int compareTo(Object object) {
+ public int compareTo(IRecipe object) { // CraftBukkit = decompile error
return this.a((IRecipe) object);
}
+
+ org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
+ public abstract org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
}

View File

@ -1,9 +1,9 @@
--- a/net/minecraft/server/InventoryCraftResult.java
+++ b/net/minecraft/server/InventoryCraftResult.java
@@ -1,11 +1,44 @@
package net.minecraft.server;
@@ -2,12 +2,45 @@
import java.util.Iterator;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@ -13,6 +13,7 @@
public class InventoryCraftResult implements IInventory {
private final NonNullList<ItemStack> items;
private IRecipe b;
+ // CraftBukkit start
+ private int maxStack = MAX_STACK;
@ -45,7 +46,7 @@
public InventoryCraftResult() {
this.items = NonNullList.a(1, ItemStack.a);
}
@@ -59,7 +92,7 @@
@@ -61,7 +94,7 @@
}
public int getMaxStackSize() {

View File

@ -17,7 +17,7 @@
@@ -9,6 +17,53 @@
private final int c;
private final Container d;
public final Container container;
+ // CraftBukkit start - add fields
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@ -68,4 +68,4 @@
+
public InventoryCrafting(Container container, int i, int j) {
this.items = NonNullList.a(i * j, ItemStack.a);
this.d = container;
this.container = container;

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ItemBlock.java
+++ b/net/minecraft/server/ItemBlock.java
@@ -33,7 +33,7 @@
@@ -36,7 +36,7 @@
SoundEffectType soundeffecttype = this.a.getStepSound();

View File

@ -26,7 +26,7 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11);
entityhuman.b(StatisticList.b((Item) this));
entityhuman.a(SoundEffects.P, 1.0F, 1.0F);
entityhuman.a(SoundEffects.S, 1.0F, 1.0F);
- return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.WATER_BUCKET));
+ return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.WATER_BUCKET, event.getItemStack())); // CraftBukkit
} else if (material == Material.LAVA && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0) {
@ -37,7 +37,7 @@
+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
+ }
+ // CraftBukkit end
entityhuman.a(SoundEffects.Q, 1.0F, 1.0F);
entityhuman.a(SoundEffects.T, 1.0F, 1.0F);
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11);
entityhuman.b(StatisticList.b((Item) this));
- return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.LAVA_BUCKET));
@ -51,10 +51,10 @@
return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
- } else if (this.a(entityhuman, world, blockposition1)) {
+ } else if (this.a(entityhuman, world, blockposition1, movingobjectposition.direction, blockposition, itemstack)) { // CraftBukkit
entityhuman.b(StatisticList.b((Item) this));
return !entityhuman.abilities.canInstantlyBuild ? new InteractionResultWrapper(EnumInteractionResult.SUCCESS, new ItemStack(Items.BUCKET)) : new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack);
} else {
@@ -63,16 +83,19 @@
if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.x.a((EntityPlayer) entityhuman, blockposition, itemstack);
}
@@ -67,16 +87,19 @@
}
}
@ -78,7 +78,7 @@
}
return itemstack;
@@ -80,7 +103,13 @@
@@ -84,7 +107,13 @@
}
}
@ -92,7 +92,7 @@
if (this.a == Blocks.AIR) {
return false;
} else {
@@ -92,6 +121,15 @@
@@ -96,6 +125,15 @@
if (!world.isEmpty(blockposition) && !flag && !flag1) {
return false;
} else {

View File

@ -13,7 +13,7 @@
public ItemChorusFruit(int i, float f) {
@@ -19,6 +25,20 @@
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.Z() - 1));
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.ab() - 1));
double d5 = entityliving.locZ + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D;
+ // CraftBukkit start

View File

@ -1,26 +0,0 @@
--- a/net/minecraft/server/ItemCooldown.java
+++ b/net/minecraft/server/ItemCooldown.java
@@ -7,8 +7,8 @@
public class ItemCooldown {
- private final Map<Item, ItemCooldown.Info> a = Maps.newHashMap();
- private int b;
+ public final Map<Item, ItemCooldown.Info> a = Maps.newHashMap(); // PAIL: private->public
+ public int b; // PAIL: currentTick, private->public
public ItemCooldown() {}
@@ -55,10 +55,10 @@
protected void c(Item item) {}
- class Info {
+ public class Info { // PAIL: private->public
final int a;
- final int b;
+ public final int b; // PAIL: endTick, private->public
private Info(int i, int j) {
this.a = i;

View File

@ -21,8 +21,8 @@
itemstack.subtract(1);
}
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.bj, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.j.nextFloat() * 0.4F + 0.8F));
entityhuman.di().a(this, 20);
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.bn, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.j.nextFloat() * 0.4F + 0.8F));
entityhuman.getCooldownTracker().a(this, 20);
- if (!world.isClientSide) {
- EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, entityhuman);
-

View File

@ -12,6 +12,6 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
world.a((EntityHuman) null, blockposition, SoundEffects.bx, SoundCategory.BLOCKS, 1.0F, (ItemFireball.j.nextFloat() - ItemFireball.j.nextFloat()) * 0.2F + 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.bD, SoundCategory.BLOCKS, 1.0F, (ItemFireball.j.nextFloat() - ItemFireball.j.nextFloat()) * 0.2F + 1.0F);
world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
}

View File

@ -8,16 +8,17 @@
public class ItemFishingRod extends Item {
public ItemFishingRod() {
@@ -19,7 +21,6 @@
itemstack.damage(i, entityhuman);
@@ -20,7 +22,7 @@
entityhuman.a(enumhand);
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.J, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
} else {
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.I, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.L, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
+ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.L, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
if (!world.isClientSide) {
EntityFishingHook entityfishinghook = new EntityFishingHook(world, entityhuman);
int j = EnchantmentManager.c(itemstack);
@@ -34,6 +35,17 @@
entityfishinghook.b(k);
@@ -35,6 +37,17 @@
entityfishinghook.c(k);
}
+ // CraftBukkit start
@ -28,7 +29,7 @@
+ entityhuman.hookedFish = null;
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.I, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.L, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
+ // CraftBukkit end
+
world.addEntity(entityfishinghook);

View File

@ -10,6 +10,6 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
world.a(entityhuman, blockposition, SoundEffects.bI, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.j.nextFloat() * 0.4F + 0.8F);
world.a(entityhuman, blockposition, SoundEffects.bO, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.j.nextFloat() * 0.4F + 0.8F);
world.setTypeAndData(blockposition, Blocks.FIRE.getBlockData(), 11);
}

View File

@ -27,6 +27,6 @@
+ return EnumInteractionResult.FAIL;
+ }
+ // CraftBukkit end
entityhanging.o();
entityhanging.p();
world.addEntity(entityhanging);
}

View File

@ -10,7 +10,7 @@
itemstack.subtract(1);
}
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.go, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.hp, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
+ */
if (!world.isClientSide) {
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
@ -22,7 +22,7 @@
+ itemstack.subtract(1);
+ }
+
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.go, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.hp, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
+ } else if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }

View File

@ -20,7 +20,7 @@
public final class ItemStack {
public static final ItemStack a = new ItemStack((Item) null);
@@ -42,32 +55,68 @@
@@ -42,32 +55,74 @@
this(item, i, 0);
}
@ -53,9 +53,15 @@
+ // Called to run this stack through the data converter to handle older storage methods and serialized items
+ public void convertStack() {
+ if (MinecraftServer.getServer() != null) {
+ // Don't convert beds - both the old and new data values are valid
+ // Conversion would make getting white beds (data value 0) impossible
+ if (this.item == Items.BED) {
+ return;
+ }
+
+ NBTTagCompound savedStack = new NBTTagCompound();
+ this.save(savedStack);
+ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
+ MinecraftServer.getServer().dataConverterManager.a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert
+ this.load(savedStack);
+ }
+ }
@ -94,7 +100,7 @@
this.F();
}
@@ -94,11 +143,138 @@
@@ -94,11 +149,138 @@
}
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
@ -234,7 +240,7 @@
return enuminteractionresult;
}
@@ -122,7 +298,7 @@
@@ -122,7 +304,7 @@
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@ -243,7 +249,7 @@
}
return nbttagcompound;
@@ -157,11 +333,30 @@
@@ -157,11 +339,30 @@
}
public void setData(int i) {
@ -276,9 +282,9 @@
}
public int k() {
@@ -198,6 +393,11 @@
@@ -202,6 +403,11 @@
if (this.f()) {
if (this.isDamaged(i, entityliving.getRandom())) {
if (this.isDamaged(i, entityliving.getRandom(), entityliving instanceof EntityPlayer ? (EntityPlayer) entityliving : null)) {
entityliving.b(this);
+ // CraftBukkit start - Check for item breaking
+ if (this.count == 1 && entityliving instanceof EntityHuman) {
@ -288,16 +294,16 @@
this.subtract(1);
if (entityliving instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entityliving;
@@ -239,7 +439,7 @@
@@ -243,7 +449,7 @@
}
public ItemStack cloneItemStack() {
- ItemStack itemstack = new ItemStack(this.item, this.count, this.damage);
+ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage, false); // CraftBukkit
itemstack.d(this.D());
if (this.tag != null) {
itemstack.tag = this.tag.g();
@@ -509,6 +709,12 @@
@@ -514,6 +720,12 @@
nbttaglist.add(nbttagcompound);
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/JsonList.java
+++ b/net/minecraft/server/JsonList.java
@@ -83,7 +83,7 @@
@@ -84,7 +84,7 @@
public V get(K k0) {
this.h();
@ -9,7 +9,7 @@
}
public void remove(K k0) {
@@ -101,6 +101,12 @@
@@ -102,6 +102,12 @@
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
}
@ -22,7 +22,7 @@
public boolean isEmpty() {
return this.d.size() < 1;
}
@@ -176,7 +182,7 @@
@@ -177,7 +183,7 @@
JsonListEntry jsonlistentry = (JsonListEntry) iterator.next();
if (jsonlistentry.getKey() != null) {
@ -31,7 +31,7 @@
}
}
}
@@ -204,11 +210,11 @@
@@ -205,11 +211,11 @@
}
}

View File

@ -99,7 +99,7 @@
+ }
+ }
+ // CraftBukkit end
LoginListener.c.info("UUID of player {} is {}", new Object[] { LoginListener.this.i.getName(), LoginListener.this.i.getId()});
LoginListener.c.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.R()) {
@@ -171,6 +217,11 @@

View File

@ -21,7 +21,7 @@
public void a(String s) {
+ if (!ENABLED) return; // CraftBukkit
if (this.a) {
if (this.e.length() > 0) {
if (!this.e.isEmpty()) {
this.e = this.e + ".";
@@ -40,6 +43,7 @@
}
@ -51,7 +51,7 @@
public String c() {
+ if (!ENABLED) return "[DISABLED]"; // CraftBukkit
return this.c.size() == 0 ? "[UNKNOWN]" : (String) this.c.get(this.c.size() - 1);
return this.c.isEmpty() ? "[UNKNOWN]" : (String) this.c.get(this.c.size() - 1);
}
@@ -152,7 +158,7 @@

Some files were not shown because too many files have changed in this diff Show More