Update to Minecraft 1.13.1

This commit is contained in:
md_5 2018-08-26 12:00:00 +10:00
parent 162bda93ff
commit ce1af0c348
182 changed files with 1891 additions and 1879 deletions

View File

@ -10,8 +10,8 @@
this.d = minecraftkey;
@@ -46,7 +47,7 @@
EnumChatFormat enumchatformat = advancementdisplay.e().c();
IChatBaseComponent ichatbasecomponent1 = ichatbasecomponent.e().a(enumchatformat).a("\n").addSibling(advancementdisplay.b());
IChatBaseComponent ichatbasecomponent2 = ichatbasecomponent.e().a((chatmodifier) -> {
IChatBaseComponent ichatbasecomponent1 = ichatbasecomponent.h().a(enumchatformat).a("\n").addSibling(advancementdisplay.b());
IChatBaseComponent ichatbasecomponent2 = ichatbasecomponent.h().a((chatmodifier) -> {
- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent));
+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent1)); // CraftBukkit - decompile error
});

View File

@ -29,7 +29,7 @@
dynamic = dynamic.set("DataVersion", dynamic.createInt(1343));
@@ -148,7 +148,7 @@
dynamic = this.d.aB().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1519);
dynamic = this.d.az().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1628);
dynamic = dynamic.remove("DataVersion");
- Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue());
+ Map<MinecraftKey, AdvancementProgress> map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); // CraftBukkit - decompile error

View File

@ -1,15 +1,15 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -17,7 +17,7 @@
public static final RegistryBlocks<MinecraftKey, Block> REGISTRY = new RegistryBlocks(Block.a);
public static final RegistryBlockID<IBlockData> REGISTRY_ID = new RegistryBlockID();
protected final int g;
- protected final float strength;
+ public final float strength; // PAIL: private -> public
protected final float durability;
protected final boolean j;
protected final SoundEffectType stepSound;
@@ -212,7 +212,7 @@
@@ -32,7 +32,7 @@
@Nullable
private String name;
private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.a>> q = ThreadLocal.withInitial(() -> {
- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) {
+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.a>(200) { // CraftBukkit - decompile error
protected void rehash(int i) {}
};
@@ -194,7 +194,7 @@
}
public Block(Block.Info block_info) {
@ -18,7 +18,7 @@
this.a(blockstatelist_a);
this.blockStateList = blockstatelist_a.a(BlockData::new);
@@ -427,7 +427,8 @@
@@ -409,7 +409,8 @@
int j = this.getDropCount(iblockdata, i, world, blockposition, world.random);
for (int k = 0; k < j; ++k) {
@ -28,7 +28,7 @@
Item item = this.getDropType(iblockdata, world, blockposition, i).getItem();
if (item != Items.AIR) {
@@ -448,7 +449,13 @@
@@ -430,7 +431,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.n();
@ -43,16 +43,16 @@
}
}
@@ -667,7 +674,7 @@
@@ -649,7 +656,7 @@
}
public String toString() {
- return "Block{" + Block.REGISTRY.b(this) + "}";
+ return Block.REGISTRY.b(this).toString(); // CraftBukkit - cheap hack
- return "Block{" + IRegistry.BLOCK.getKey(this) + "}";
+ return IRegistry.BLOCK.getKey(this).toString(); // CraftBukkit - cheap hack
}
public static boolean c(Block block) {
@@ -1406,6 +1413,12 @@
@@ -1398,8 +1405,14 @@
}
@ -63,5 +63,8 @@
+ // CraftBukkit end
+
private static void a(MinecraftKey minecraftkey, Block block) {
Block.REGISTRY.a(minecraftkey, block);
- IRegistry.BLOCK.a(minecraftkey, (Object) block);
+ IRegistry.BLOCK.a(minecraftkey, block); // CraftBukkit - decompile error
}
private static void a(String s, Block block) {

View File

@ -33,7 +33,7 @@
this.a(entityhuman, world, blockposition, true);
this.c(iblockdata, world, blockposition);
@@ -118,6 +136,16 @@
if (this.F) {
if (this.E) {
this.b(iblockdata, world, blockposition);
} else {
+ // CraftBukkit start

View File

@ -8,7 +8,7 @@
+
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockProperties.W;
public static final BlockStateInteger AGE = BlockProperties.X;
@@ -31,7 +33,7 @@
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();

View File

@ -7,7 +7,7 @@
+
public class BlockCauldron extends Block {
public static final BlockStateInteger LEVEL = BlockProperties.ae;
public static final BlockStateInteger LEVEL = BlockProperties.af;
@@ -32,8 +34,13 @@
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
@ -137,7 +137,7 @@
}
if (itemstack.isEmpty()) {
@@ -171,9 +208,25 @@
@@ -172,9 +209,25 @@
}
}
@ -164,7 +164,7 @@
}
public void c(World world, BlockPosition blockposition) {
@@ -184,7 +237,7 @@
@@ -185,7 +238,7 @@
IBlockData iblockdata = world.getType(blockposition);
if (((Integer) iblockdata.get(BlockCauldron.LEVEL)).intValue() < 3) {

View File

@ -8,7 +8,7 @@
+
public class BlockChorusFlower extends Block {
public static final BlockStateInteger AGE = BlockProperties.U;
public static final BlockStateInteger AGE = BlockProperties.V;
@@ -61,8 +63,12 @@
}

View File

@ -8,7 +8,7 @@
+
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
public static final BlockStateInteger AGE = BlockProperties.S;
public static final BlockStateInteger AGE = BlockProperties.T;
@@ -21,7 +23,7 @@
int i = ((Integer) iblockdata.get(BlockCocoa.AGE)).intValue();

View File

@ -14,7 +14,7 @@
@@ -11,7 +16,7 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
if (iblockdata1.getMaterial().isLiquid()) {
if (x(iblockdata1)) {
- world.setTypeAndData(blockposition, this.a, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit
}
@ -24,9 +24,9 @@
World world = blockactioncontext.getWorld();
BlockPosition blockposition = blockactioncontext.getClickPosition();
- return !blockactioncontext.getWorld().getType(blockactioncontext.getClickPosition()).getMaterial().isLiquid() && !a((IBlockAccess) world, blockposition) ? super.getPlacedState(blockactioncontext) : this.a;
- return !x(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition) ? super.getPlacedState(blockactioncontext) : this.a;
+ // CraftBukkit start
+ if (!blockactioncontext.getWorld().getType(blockactioncontext.getClickPosition()).getMaterial().isLiquid() && !a((IBlockAccess) world, blockposition)) {
+ if (!x(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition)) {
+ return super.getPlacedState(blockactioncontext);
+ }
+
@ -46,7 +46,7 @@
}
private static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition) {
@@ -45,6 +67,20 @@
@@ -51,6 +73,20 @@
}
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {

View File

@ -5,10 +5,10 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.b.getBlockData().set(BlockCoralFan.a, Boolean.valueOf(false))).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData().set(BlockCoralFan.b, Boolean.valueOf(false))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) this.b.getBlockData().set(BlockCoralFan.a, Boolean.valueOf(false)), 2);
world.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, Boolean.valueOf(false)), 2);
}

View File

@ -5,10 +5,10 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.a, Boolean.valueOf(false)).set(BlockCoralFanWall.b, iblockdata.get(BlockCoralFanWall.b))).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, Boolean.valueOf(false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.a, Boolean.valueOf(false))).set(BlockCoralFanWall.b, iblockdata.get(BlockCoralFanWall.b)), 2);
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, Boolean.valueOf(false))).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2);
}

View File

@ -8,7 +8,7 @@
+
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger AGE = BlockProperties.V;
public static final BlockStateInteger AGE = BlockProperties.W;
@@ -49,7 +51,7 @@
float f = a((Block) this, (IBlockAccess) world, blockposition);

View File

@ -27,4 +27,4 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, Boolean.valueOf(true)), 2);
if (!flag1) {
world.I().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);
world.J().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);

View File

@ -1,14 +1,18 @@
--- a/net/minecraft/server/BlockDispenser.java
+++ b/net/minecraft/server/BlockDispenser.java
@@ -7,6 +7,7 @@
@@ -9,9 +9,10 @@
public static final BlockStateDirection FACING = BlockDirectional.FACING;
public static final BlockStateBoolean TRIGGERED = BlockProperties.w;
public static final RegistryDefault<Item, IDispenseBehavior> REGISTRY = new RegistryDefault(new DispenseBehaviorItem());
- public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
+ public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
});
+ public static boolean eventFired = false; // CraftBukkit
public static void a(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
BlockDispenser.REGISTRY.a(imaterial.getItem(), idispensebehavior);
@@ -52,6 +53,7 @@
BlockDispenser.REGISTRY.put(imaterial.getItem(), idispensebehavior);
@@ -57,6 +58,7 @@
IDispenseBehavior idispensebehavior = this.a(itemstack);
if (idispensebehavior != IDispenseBehavior.NONE) {

View File

@ -17,6 +17,6 @@
+ 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.d(1);
entity.a(DimensionManager.THE_END);
}

View File

@ -16,7 +16,7 @@
+
public class BlockFire extends Block {
public static final BlockStateInteger AGE = BlockProperties.W;
public static final BlockStateInteger AGE = BlockProperties.X;
@@ -32,7 +42,20 @@
}
@ -58,7 +58,7 @@
int j = Math.min(15, i + random.nextInt(3) / 2);
@@ -103,14 +126,14 @@
world.I().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
world.J().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
if (!this.d(world, blockposition)) {
if (!world.getType(blockposition.down()).q() || i > 3) {
- world.setAir(blockposition);
@ -140,12 +140,12 @@
@@ -241,7 +286,7 @@
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
if (!iblockdata.canPlace(world, blockposition)) {
- world.setAir(blockposition);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
} else {
world.I().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
world.J().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
}
@@ -387,4 +432,12 @@
blockfire.a(Blocks.BLACK_CARPET, 60, 20);

View File

@ -1,12 +1,12 @@
--- a/net/minecraft/server/BlockFluids.java
+++ b/net/minecraft/server/BlockFluids.java
@@ -46,10 +46,10 @@
@@ -57,10 +57,10 @@
public VoxelShape a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
Fluid fluid = iblockaccess.b(blockposition.up());
- return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.c.computeIfAbsent(iblockdata, (iblockdata) -> {
- return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata) -> {
- Fluid fluid = iblockdata.s();
+ return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.c.computeIfAbsent(iblockdata, (iblockdata1) -> { // CraftBukkit - decompile errors
+ return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata1) -> { // CraftBukkit - decompile errors
+ Fluid fluid1 = iblockdata1.s();
- return VoxelShapes.a(0.0D, 0.0D, 0.0D, 1.0D, (double) fluid.f(), 1.0D);
@ -14,7 +14,7 @@
});
}
@@ -106,14 +106,20 @@
@@ -117,14 +117,20 @@
Fluid fluid = world.b(blockposition);
if (fluid.d()) {

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/server/BlockGrass.java
+++ b/net/minecraft/server/BlockGrass.java
@@ -51,7 +51,7 @@
}
@@ -58,7 +58,7 @@
}
if (iblockdata2.canPlace(world, blockposition2)) {
- world.setTypeAndData(blockposition2, iblockdata2, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata2, 3); // CraftBukkit
if (iblockdata3.canPlace(world, blockposition2)) {
- world.setTypeAndData(blockposition2, iblockdata3, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata3, 3); // CraftBukkit
}
}
}
}

View File

@ -8,7 +8,7 @@
+
public class BlockLeaves extends Block {
public static final BlockStateInteger DISTANCE = BlockProperties.aa;
public static final BlockStateInteger DISTANCE = BlockProperties.ab;
@@ -20,6 +22,14 @@
public void b(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {

View File

@ -8,7 +8,7 @@
+
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.R;
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.S;
@@ -55,6 +57,17 @@
flag1 = true;
}

View File

@ -26,5 +26,5 @@
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, Boolean.valueOf(true)), 2);
world.I().a(blockposition, this, 2);
world.J().a(blockposition, this, 2);
}

View File

@ -38,7 +38,7 @@
world.playBlockAction(blockposition, this, b0, enumdirection.a());
}
@@ -271,6 +295,48 @@
@@ -285,6 +309,48 @@
IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
HashSet hashset = Sets.newHashSet(list);
@ -86,4 +86,4 @@
+ // CraftBukkit end
int k;
BlockPosition blockposition2;
BlockPosition blockposition3;

View File

@ -12,7 +12,7 @@
+
public class BlockPortal extends Block {
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.y;
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.z;
@@ -37,7 +43,8 @@
}

View File

@ -7,7 +7,7 @@
+
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.R;
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.S;
@@ -106,6 +108,13 @@
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);

View File

@ -7,7 +7,7 @@
+
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
public static final BlockStateInteger POWER = BlockProperties.ak;
public static final BlockStateInteger POWER = BlockProperties.al;
@@ -12,7 +14,31 @@
}

View File

@ -8,7 +8,7 @@
+
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.ap;
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.aq;
@@ -65,7 +67,8 @@
@Nullable

View File

@ -11,7 +11,7 @@
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -33,6 +35,11 @@
if (flag) {
world.I().a(blockposition, this, 4);
world.J().a(blockposition, this, 4);
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {

View File

@ -8,8 +8,8 @@
+
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.L;
@@ -215,6 +217,15 @@
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.M;
@@ -216,6 +218,15 @@
j = k;
}

View File

@ -15,7 +15,7 @@
+
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger STAGE = BlockProperties.al;
public static final BlockStateInteger STAGE = BlockProperties.am;
protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
private final WorldGenTreeProvider c;
+ public static TreeType treeType; // CraftBukkit

View File

@ -11,7 +11,7 @@
+
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockProperties.ah;
public static final BlockStateInteger MOISTURE = BlockProperties.ai;
@@ -63,14 +68,37 @@
}
@ -42,12 +42,12 @@
+ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up
}
protected static void b(IBlockData iblockdata, World world, BlockPosition blockposition) {
public static void b(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeUpdate(blockposition, a(iblockdata, Blocks.DIRT.getBlockData(), (GeneratorAccess) world, blockposition));
world.setTypeUpdate(blockposition, a(iblockdata, Blocks.DIRT.getBlockData(), world, blockposition));
}

View File

@ -24,7 +24,7 @@
@@ -49,20 +56,20 @@
Material material = iblockdata.getMaterial();
if (fluid.a(TagsFluid.a)) {
if (fluid.a(TagsFluid.WATER)) {
- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(world, blockposition2, iblockdata) != FluidTypes.a) {
+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(blockList, blockposition2, iblockdata) != FluidTypes.a) { // CraftBukkit
++i;

View File

@ -8,7 +8,7 @@
+
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger AGE = BlockProperties.V;
public static final BlockStateInteger AGE = BlockProperties.W;
@@ -33,14 +35,14 @@
if (i < 7) {

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/server/BlockTNT.java
+++ b/net/minecraft/server/BlockTNT.java
@@ -72,6 +72,11 @@
EntityArrow entityarrow = (EntityArrow) entity;
@@ -90,6 +90,11 @@
Entity entity1 = entityarrow.getShooter();
if (entityarrow.isBurning()) {
+ // CraftBukkit start
@ -9,6 +9,6 @@
+ return;
+ }
+ // CraftBukkit end
this.a(world, blockposition, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
this.a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null);
world.setAir(blockposition);
}

View File

@ -13,7 +13,7 @@
public class BlockTurtleEgg extends Block {
@@ -35,6 +41,19 @@
@@ -33,6 +39,19 @@
super.stepOn(world, blockposition, entity);
} else {
if (!world.isClientSide && world.random.nextInt(i) == 0) {
@ -30,10 +30,10 @@
+ return;
+ }
+ // CraftBukkit end
this.a(world, blockposition, iblockdata);
this.a(world, blockposition, world.getType(blockposition));
}
@@ -72,7 +91,7 @@
@@ -70,7 +89,7 @@
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);

View File

@ -8,7 +8,7 @@
+
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.q;
public static final BlockStateBoolean UP = BlockSprawling.p;
@@ -183,20 +185,24 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);

View File

@ -8,10 +8,10 @@
+
public class Chunk implements IChunkAccess {
private static final Logger e = LogManager.getLogger();
@@ -58,6 +60,35 @@
private int E;
private final AtomicInteger F;
private static final Logger d = LogManager.getLogger();
@@ -57,6 +59,35 @@
private int D;
private final AtomicInteger E;
+ // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
+ private int neighbors = 0x1 << 12;
@ -44,11 +44,11 @@
+
public Chunk(World world, int i, int j, BiomeBase[] abiomebase, ChunkConverter chunkconverter, TickList<Block> ticklist, TickList<FluidType> ticklist1, long k) {
this.sections = new ChunkSection[16];
this.h = new boolean[256];
@@ -95,8 +126,16 @@
this.t = ticklist;
this.u = ticklist1;
this.A = k;
this.g = new boolean[256];
@@ -94,8 +125,16 @@
this.s = ticklist;
this.t = ticklist1;
this.z = k;
+ // CraftBukkit start
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
+ this.chunkKey = ChunkCoordIntPair.a(this.locX, this.locZ);
@ -62,7 +62,7 @@
public Chunk(World world, ProtoChunk protochunk, int i, int j) {
this(world, i, j, protochunk.getBiomeIndex(), protochunk.v(), protochunk.n(), protochunk.o(), protochunk.m());
@@ -136,14 +175,15 @@
@@ -135,14 +174,15 @@
HeightMap.Type heightmap_type = (HeightMap.Type) iterator.next();
if (heightmap_type.c() == HeightMap.Use.LIVE_WORLD) {
@ -74,13 +74,13 @@
}
}
this.y = true;
this.x = true;
this.a(ChunkStatus.FULLCHUNK);
+ this.newChunk = true; // CraftBukkit
}
public Set<BlockPosition> t() {
@@ -474,7 +514,8 @@
@@ -473,7 +513,8 @@
}
}
@ -90,7 +90,7 @@
iblockdata.onPlace(this.world, blockposition, iblockdata1);
}
@@ -654,7 +695,12 @@
@@ -653,7 +694,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@ -104,7 +104,7 @@
if (tileentity == null) {
if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) {
@@ -689,6 +735,13 @@
@@ -688,6 +734,13 @@
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
@ -118,8 +118,8 @@
}
}
@@ -719,6 +772,17 @@
this.world.a((Collection) entityslice);
@@ -720,6 +773,17 @@
}));
}
+ // CraftBukkit start
@ -136,7 +136,7 @@
}
public void removeEntities() {
@@ -735,9 +799,21 @@
@@ -736,9 +800,21 @@
int i = aentityslice.length;
for (int j = 0; j < i; ++j) {
@ -154,13 +154,13 @@
+ }
+ }
- this.world.c((Collection) entityslice);
+ this.world.c(newList);
- this.world.b((Collection) entityslice);
+ this.world.b((Collection) newList);
+ // CraftBukkit end
}
}
@@ -799,8 +875,8 @@
@@ -800,8 +876,8 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -171,37 +171,37 @@
}
}
}
@@ -1006,13 +1082,13 @@
@@ -1007,13 +1083,13 @@
@Nullable
public LongSet b(String s) {
- return (LongSet) this.r.computeIfAbsent(s, (s) -> {
+ return (LongSet) this.r.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
- return (LongSet) this.q.computeIfAbsent(s, (s) -> {
+ return (LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
return new LongOpenHashSet();
});
}
public void a(String s, long i) {
- ((LongSet) this.r.computeIfAbsent(s, (s) -> {
+ ((LongSet) this.r.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
- ((LongSet) this.q.computeIfAbsent(s, (s) -> {
+ ((LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
return new LongOpenHashSet();
})).add(i);
}
@@ -1061,14 +1137,14 @@
}
if (this.t instanceof ProtoChunkTickList) {
- ((ProtoChunkTickList) this.t).a(this.world.I(), (blockposition) -> {
if (this.s instanceof ProtoChunkTickList) {
- ((ProtoChunkTickList) this.s).a(this.world.J(), (blockposition) -> {
- return this.world.getType(blockposition).getBlock();
+ ((ProtoChunkTickList<Block>) this.t).a(this.world.I(), (blockposition1) -> { // CraftBukkit - decompile error
+ ((ProtoChunkTickList<Block>) this.s).a(this.world.J(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.getType(blockposition1).getBlock();
});
}
if (this.u instanceof ProtoChunkTickList) {
- ((ProtoChunkTickList) this.u).a(this.world.H(), (blockposition) -> {
if (this.t instanceof ProtoChunkTickList) {
- ((ProtoChunkTickList) this.t).a(this.world.I(), (blockposition) -> {
- return this.world.b(blockposition).c();
+ ((ProtoChunkTickList<FluidType>) this.u).a(this.world.H(), (blockposition1) -> { // CraftBukkit - decompile error
+ ((ProtoChunkTickList<FluidType>) this.t).a(this.world.I(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.b(blockposition1).c();
});
}

View File

@ -51,27 +51,27 @@
throw new RuntimeException("Not yet implemented");
}
- public Object remove(Object object) {
+ // CraftBukkit start - decompile errors
+ public Chunk remove(Object object) {
return this.a(object);
}
- public Object remove(long i) {
+ // CraftBukkit start - decompile errors
+ public Chunk remove(long i) {
return this.a(i);
}
- public Object put(Long olong, Object object) {
+ public Chunk put(Long olong, Chunk object) {
return this.a(olong, (Chunk) object);
}
- public Object put(long i, Object object) {
+ public Chunk put(long i, Chunk object) {
return this.a(i, (Chunk) object);
}
- public Object remove(Object object) {
+ public Chunk remove(Object object) {
return this.a(object);
}
- public Object put(Long olong, Object object) {
+ public Chunk put(Long olong, Chunk object) {
return this.a(olong, (Chunk) object);
}
- public Object put(Object object, Object object1) {
+ public Object put(Object object, Chunk object1) {
return this.a((Long) object, (Chunk) object1);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkProviderServer.java
+++ b/net/minecraft/server/ChunkProviderServer.java
@@ -20,6 +20,11 @@
@@ -18,6 +18,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -12,93 +12,79 @@
public class ChunkProviderServer implements IChunkProvider {
private static final Logger a = LogManager.getLogger();
@@ -35,7 +40,7 @@
this.world = worldserver;
@@ -36,7 +41,7 @@
this.chunkLoader = ichunkloader;
this.chunkGenerator = chunkgenerator;
- this.f = new ChunkTaskScheduler(2, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler);
+ this.f = new ChunkTaskScheduler(0, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); // CraftBukkit - very buggy, broken in lots of __subtle__ ways. Same goes for async chunk loading. Also Bukkit API / plugins can't handle async events at all anyway.
this.g = new SchedulerBatch(this.f);
this.asyncTaskHandler = iasynctaskhandler;
- this.chunkScheduler = new ChunkTaskScheduler(2, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler);
+ this.chunkScheduler = new ChunkTaskScheduler(0, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); // CraftBukkit - very buggy, broken in lots of __subtle__ ways. Same goes for async chunk loading. Also Bukkit API / plugins can't handle async events at all anyway.
this.batchScheduler = new SchedulerBatch(this.chunkScheduler);
}
@@ -77,9 +82,10 @@
@Nullable
private Chunk loadChunkAt(int i, int j) {
try {
- Chunk chunk = this.chunkLoader.a(this.world, i, j, (chunk) -> {
- chunk.setLastSaved(this.world.getTime());
- this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
+ // CraftBukkit - decompile error
+ Chunk chunk = this.chunkLoader.a(this.world, i, j, (chunk1) -> {
+ chunk1.setLastSaved(this.world.getTime());
+ this.chunks.put(ChunkCoordIntPair.a(i, j), chunk1);
});
@@ -86,9 +91,10 @@
if (chunk != null) {
@@ -104,6 +110,12 @@
if (flag) {
try {
- chunk = this.chunkLoader.a(this.world, i, j, (chunk) -> {
- chunk.setLastSaved(this.world.getTime());
- this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
+ // CraftBukkit - decompile error
+ chunk = this.chunkLoader.a(this.world, i, j, (chunk1) -> {
+ chunk1.setLastSaved(this.world.getTime());
+ this.chunks.put(ChunkCoordIntPair.a(i, j), chunk1);
});
} catch (Exception exception) {
ChunkProviderServer.a.error("Couldn\'t load chunk", exception);
@@ -103,7 +109,7 @@
try {
this.batchScheduler.b();
this.batchScheduler.a(new ChunkCoordIntPair(i, j));
- CompletableFuture completablefuture = this.batchScheduler.c();
+ CompletableFuture<ProtoChunk> completablefuture = this.batchScheduler.c(); // CraftBukkit - decompile error
return (Chunk) completablefuture.thenApply(this::a).join();
} catch (RuntimeException runtimeexception) {
@@ -114,6 +120,22 @@
}
}
+ // CraftBukkit start
+ public Chunk getChunkIfLoaded(int x, int z) {
+ return chunks.get(ChunkCoordIntPair.a(x, z));
+ public Chunk generateChunk(int x, int z) {
+ try {
+ this.batchScheduler.b();
+ ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
+ this.chunkScheduler.forcePolluteCache(pos);
+ this.batchScheduler.a(pos);
+ CompletableFuture<ProtoChunk> completablefuture = this.batchScheduler.c();
+
+ return (Chunk) completablefuture.thenApply(this::a).join();
+ } catch (RuntimeException runtimeexception) {
+ throw this.a(x, z, (Throwable) runtimeexception);
+ }
+ }
+ // CraftBukkit end
+
public Chunk getChunkAt(int i, int j) {
Chunk chunk = this.getOrLoadChunkAt(i, j);
public IChunkAccess a(int i, int j, boolean flag) {
Chunk chunk = this.getChunkAt(i, j, true, false);
@@ -125,7 +137,7 @@
synchronized (this.chunks) {
IChunkAccess ichunkaccess = (IChunkAccess) this.chunks.get(ChunkCoordIntPair.a(i, j));
@@ -251,10 +273,12 @@
Chunk chunk = (Chunk) this.chunks.get(olong);
- return ichunkaccess != null ? ichunkaccess : (IChunkAccess) this.f.c((Object) (new ChunkCoordIntPair(i, j)));
+ return ichunkaccess != null ? ichunkaccess : (IChunkAccess) this.f.c((new ChunkCoordIntPair(i, j))); // CraftBukkit - decompile error
}
}
@@ -147,10 +159,21 @@
return this.g.c();
}
+ // CraftBukkit start
public CompletableFuture<Chunk> generateChunk(int i, int j) {
+ return this.generateChunk(i, j, false);
+ }
if (chunk != null) {
- chunk.removeEntities();
- this.saveChunk(chunk);
- this.chunks.remove(olong);
- this.lastChunk = null;
+ // CraftBukkit start - move unload logic to own method
+ if (!unloadChunk(chunk, true)) {
+ continue;
+ }
+ // CraftBukkit end
+
+ public CompletableFuture<Chunk> generateChunk(int i, int j, boolean force) {
this.g.b();
- this.g.a(new ChunkCoordIntPair(i, j));
- CompletableFuture completablefuture = this.g.c();
+
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
+ if (force) {
+ this.f.forcePolluteCache(chunkcoordintpair);
+ }
+ this.g.a(chunkcoordintpair);
+ // CraftBukkit end
+ CompletableFuture<ProtoChunk> completablefuture = this.g.c(); // CraftBukkit - decompile error
return completablefuture.thenApply(this::a);
}
@@ -268,10 +291,12 @@
Chunk chunk = (Chunk) this.chunks.get(olong);
if (chunk != null && chunk.d) {
- chunk.removeEntities();
- this.saveChunk(chunk);
- this.saveChunkNOP(chunk);
- this.chunks.remove(olong);
+ // CraftBukkit start - move unload logic to own method
+ if (!unloadChunk(chunk, true)) {
+ continue;
+ }
+ // CraftBukkit end
+
++i;
++i;
}
}
}
@@ -284,6 +309,40 @@
@@ -267,6 +291,40 @@
return false;
}
@ -118,7 +104,7 @@
+ continue;
+ }
+
+ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
+ Chunk neighbor = this.getChunkAt(chunk.locX + x, chunk.locZ + z, false, false);
+ if (neighbor != null) {
+ neighbor.setNeighborUnloaded(-x, -z);
+ chunk.setNeighborUnloaded(x, z);
@ -129,13 +115,13 @@
+ chunk.removeEntities();
+ if (save) {
+ this.saveChunk(chunk);
+ this.saveChunkNOP(chunk);
+ }
+ this.chunks.remove(chunk.chunkKey);
+ this.lastChunk = null;
+ return true;
+ }
+ // CraftBukkit end
+
public boolean e() {
public boolean d() {
return !this.world.savingDisabled;
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java
@@ -34,7 +34,7 @@
@@ -31,7 +31,7 @@
private final File c;
private final DataFixer d;
private PersistentStructureLegacy e;
@ -9,12 +9,12 @@
public ChunkRegionLoader(File file, DataFixer datafixer) {
this.c = file;
@@ -45,20 +45,56 @@
private synchronized NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(new ChunkCoordIntPair(i, j));
@@ -40,25 +40,60 @@
- return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j);
+ return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j, generatoraccess); // CraftBukkit
@Nullable
private NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException {
- return this.a(generatoraccess.o().getDimensionManager(), generatoraccess.h(), i, j);
+ return this.a(generatoraccess.o().getDimensionManager(), generatoraccess.h(), i, j, generatoraccess); // CraftBukkit
+ }
+
+ // CraftBukkit start
@ -46,40 +46,44 @@
@Nullable
- private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j) throws IOException {
- DataInputStream datainputstream = RegionFileCache.read(this.c, i, j);
+ private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j, @Nullable GeneratorAccess generatoraccess) throws IOException {
+ NBTTagCompound nbttagcompound = RegionFileCache.read(this.c, i, j);
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(new ChunkCoordIntPair(i, j));
- if (datainputstream == null) {
+ if (nbttagcompound == null) {
return null;
if (nbttagcompound != null) {
return nbttagcompound;
} else {
- NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream);
- DataInputStream datainputstream = RegionFileCache.read(this.c, i, j);
+ NBTTagCompound nbttagcompound1 = RegionFileCache.read(this.c, i, j);
- if (datainputstream == null) {
+ if (nbttagcompound1 == null) {
return null;
} else {
- NBTTagCompound nbttagcompound1 = NBTCompressedStreamTools.a(datainputstream);
-
- datainputstream.close();
+ // CraftBukkit end
int k = nbttagcompound.hasKeyOfType("DataVersion", 99) ? nbttagcompound.getInt("DataVersion") : -1;
+ // CraftBukkit start
+ if (k < 1466) {
+ NBTTagCompound level = nbttagcompound.getCompound("Level");
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer();
+ if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) {
+ level.setBoolean("LightPopulated", true);
- datainputstream.close();
int k = nbttagcompound1.hasKeyOfType("DataVersion", 99) ? nbttagcompound1.getInt("DataVersion") : -1;
+ // CraftBukkit start
+ if (k < 1466) {
+ NBTTagCompound level = nbttagcompound1.getCompound("Level");
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer();
+ if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) {
+ level.setBoolean("LightPopulated", true);
+ }
+ }
+ }
+ }
+ // CraftBukkit end
+ // CraftBukkit end
if (k < 1493) {
nbttagcompound1 = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound1, k, 1493);
@@ -86,13 +121,29 @@
if (k < 1493) {
nbttagcompound = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound, k, 1493);
@@ -81,13 +117,29 @@
}
}
+ // CraftBukkit start - Add async variant, provide compatibility
@Nullable
public synchronized Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
public Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ Object[] data = loadChunk(generatoraccess, i, j, consumer);
+ if (data != null) {
+ Chunk chunk = (Chunk) data[0];
@ -92,7 +96,7 @@
+ return null;
+ }
+
+ public synchronized Object[] loadChunk(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ public Object[] loadChunk(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ // CraftBukkit end
NBTTagCompound nbttagcompound = this.a(generatoraccess, i, j);
@ -103,7 +107,7 @@
Chunk chunk = this.a(generatoraccess, i, j, nbttagcompound);
if (chunk != null) {
@@ -96,6 +148,9 @@
@@ -101,6 +152,9 @@
}
return chunk;
@ -113,7 +117,7 @@
}
}
@@ -124,7 +179,7 @@
@@ -132,7 +186,7 @@
}
@Nullable
@ -122,7 +126,7 @@
if (nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8)) {
ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound);
@@ -143,10 +198,28 @@
@@ -151,10 +205,28 @@
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);
@ -152,7 +156,7 @@
}
}
} else {
@@ -161,7 +234,7 @@
@@ -169,7 +241,7 @@
ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound);
if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) {
@ -161,69 +165,42 @@
} else {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
@@ -209,19 +282,30 @@
@@ -217,10 +289,14 @@
}
public synchronized boolean a() {
- if (this.b.isEmpty()) {
- if (this.f) {
public boolean a() {
- Iterator iterator = this.b.entrySet().iterator();
+ // CraftBukkit start
+ return this.processSaveQueueEntry(false);
+ }
+
+ private synchronized boolean processSaveQueueEntry(boolean logCompletion) {
+ Iterator<Map.Entry<ChunkCoordIntPair, NBTTagCompound>> iter = this.b.entrySet().iterator();
+ if (!iter.hasNext()) {
+ if (logCompletion) {
+ // CraftBukkit end
+ private boolean processSaveQueueEntry(boolean logCompletion) {
+ Iterator iterator = this.b.entrySet().iterator();
if (!iterator.hasNext()) {
- if (this.f) {
+ if (logCompletion) { // CraftBukkit
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
}
return false;
} else {
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.b.keySet().iterator().next();
+ // CraftBukkit start
+ Map.Entry<ChunkCoordIntPair, NBTTagCompound> entry = iter.next();
+ ChunkCoordIntPair chunkcoordintpair = entry.getKey();
+ NBTTagCompound nbttagcompound = entry.getValue();
+ // CraftBukkit end
@@ -236,10 +312,14 @@
return true;
} else {
try {
- DataOutputStream dataoutputstream = RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z);
+ // CraftBukkit start
+ RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound);
boolean flag;
+ /*
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
dataoutputstream.close();
+ */
+ // CraftBukkit end
if (this.e != null) {
this.e.a(chunkcoordintpair.a());
}
@@ -266,15 +346,16 @@
try {
- NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
+ // NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair); // CraftBukkit
if (nbttagcompound != null) {
try {
@@ -233,7 +317,7 @@
flag = true;
} finally {
- this.b.remove(chunkcoordintpair);
+ this.b.remove(chunkcoordintpair, nbttagcompound); // CraftBukkit
}
return flag;
@@ -253,10 +337,14 @@
}
private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
- DataOutputStream dataoutputstream = RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z);
+ // CraftBukkit start
+ RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound);
+ /*
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
dataoutputstream.close();
+ */
+ // CraftBukkit end
if (this.e != null) {
this.e.a(chunkcoordintpair.a());
}
@@ -269,15 +357,16 @@
public void c() {
public void b() {
try {
- this.f = true;
+ // this.f = true; // CraftBukkit
@ -241,25 +218,25 @@
}
}
@@ -306,7 +395,7 @@
@@ -303,7 +384,7 @@
if (abiomebase != null) {
for (int k = 0; k < abiomebase.length; ++k) {
- aint[k] = BiomeBase.REGISTRY_ID.a((Object) abiomebase[k]);
+ aint[k] = BiomeBase.REGISTRY_ID.a(abiomebase[k]); // CraftBukkit - decompile error
- aint[k] = IRegistry.BIOME.a((Object) abiomebase[k]);
+ aint[k] = IRegistry.BIOME.a(abiomebase[k]); // CraftBukkit - decompile error
}
}
@@ -388,7 +477,7 @@
@@ -385,7 +466,7 @@
int[] aint = new int[abiomebase.length];
for (int i = 0; i < abiomebase.length; ++i) {
- aint[i] = BiomeBase.REGISTRY_ID.a((Object) abiomebase[i]);
+ aint[i] = BiomeBase.REGISTRY_ID.a(abiomebase[i]); // CraftBukkit - decompile error
- aint[i] = IRegistry.BIOME.a((Object) abiomebase[i]);
+ aint[i] = IRegistry.BIOME.a(abiomebase[i]); // CraftBukkit - decompile error
}
nbttagcompound.setIntArray("Biomes", aint);
@@ -490,7 +579,7 @@
@@ -487,27 +568,27 @@
}
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
@ -267,26 +244,33 @@
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile error
return block.getBlockData().isAir();
};
RegistryBlocks registryblocks = Block.REGISTRY;
@@ -502,7 +591,7 @@
Block.REGISTRY.getClass();
ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, registryblocks1::get, new ChunkCoordIntPair(i, j));
IRegistry iregistry = IRegistry.BLOCK;
IRegistry.BLOCK.getClass();
Function function = iregistry::getKey;
- IRegistry iregistry1 = IRegistry.BLOCK;
+ IRegistry<Block> iregistry1 = IRegistry.BLOCK; // CraftBukkit - decompile error
IRegistry.BLOCK.getClass();
- ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j));
+ ProtoChunkTickList protochunkticklist = new ProtoChunkTickList<>(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
- predicate = (fluidtype) -> {
+ Predicate<FluidType> predicate1 = (fluidtype) -> { // CraftBukkit - decompile error
return fluidtype == FluidTypes.a;
};
registryblocks = FluidType.c;
@@ -510,7 +599,7 @@
function = registryblocks::b;
registryblocks1 = FluidType.c;
FluidType.c.getClass();
- ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate, function, registryblocks1::get, new ChunkCoordIntPair(i, j));
+ ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate1, function, registryblocks1::get, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
iregistry = IRegistry.FLUID;
IRegistry.FLUID.getClass();
function = iregistry::getKey;
- iregistry1 = IRegistry.FLUID;
+ IRegistry<FluidType> iregistry2 = IRegistry.FLUID; // CraftBukkit - decompile error
IRegistry.FLUID.getClass();
- ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j));
+ ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList<>(predicate1, function, iregistry2::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
long i1 = nbttagcompound.getLong("InhabitedTime");
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
@@ -853,17 +942,29 @@
@@ -850,17 +931,29 @@
}
@Nullable
@ -318,7 +302,7 @@
});
}
@@ -877,8 +978,14 @@
@@ -874,8 +967,14 @@
}
}
@ -334,12 +318,12 @@
Iterator iterator = entity.bP().iterator();
while (iterator.hasNext()) {
@@ -894,7 +1001,7 @@
@@ -891,7 +990,7 @@
boolean flag = false;
try {
- this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z);
+ this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z, null); // CraftBukkit
while (!this.b.isEmpty()) {
this.a();
while (this.a()) {
flag = true;

View File

@ -1,15 +1,24 @@
--- a/net/minecraft/server/ChunkTaskScheduler.java
+++ b/net/minecraft/server/ChunkTaskScheduler.java
@@ -39,6 +39,12 @@
@@ -20,7 +20,7 @@
private final ChunkGenerator<?> d;
private final IChunkLoader e;
private final IAsyncTaskHandler f;
- private final Long2ObjectMap<Scheduler.a> progressCache = new ExpiringMap(8192, 5000) {
+ private final Long2ObjectMap<Scheduler.a> progressCache = new ExpiringMap<Scheduler.a>(8192, 5000) { // CraftBukkit - decompile error
protected boolean a(Scheduler.a scheduler_a) {
ProtoChunk protochunk = (ProtoChunk) scheduler_a.a();
@@ -40,6 +40,12 @@
this.f = iasynctaskhandler;
}
+ // CraftBukkit start
+ public void forcePolluteCache(ChunkCoordIntPair chunkcoordintpair) {
+ this.g.put(chunkcoordintpair.a(), new Scheduler.a(chunkcoordintpair, new ProtoChunk(chunkcoordintpair, ChunkConverter.a), ChunkStatus.EMPTY));
+ this.progressCache.put(chunkcoordintpair.a(), new Scheduler.a(chunkcoordintpair, new ProtoChunk(chunkcoordintpair, ChunkConverter.a), ChunkStatus.EMPTY));
+ }
+ // CraftBukkit end
+
protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair) {
return (Scheduler.a) this.g.computeIfAbsent(Long.valueOf(chunkcoordintpair.a()), (olong) -> {
ProtoChunk protochunk = this.a(chunkcoordintpair.x, chunkcoordintpair.z);
@Nullable
protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair, boolean flag) {
IChunkLoader ichunkloader = this.e;

View File

@ -20,7 +20,7 @@
public CommandBlockListenerAbstract() {}
@@ -103,14 +108,7 @@
if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
if (minecraftserver != null && minecraftserver.D() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
try {
this.f = null;
- CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandDispatcher.java
+++ b/net/minecraft/server/CommandDispatcher.java
@@ -26,12 +26,21 @@
@@ -27,12 +27,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -22,8 +22,8 @@
+ public final CommandDispatcher init(boolean flag) {
CommandAdvancement.a(this.b);
CommandExecute.a(this.b);
CommmandBossBar.a(this.b);
@@ -100,6 +109,11 @@
CommandBossBar.a(this.b);
@@ -102,6 +111,11 @@
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
CommandDispatcher.a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection);
});
@ -35,7 +35,7 @@
this.b.setConsumer((commandcontext, flag, i) -> {
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
});
@@ -114,8 +128,49 @@
@@ -116,7 +130,47 @@
}
@ -75,18 +75,15 @@
+ }
+
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
- String s1 = s;
+ return this.a(commandlistenerwrapper, s, s);
+ }
+
+ public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
+ VanillaCommandWrapper.WorldRescueContext rescue = new VanillaCommandWrapper.WorldRescueContext().start(commandlistenerwrapper.getWorld());
+ String s1 = label;
+ // CraftBukkit end
StringReader stringreader = new StringReader(s);
if (s.startsWith("/")) {
s = s.substring(1);
@@ -126,7 +181,6 @@
if (stringreader.canRead() && stringreader.peek() == 47) {
@@ -128,7 +182,6 @@
byte b0;
try {
@ -94,7 +91,7 @@
ChatComponentText chatcomponenttext;
try {
@@ -135,65 +189,95 @@
@@ -137,52 +190,56 @@
return i;
} catch (CommandException commandexception) {
commandlistenerwrapper.sendFailureMessage(commandexception.a());
@ -136,7 +133,7 @@
+ chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
+ chatcomponenttext.addSibling(chatmessage);
+ chatcomponenttext.getChatModifier().setColor(EnumChatFormat.GRAY);
+ chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s1));
+ chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
+ commandlistenerwrapper.sendFailureMessage(chatcomponenttext);
}
@ -177,10 +174,8 @@
+ }
} finally {
commandlistenerwrapper.getServer().methodProfiler.e();
+ rescue.end(); // CraftBukkit
}
return b0;
@@ -191,11 +248,36 @@
}
public void a(EntityPlayer entityplayer) {

View File

@ -0,0 +1,45 @@
--- a/net/minecraft/server/CommandForceload.java
+++ b/net/minecraft/server/CommandForceload.java
@@ -47,7 +47,7 @@
private static int a(CommandListenerWrapper commandlistenerwrapper, ArgumentVec2I.a argumentvec2i_a) throws CommandSyntaxException {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(argumentvec2i_a.a >> 4, argumentvec2i_a.b >> 4);
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
boolean flag = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).f(chunkcoordintpair.x, chunkcoordintpair.z);
if (flag) {
@@ -59,7 +59,7 @@
}
private static int a(CommandListenerWrapper commandlistenerwrapper) {
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
LongSet longset = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).ag();
int i = longset.size();
@@ -79,12 +79,12 @@
}
private static int b(CommandListenerWrapper commandlistenerwrapper) {
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
LongSet longset = worldserver.ag();
- longset.forEach((i) -> {
- worldserver.b(ChunkCoordIntPair.a(i), ChunkCoordIntPair.b(i), false);
+ longset.forEach((LongConsumer) (ix) -> { // CraftBukkit - decompile error
+ worldserver.b(ChunkCoordIntPair.a(ix), ChunkCoordIntPair.b(ix), false); // CraftBukkit - decompile error
});
commandlistenerwrapper.sendMessage(new ChatMessage("commands.forceload.removed.all", new Object[] { dimensionmanager}), true);
return 0;
@@ -106,7 +106,7 @@
if (i2 > 256L) {
throw CommandForceload.a.create(Integer.valueOf(256), Long.valueOf(i2));
} else {
- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
+ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
ChunkCoordIntPair chunkcoordintpair = null;
int j2 = 0;

View File

@ -4,16 +4,16 @@
}
private static int a(CommandListenerWrapper commandlistenerwrapper, String s, CommandContext<CommandListenerWrapper> commandcontext) {
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().aQ().get(s);
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
gamerules_gamerulevalue.e().a(commandcontext, "value", gamerules_gamerulevalue);
gamerules_gamerulevalue.getType().a(commandcontext, "value", gamerules_gamerulevalue);
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[] { s, gamerules_gamerulevalue.a()}), true);
@@ -37,7 +37,7 @@
}
private static int a(CommandListenerWrapper commandlistenerwrapper, String s) {
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().aQ().get(s);
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.query", new Object[] { s, gamerules_gamerulevalue.a()}), false);

View File

@ -25,7 +25,7 @@
+
+ // CraftBukkit start - add a version of getType which force loads chunks
+ private static IBlockData getType(IBlockAccess iblockaccess, BlockPosition position) {
+ ((ChunkProviderServer) ((World) iblockaccess).chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
+ ((ChunkProviderServer) ((World) iblockaccess).chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4, true, true);
+ return iblockaccess.getType(position);
+ }
+ // CraftBukkit end

View File

@ -9,9 +9,9 @@
}
if (collection.size() == 1) {
@@ -116,9 +116,9 @@
if (entity instanceof EntityPlayer) {
entity.stopRiding();
@@ -120,9 +120,9 @@
}
if (worldserver == entity.world) {
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit

View File

@ -76,7 +76,7 @@
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return !this.i.getType(this.j).a(TagsBlock.y) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
return !this.i.getType(this.j).a(TagsBlock.ANVIL) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
}
@@ -357,4 +368,33 @@

View File

@ -70,8 +70,8 @@
if (list != null && !list.isEmpty()) {
WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(this.l.nextInt(list.size()));
- this.h[j] = Enchantment.enchantments.a((Object) weightedrandomenchant.enchantment);
+ this.h[j] = Enchantment.enchantments.a(weightedrandomenchant.enchantment); // CraftBukkit - decompile error
- this.h[j] = IRegistry.ENCHANTMENT.a((Object) weightedrandomenchant.enchantment);
+ this.h[j] = IRegistry.ENCHANTMENT.a(weightedrandomenchant.enchantment); // CraftBukkit - decompile error
this.i[j] = weightedrandomenchant.level;
}
}
@ -81,7 +81,7 @@
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.enchantments.EnchantmentOffer[] offers = new EnchantmentOffer[3];
+ for (j = 0; j < 3; ++j) {
+ org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(Enchantment.getId(Enchantment.enchantments.getId(this.h[j])))) : null;
+ org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(IRegistry.ENCHANTMENT.fromId(this.h[j])))) : null;
+ offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.i[j], this.costs[j]) : null;
+ }
+
@ -102,7 +102,7 @@
+ EnchantmentOffer offer = event.getOffers()[j];
+ if (offer != null) {
+ this.costs[j] = offer.getCost();
+ this.h[j] = Enchantment.enchantments.a(Enchantment.fromId(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
+ this.h[j] = IRegistry.ENCHANTMENT.a(IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
+ this.i[j] = offer.getEnchantmentLevel();
+ } else {
+ this.costs[j] = 0;
@ -128,7 +128,7 @@
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(Enchantment.getId(instance.enchantment))), instance.level);
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
+
@ -151,7 +151,7 @@
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
+ Enchantment nms = Enchantment.fromId(CraftNamespacedKey.toMinecraft(enchantId));
+ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }

View File

@ -1,27 +1,11 @@
--- a/net/minecraft/server/CustomFunction.java
+++ b/net/minecraft/server/CustomFunction.java
@@ -45,7 +45,7 @@
@@ -48,7 +48,7 @@
}
try {
- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(s, customfunctiondata.f());
+ ParseResults parseresults = customfunctiondata.d().parse(s, customfunctiondata.f()); // CraftBukkit
- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.f());
+ ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.f()); // CraftBukkit
if (parseresults.getReader().canRead()) {
if (parseresults.getExceptions().size() == 1) {
@@ -142,7 +142,14 @@
}
public void a(CustomFunctionData customfunctiondata, CommandListenerWrapper commandlistenerwrapper, ArrayDeque<CustomFunctionData.a> arraydeque, int i) throws CommandSyntaxException {
- customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
+ // CraftBukkit start
+ org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext rescue = new org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext().start(commandlistenerwrapper.getWorld());
+ try {
+ customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
+ } finally {
+ rescue.end();
+ }
+ // CraftBukkit end
}
public String toString() {

View File

@ -18,15 +18,15 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
private static final Pattern i = Pattern.compile("^[a-fA-F0-9]{40}$");
private static final Pattern h = Pattern.compile("^[a-fA-F0-9]{40}$");
- private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.newArrayList());
+ private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
private RemoteStatusListener k;
private RemoteStatusListener j;
public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
private RemoteControlListener m;
private RemoteControlListener l;
@@ -37,8 +48,10 @@
private EnumGamemode q;
private boolean r;
private EnumGamemode p;
private boolean q;
- public DedicatedServer(File file, DataFixer datafixer, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
- super(file, Proxy.NO_PROXY, datafixer, new CommandDispatcher(true), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache);
@ -106,8 +106,8 @@
DedicatedServer.LOGGER.info("Loading properties");
- this.propertyManager = new PropertyManager(new File("server.properties"));
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
this.o = new EULA(new File("eula.txt"));
if (!this.o.a()) {
this.n = new EULA(new File("eula.txt"));
if (!this.n.a()) {
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
@@ -143,6 +191,12 @@
return false;
@ -133,8 +133,8 @@
if (this.getWorld() == null) {
@@ -228,7 +282,18 @@
DedicatedServer.LOGGER.info("Starting remote control listener");
this.m = new RemoteControlListener(this);
this.m.a();
this.l = new RemoteControlListener(this);
this.l.a();
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
+ }
+
@ -148,21 +148,21 @@
}
+ // CraftBukkit end
if (this.ba() > 0L) {
if (this.aY() > 0L) {
Thread thread1 = new Thread(new ThreadWatchdog(this));
@@ -303,11 +368,11 @@
return crashreport;
}
- protected void u() {
+ public void u() { // CraftBukkit - decompile error
- protected void t() {
+ public void t() { // CraftBukkit - decompile error
System.exit(0);
}
- protected void w() {
+ public void w() { // CraftBukkit - fix decompile error
super.w();
this.aW();
- protected void b(BooleanSupplier booleansupplier) {
+ public void b(BooleanSupplier booleansupplier) { // CraftBukkit - fix decompile error
super.b(booleansupplier);
this.aU();
}
@@ -342,7 +407,15 @@
while (!this.serverCommandQueue.isEmpty()) {
@ -248,7 +248,7 @@
}
public PlayerList getPlayerList() {
return this.aX();
return this.aV();
}
+
+ // CraftBukkit start

View File

@ -169,7 +169,7 @@
+ int z = blockposition.getZ();
+ IBlockData iblockdata = world.getType(blockposition);
+ Material material = iblockdata.getMaterial();
+ if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).a(world, blockposition, iblockdata, itembucket.a))) {
+ if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, itembucket.fluidType))) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
@ -325,7 +325,7 @@
+ world.captureTreeGeneration = true;
+ // CraftBukkit end
if (!ItemBoneMeal.a(itemstack, world, blockposition) && !ItemBoneMeal.b(itemstack, world, blockposition)) {
if (!ItemBoneMeal.a(itemstack, world, blockposition) && !ItemBoneMeal.a(itemstack, world, blockposition, (EnumDirection) null)) {
this.a = false;
} else if (!world.isClientSide) {
world.triggerEffect(2005, blockposition, 0);
@ -426,7 +426,7 @@
+
this.a = true;
if (world.isEmpty(blockposition) && BlockWitherSkull.b(world, blockposition, itemstack)) {
world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, Integer.valueOf(enumdirection.opposite().get2DRotationValue() * 4)), 3);
world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, Integer.valueOf(enumdirection.k() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4)), 3);
@@ -318,6 +610,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@ -458,7 +458,7 @@
this.a = true;
if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) {
if (!world.isClientSide) {
@@ -379,6 +695,51 @@
@@ -385,6 +701,51 @@
}
d();
@ -510,16 +510,16 @@
}
}
}
@@ -387,7 +748,7 @@
@@ -393,7 +754,7 @@
LocaleLanguage localelanguage = LocaleLanguage.a();
registrymaterials.iterator().forEachRemaining((object) -> {
iregistry.iterator().forEachRemaining((object) -> {
- String s = (String) function.apply(object);
+ String s1 = (String) function.apply(object); // CraftBukkit - decompile error
if (!localelanguage.b(s)) {
DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, registrymaterials.b(object), s);
@@ -481,6 +842,30 @@
DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, iregistry.getKey(object), s);
@@ -487,6 +848,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
@ -550,7 +550,7 @@
this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS;
if (this.a) {
itemstack.subtract(1);
@@ -534,12 +919,40 @@
@@ -540,12 +925,40 @@
d3 = 0.0D;
}

View File

@ -1,32 +1,19 @@
--- a/net/minecraft/server/Enchantment.java
+++ b/net/minecraft/server/Enchantment.java
@@ -15,6 +15,17 @@
@Nullable
protected String d;
+ // CraftBukkit start - add back
+ @Nullable
+ public static Enchantment fromId(MinecraftKey key) {
+ return Enchantment.enchantments.get(key);
+ }
+
+ public static MinecraftKey getId(Enchantment enchantment) {
+ return Enchantment.enchantments.b(enchantment);
+ }
+ // CraftBukkit end
+
protected Enchantment(Enchantment.Rarity enchantment_rarity, EnchantmentSlotType enchantmentslottype, EnumItemSlot[] aenumitemslot) {
this.e = enchantment_rarity;
this.itemTarget = enchantmentslottype;
@@ -153,6 +164,11 @@
@@ -154,10 +154,15 @@
a("channeling", new EnchantmentTridentChanneling(Enchantment.Rarity.VERY_RARE, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
a("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
a("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
+ // CraftBukkit start
+ for (Object enchantment : Enchantment.enchantments) {
+ for (Object enchantment : IRegistry.ENCHANTMENT) {
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment((Enchantment) enchantment));
+ }
+ // CraftBukkit end
}
private static void a(String s, Enchantment enchantment) {
- IRegistry.ENCHANTMENT.a(new MinecraftKey(s), (Object) enchantment);
+ IRegistry.ENCHANTMENT.a(new MinecraftKey(s), enchantment); // CraftBukkit - decompile error
}
public static enum Rarity {

View File

@ -14,10 +14,10 @@
if (iblockdata2.getMaterial() == Material.WATER && ((Integer) iblockdata2.get(BlockFluids.LEVEL)).intValue() == 0 && iblockdata.canPlace(world, blockposition_mutableblockposition1) && world.a(iblockdata, (BlockPosition) blockposition_mutableblockposition1)) {
- world.setTypeUpdate(blockposition_mutableblockposition1, iblockdata);
- world.I().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
- world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, iblockdata, entityliving)) {
+ world.I().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ }
+ // CraftBukkit End
}

View File

@ -126,15 +126,15 @@
+ if (this.ao++ >= i) {
+ this.ao = i;
+ this.portalCooldown = this.aQ();
+ byte b0;
+ DimensionManager dimensionmanager;
+
+ if (this.world.worldProvider.getDimensionManager().getDimensionID() == -1) {
+ b0 = 0;
+ if (this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER) {
+ dimensionmanager = DimensionManager.OVERWORLD;
+ } else {
+ b0 = -1;
+ dimensionmanager = DimensionManager.NETHER;
+ }
+
+ this.d(b0);
+ this.a(dimensionmanager);
+ }
+ }
+
@ -176,35 +176,32 @@
this.av();
this.r();
@@ -340,6 +472,27 @@
@@ -339,7 +471,23 @@
protected void burnFromLava() {
if (!this.fireProof) {
this.damageEntity(DamageSource.LAVA, 4.0F);
+
- this.setOnFire(15);
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
+ if (this instanceof EntityLiving) {
+ if (fireTicks <= 0) {
+ // not on fire yet
+ // TODO: shouldn't be sending null for the block
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
+ this.world.getServer().getPluginManager().callEvent(combustEvent);
+ if (this instanceof EntityLiving && fireTicks <= 0) {
+ // not on fire yet
+ // TODO: shouldn't be sending null for the block
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
+ this.world.getServer().getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ this.setOnFire(combustEvent.getDuration());
+ }
+ } else {
+ // This will be called every single tick the entity is in lava, so don't throw an event
+ this.setOnFire(15);
+ if (!combustEvent.isCancelled()) {
+ this.setOnFire(combustEvent.getDuration());
+ }
+ return;
+ } else {
+ // This will be called every single tick the entity is in lava, so don't throw an event
+ this.setOnFire(15);
+ }
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
this.setOnFire(15);
this.damageEntity(DamageSource.LAVA, 4.0F);
}
}
@@ -505,7 +658,7 @@
@@ -505,7 +653,7 @@
}
}
@ -213,7 +210,7 @@
double d11;
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
@@ -592,7 +745,7 @@
@@ -592,7 +740,7 @@
this.world.methodProfiler.a("rest");
this.recalcPosition();
this.positionChanged = d7 != d0 || d9 != d2;
@ -222,7 +219,7 @@
this.onGround = this.C && d8 < 0.0D;
this.D = this.positionChanged || this.C;
int k = MathHelper.floor(this.locX);
@@ -627,6 +780,28 @@
@@ -627,6 +775,28 @@
block1.a((IBlockAccess) this.world, this);
}
@ -251,7 +248,7 @@
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
double d22 = this.locX - d4;
double d23 = this.locY - d5;
@@ -679,7 +854,14 @@
@@ -678,7 +848,14 @@
if (!flag1) {
++this.fireTicks;
if (this.fireTicks == 0) {
@ -266,8 +263,8 @@
+ // CraftBukkit end
}
}
} else if (this.fireTicks <= 0) {
@@ -875,7 +1057,7 @@
@@ -876,7 +1053,7 @@
return null;
}
@ -276,7 +273,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
@@ -1094,6 +1276,13 @@
@@ -1095,6 +1272,13 @@
}
public void spawnIn(World world) {
@ -290,7 +287,7 @@
this.world = world;
}
@@ -1301,7 +1490,7 @@
@@ -1302,7 +1486,7 @@
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@ -299,7 +296,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1318,6 +1507,18 @@
@@ -1319,6 +1503,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}));
@ -318,7 +315,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1327,6 +1528,12 @@
@@ -1328,6 +1524,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -331,7 +328,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1403,6 +1610,8 @@
@@ -1404,6 +1606,8 @@
this.motX = nbttaglist1.k(0);
this.motY = nbttaglist1.k(1);
this.motZ = nbttaglist1.k(2);
@ -340,7 +337,7 @@
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
@@ -1414,6 +1623,7 @@
@@ -1415,6 +1619,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
@ -348,7 +345,7 @@
this.locX = nbttaglist.k(0);
this.locY = nbttaglist.k(1);
@@ -1470,6 +1680,57 @@
@@ -1471,6 +1676,56 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@ -395,8 +392,7 @@
+ }
+
+ if (bworld == null) {
+ EntityPlayer entityPlayer = (EntityPlayer) this;
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(DimensionManager.OVERWORLD).getWorld();
+ }
+
+ spawnIn(bworld == null? null : ((CraftWorld) bworld).getHandle());
@ -406,7 +402,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1543,9 +1804,22 @@
@@ -1544,9 +1799,22 @@
if (itemstack.isEmpty()) {
return null;
} else {
@ -429,16 +425,16 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1678,7 +1952,7 @@
Entity entity = this.ax;
@@ -1679,7 +1947,7 @@
Entity entity = this.vehicle;
this.ax = null;
- entity.p(this);
+ if (!entity.p(this)) this.ax = entity; // CraftBukkit
this.vehicle = null;
- entity.removePassenger(this);
+ if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
}
}
@@ -1687,6 +1961,24 @@
@@ -1688,6 +1956,24 @@
if (entity.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
@ -463,12 +459,12 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1696,13 +1988,30 @@
@@ -1697,13 +1983,30 @@
}
}
- protected void p(Entity entity) {
+ protected boolean p(Entity entity) { // CraftBukkit
- protected void removePassenger(Entity entity) {
+ protected boolean removePassenger(Entity entity) { // CraftBukkit
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@ -495,7 +491,7 @@
}
protected boolean q(Entity entity) {
@@ -1799,6 +2108,13 @@
@@ -1800,6 +2103,13 @@
}
public void setSwimming(boolean flag) {
@ -509,7 +505,7 @@
this.setFlag(4, flag);
}
@@ -1859,14 +2175,49 @@
@@ -1860,16 +2170,53 @@
}
public void setAirTicks(int i) {
@ -525,12 +521,26 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
++this.fireTicks;
+ // CraftBukkit start
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
+ final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
+ final PluginManager pluginManager = Bukkit.getPluginManager();
+ // CraftBukkit end
+
if (this.fireTicks == 0) {
- this.setOnFire(8);
+ // CraftBukkit start - Call a combust event when lightning strikes
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
+ pluginManager.callEvent(entityCombustEvent);
+ if (!entityCombustEvent.isCancelled()) {
+ this.setOnFire(entityCombustEvent.getDuration());
+ }
+ // CraftBukkit end
}
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
+ // CraftBukkit start
+ if (thisBukkitEntity instanceof Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
+ pluginManager.callEvent(hangingEvent);
@ -549,38 +559,23 @@
+ return;
+ }
+ // CraftBukkit end
++this.fireTicks;
if (this.fireTicks == 0) {
- this.setOnFire(8);
+ // CraftBukkit start - Call a combust event when lightning strikes
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
+ pluginManager.callEvent(entityCombustEvent);
+ if (!entityCombustEvent.isCancelled()) {
+ this.setOnFire(entityCombustEvent.getDuration());
+ }
+ // CraftBukkit end
}
}
@@ -2035,19 +2386,76 @@
public void j(boolean flag) {
@@ -2036,19 +2383,72 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.bK();
- int j = this.dimension;
- WorldServer worldserver = minecraftserver.getWorldServer(j);
- WorldServer worldserver1 = minecraftserver.getWorldServer(i);
- DimensionManager dimensionmanager1 = this.dimension;
- WorldServer worldserver = minecraftserver.getWorldServer(dimensionmanager1);
- WorldServer worldserver1 = minecraftserver.getWorldServer(dimensionmanager);
+ // CraftBukkit start - Move logic into new function "teleportTo(Location,boolean)"
+ // int j = this.dimension;
+ // WorldServer worldserver = minecraftserver.getWorldServer(j);
+ // WorldServer worldserver1 = minecraftserver.getWorldServer(i);
+ // DimensionManager dimensionmanager1 = this.dimension;
+ // WorldServer worldserver = minecraftserver.getWorldServer(dimensionmanager1);
+ // WorldServer worldserver1 = minecraftserver.getWorldServer(dimensionmanager);
+ WorldServer exitWorld = null;
+ if (this.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // Plugins must specify exit from custom Bukkit worlds
+ // Only target existing worlds (compensate for allow-nether/allow-end as false)
+ for (WorldServer world : minecraftserver.worlds) {
+ if (world.dimension == i) {
+ exitWorld = world;
+ }
+ }
+ if (this.dimension.getDimensionID() < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // Plugins must specify exit from custom Bukkit worlds
+ exitWorld = minecraftserver.getWorldServer(dimensionmanager);
+ }
+
+ BlockPosition blockposition = null; // PAIL: CHECK
@ -590,13 +585,13 @@
+ if (blockposition != null) {
+ exit = new Location(exitWorld.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ } else {
+ exit = minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i));
+ exit = minecraftserver.getPlayerList().calculateTarget(enter, exitWorld);
+ }
+ }
+ else {
+ exit = null;
+ }
+ boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
+ boolean useTravelAgent = exitWorld != null && !(this.dimension == DimensionManager.THE_END && exitWorld.dimension == DimensionManager.THE_END); // don't use agent for custom worlds or return from THE_END
+
+ TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
+ boolean oldCanCreate = agent.getCanCreatePortal();
@ -616,22 +611,23 @@
+ Entity entity = this.teleportTo(exit, true);
+ this.world.methodProfiler.e();
+ return entity;
+ } else {
+ return null;
+ }
+ return null;
+ }
+
+ public Entity teleportTo(Location exit, boolean portal) {
+ if (true) {
+ WorldServer worldserver = ((CraftWorld) getBukkitEntity().getLocation().getWorld()).getHandle();
+ WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
+ int i = worldserver1.dimension;
+ DimensionManager dimensionmanager = worldserver1.dimension;
+ // CraftBukkit end
this.dimension = i;
this.dimension = dimensionmanager;
+ /* CraftBukkit start - TODO: Check if we need this
if (j == 1 && i == 1) {
worldserver1 = minecraftserver.a(DimensionManager.OVERWORLD);
this.dimension = 0;
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
worldserver1 = minecraftserver.getWorldServer(DimensionManager.OVERWORLD);
this.dimension = DimensionManager.OVERWORLD;
}
+ // CraftBukkit end */
@ -641,8 +637,8 @@
+ /* CraftBukkit start - Handled in calculateTarget
BlockPosition blockposition;
if (i == 1) {
@@ -2076,12 +2484,18 @@
if (dimensionmanager == DimensionManager.THE_END) {
@@ -2077,12 +2477,18 @@
blockposition = new BlockPosition(this);
}
@ -659,10 +655,10 @@
if (entity != null) {
entity.v(this);
+ /* CraftBukkit start - We need to do this...
if (j == 1 && i == 1) {
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
@@ -2089,6 +2503,7 @@
@@ -2090,6 +2496,7 @@
} else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
}
@ -670,7 +666,7 @@
boolean flag = entity.attachedToPlayer;
@@ -2096,13 +2511,21 @@
@@ -2097,13 +2504,21 @@
worldserver1.addEntity(entity);
entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false);
@ -686,14 +682,14 @@
this.dead = true;
this.world.methodProfiler.e();
worldserver.q_();
worldserver1.q_();
worldserver.p();
worldserver1.p();
- this.world.methodProfiler.e();
+ // this.world.methodProfiler.e(); // CraftBukkit: Moved up to keep balanced
return entity;
} else {
return null;
@@ -2242,7 +2665,26 @@
@@ -2243,7 +2658,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {

View File

@ -23,11 +23,11 @@
+ }
+
+ public String getType() {
+ return ((MinecraftKey) PotionRegistry.a.b(this.potionRegistry)).toString(); // PAIL: rename
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potionRegistry)).toString();
+ }
+
+ public void setType(String string) {
+ a(PotionRegistry.a.get(new MinecraftKey(string))); // PAIL: rename
+ a(IRegistry.POTION.get(new MinecraftKey(string)));
+ }
+ // CraftBukkit end
+

View File

@ -30,7 +30,7 @@
public final void setSize(float f, float f1) {
double d0 = this.locX;
double d1 = this.locY;
@@ -355,6 +371,21 @@
@@ -357,6 +373,21 @@
if (itemstack1.isEmpty() || (this.bH & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bH & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
@ -52,7 +52,7 @@
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
@@ -376,14 +407,19 @@
@@ -378,14 +409,19 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
@ -74,7 +74,7 @@
return false;
} else if (DamageSource.FIRE.equals(damagesource)) {
if (this.isBurning()) {
@@ -407,7 +443,7 @@
@@ -409,7 +445,7 @@
} else if (damagesource.v()) {
this.F();
this.A();
@ -83,7 +83,7 @@
return false;
} else {
long i = this.world.getTime();
@@ -418,7 +454,7 @@
@@ -420,7 +456,7 @@
} else {
this.B();
this.A();
@ -92,7 +92,7 @@
}
return true;
@@ -445,7 +481,7 @@
@@ -447,7 +483,7 @@
f1 -= f;
if (f1 <= 0.5F) {
this.D();
@ -101,7 +101,7 @@
} else {
this.setHealth(f1);
}
@@ -453,7 +489,7 @@
@@ -455,7 +491,7 @@
}
private void B() {
@ -110,7 +110,7 @@
this.D();
}
@@ -466,7 +502,7 @@
@@ -468,7 +504,7 @@
for (i = 0; i < this.bE.size(); ++i) {
itemstack = (ItemStack) this.bE.get(i);
if (!itemstack.isEmpty()) {
@ -119,7 +119,7 @@
this.bE.set(i, ItemStack.a);
}
}
@@ -474,7 +510,7 @@
@@ -476,7 +512,7 @@
for (i = 0; i < this.bF.size(); ++i) {
itemstack = (ItemStack) this.bF.get(i);
if (!itemstack.isEmpty()) {
@ -128,7 +128,7 @@
this.bF.set(i, ItemStack.a);
}
}
@@ -586,6 +622,7 @@
@@ -588,6 +624,7 @@
}
public void killEntity() {

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityArrow.java
+++ b/net/minecraft/server/EntityArrow.java
@@ -5,6 +5,13 @@
@@ -7,6 +7,13 @@
import java.util.function.Predicate;
import javax.annotation.Nullable;
@ -13,16 +13,8 @@
+
public abstract class EntityArrow extends Entity implements IProjectile {
private static final Predicate<Entity> f = IEntitySelector.e.and(IEntitySelector.a.and(Entity::isInteractable));
@@ -42,6 +49,7 @@
protected EntityArrow(EntityTypes<?> entitytypes, EntityLiving entityliving, World world) {
this(entitytypes, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ, world);
this.shooter = entityliving;
+ this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
if (entityliving instanceof EntityHuman) {
this.fromPlayer = EntityArrow.PickupStatus.ALLOWED;
}
@@ -245,6 +253,7 @@
private static final Predicate<Entity> g = IEntitySelector.f.and(IEntitySelector.a.and(Entity::isInteractable));
@@ -250,6 +257,7 @@
}
protected void a(MovingObjectPosition movingobjectposition) {
@ -30,7 +22,7 @@
if (movingobjectposition.entity != null) {
this.b(movingobjectposition);
} else {
@@ -293,7 +302,13 @@
@@ -299,7 +307,13 @@
}
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
@ -45,10 +37,18 @@
}
if (entity.damageEntity(damagesource, (float) i)) {
@@ -430,9 +445,22 @@
@@ -444,6 +458,7 @@
public void setShooter(@Nullable Entity entity) {
this.shooter = entity == null ? null : entity.getUniqueID();
+ this.projectileSource = entity == null ? null : (LivingEntity) entity.getBukkitEntity(); // CraftBukkit
}
@Nullable
@@ -453,9 +468,22 @@
public void d(EntityHuman entityhuman) {
if (!this.world.isClientSide && (this.inGround || this.p()) && this.shake <= 0) {
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
+ // CraftBukkit start
+ ItemStack itemstack = this.getItemStack();
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
@ -61,7 +61,7 @@
+ return;
+ }
+ }
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.p() && this.shooter == entityhuman;
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.getItemStack())) {
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
@ -69,7 +69,7 @@
flag = false;
}
@@ -505,7 +533,14 @@
@@ -528,7 +556,14 @@
}
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {

View File

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

View File

@ -46,7 +46,7 @@
@@ -277,8 +295,12 @@
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
if (block.a(TagsBlock.G) && flag) {
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- this.enderman.setCarried(iblockdata);
- world.setAir(blockposition);
+ // CraftBukkit start - Pickup event

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityEvokerFangs.java
+++ b/net/minecraft/server/EntityEvokerFangs.java
@@ -108,7 +108,9 @@
@@ -111,7 +111,9 @@
if (entityliving.isAlive() && !entityliving.bl() && entityliving != entityliving1) {
if (entityliving1 == null) {

View File

@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityFish.java
+++ b/net/minecraft/server/EntityFish.java
@@ -67,6 +67,7 @@
@@ -71,6 +71,7 @@
public void s(boolean flag) {
public void setFromBucket(boolean flag) {
this.datawatcher.set(EntityFish.b, Boolean.valueOf(flag));
+ this.persistent = !this.isTypeNotPersistent(); // CraftBukkit - SPIGOT-4106 update persistence
}

View File

@ -86,7 +86,7 @@
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
+ }
+ // CraftBukkit end
if (itemstack1.getItem().a(TagsItem.D)) {
if (itemstack1.getItem().a(TagsItem.FISHES)) {
this.owner.a(StatisticList.FISH_CAUGHT, 1);
}
@@ -425,8 +463,25 @@

View File

@ -20,8 +20,8 @@
public void loadChest() {
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB());
+ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB(), this); // CraftBukkit
- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA());
+ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA(), this); // CraftBukkit
this.inventoryChest.a(this.getCustomName());
if (inventoryhorsechest != null) {
inventoryhorsechest.b(this);
@ -68,7 +68,7 @@
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
}
if (this.dZ()) {
if (this.dY()) {
@@ -716,6 +719,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
@ -106,5 +106,5 @@
+ }
+ // CraftBukkit end
this.canSlide = true;
this.dI();
this.dH();
}

View File

@ -54,7 +54,7 @@
@@ -184,7 +208,7 @@
ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.a)) {
if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) {
- this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true));
+ this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TURTLE_HELMET); // CraftBukkit
}
@ -215,7 +215,7 @@
if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f);
@@ -817,6 +905,7 @@
@@ -823,6 +911,7 @@
}
}
@ -223,7 +223,7 @@
}
public void openSign(TileEntitySign tileentitysign) {}
@@ -938,8 +1027,15 @@
@@ -944,8 +1033,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@ -241,10 +241,10 @@
}
}
@@ -970,8 +1066,11 @@
@@ -976,8 +1072,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) {
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h(entityliving) < 9.0D) {
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {
entityliving.a(this, 0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
@ -254,7 +254,7 @@
}
}
@@ -980,11 +1079,28 @@
@@ -986,11 +1085,28 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@ -283,7 +283,7 @@
}
if (flag2) {
@@ -1033,7 +1149,14 @@
@@ -1039,7 +1155,14 @@
this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@ -299,7 +299,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1049,6 +1172,11 @@
@@ -1055,6 +1178,11 @@
if (flag4) {
entity.extinguish();
}
@ -311,7 +311,7 @@
}
}
@@ -1145,6 +1273,20 @@
@@ -1151,6 +1279,20 @@
this.stopRiding();
}
@ -330,9 +330,9 @@
+ // CraftBukkit end
+
this.releaseShoulderEntities();
this.a(StatisticList.CUSTOM.b(StatisticList.n));
this.a(StatisticList.CUSTOM.b(StatisticList.TIME_SINCE_REST));
this.setSize(0.2F, 0.2F);
@@ -1206,6 +1348,23 @@
@@ -1212,6 +1354,23 @@
this.world.everyoneSleeping();
}
@ -356,7 +356,7 @@
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
this.setRespawnPosition(this.bedPosition, false);
@@ -1257,9 +1416,11 @@
@@ -1263,9 +1422,11 @@
if (blockposition != null) {
this.e = blockposition;
this.f = flag;
@ -368,7 +368,7 @@
}
}
@@ -1325,7 +1486,11 @@
@@ -1331,7 +1492,11 @@
this.motY = d3 * 0.6D;
this.aU = f3;
this.fallDistance = 0.0F;
@ -381,7 +381,7 @@
} else {
super.a(f, f1, f2);
}
@@ -1636,13 +1801,17 @@
@@ -1631,13 +1796,17 @@
}
protected void releaseShoulderEntities() {
@ -404,7 +404,7 @@
if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
Entity entity = EntityTypes.a(nbttagcompound, this.world);
@@ -1651,9 +1820,10 @@
@@ -1646,9 +1815,10 @@
}
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
@ -416,7 +416,7 @@
}
public abstract boolean isSpectator();
@@ -1864,7 +2034,7 @@
@@ -1859,7 +2029,7 @@
return entitymonster.c(this.a);
}

View File

@ -19,7 +19,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
@@ -27,11 +39,11 @@
@@ -27,7 +39,7 @@
public float[] dropChanceHand;
private final NonNullList<ItemStack> bE;
public float[] dropChanceArmor;
@ -27,13 +27,7 @@
+ // public boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
public boolean persistent;
private final Map<PathType, Float> bH;
- private MinecraftKey bI;
- private long bJ;
+ public MinecraftKey bI; // CraftBukkit private -> public
+ public long bJ; // CraftBukkit private -> public
private boolean bK;
private Entity leashHolder;
private NBTTagCompound bM;
public MinecraftKey lootTableKey;
@@ -57,6 +69,9 @@
this.n();
}
@ -107,17 +101,17 @@
int i;
@@ -394,6 +449,11 @@
protected MinecraftKey G() {
protected MinecraftKey getDefaultLootTable() {
return null;
}
+ // CraftBukkit - start
+ public MinecraftKey getLootTable() {
+ return G();
+ return getDefaultLootTable();
+ }
+ // CraftBukkit - end
protected void a(boolean flag, int i, DamageSource damagesource) {
MinecraftKey minecraftkey = this.bI;
MinecraftKey minecraftkey = this.lootTableKey;
@@ -470,11 +530,21 @@
ItemStack itemstack1 = this.getEquipment(enumitemslot);
boolean flag = this.a(itemstack, itemstack1, enumitemslot);
@ -132,7 +126,7 @@
+ canPickup = !entityEvent.isCancelled();
+ if (canPickup) {
+ // CraftBukkit end
double d0 = this.c(enumitemslot);
double d0 = (double) this.c(enumitemslot);
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
+ this.forceDrops = true; // CraftBukkit
@ -155,7 +149,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
@@ -946,12 +1016,24 @@
@@ -942,12 +1012,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@ -180,7 +174,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
@@ -972,10 +1054,12 @@
@@ -968,10 +1050,12 @@
if (this.bK) {
if (!this.isAlive()) {
@ -193,7 +187,7 @@
this.unleash(true, true);
}
}
@@ -986,7 +1070,9 @@
@@ -982,7 +1066,9 @@
this.bK = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
@ -203,7 +197,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1056,6 +1142,7 @@
@@ -1052,6 +1138,7 @@
this.setLeashHolder(entityleash, true);
} else {
@ -211,7 +205,7 @@
this.unleash(false, true);
}
}
@@ -1151,7 +1238,14 @@
@@ -1147,7 +1234,14 @@
int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (j > 0) {

View File

@ -101,14 +101,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));
- }
@ -375,69 +375,70 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
@@ -712,14 +912,16 @@
} else {
float f1 = f;
@@ -711,15 +911,17 @@
this.ticksFarFromPlayer = 0;
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()) {
this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
f *= 0.75F;
}
- boolean flag = false;
+ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
- if (f > 0.0F && this.applyBlockingModifier(damagesource)) {
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ if (false && f > 0.0F && this.applyBlockingModifier(damagesource)) {
this.damageShield(f);
f = 0.0F;
if (!damagesource.b()) {
@@ -738,20 +940,39 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
+ this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
return false;
}
- this.damageEntity0(damagesource, f - this.lastDamage);
+ // CraftBukkit start
+ if (!this.damageEntity0(damagesource, f - this.lastDamage)) {
+ return false;
+ }
+ // CraftBukkit end
this.lastDamage = f;
flag1 = false;
} else {
+ // CraftBukkit start
+ if (!this.damageEntity0(damagesource, f)) {
+ return false;
+ }
this.lastDamage = f;
this.noDamageTicks = this.maxNoDamageTicks;
- this.damageEntity0(damagesource, f);
+ // this.damageEntity0(damagesource, f);
+ // CraftBukkit end
this.aC = 10;
this.hurtTicks = this.aC;
- 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()) {
this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
f *= 0.75F;
}
- boolean flag = false;
+ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
float f2 = 0.0F;
- if (f > 0.0F && this.applyBlockingModifier(damagesource)) {
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ if (false && f > 0.0F && this.applyBlockingModifier(damagesource)) {
this.damageShield(f);
f2 = f;
f = 0.0F;
@@ -739,20 +941,39 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
+ this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
return false;
}
- this.damageEntity0(damagesource, f - this.lastDamage);
+ // CraftBukkit start
+ if (this instanceof EntityAnimal) {
+ ((EntityAnimal) this).resetLove();
+ if (this instanceof EntityTameableAnimal) {
+ ((EntityTameableAnimal) this).getGoalSit().setSitting(false);
+ }
+ if (!this.damageEntity0(damagesource, f - this.lastDamage)) {
+ return false;
+ }
+ // CraftBukkit end
+
this.aD = 0.0F;
Entity entity1 = damagesource.getEntity();
this.lastDamage = f;
flag1 = false;
} else {
+ // CraftBukkit start
+ if (!this.damageEntity0(damagesource, f)) {
+ return false;
+ }
this.lastDamage = f;
this.noDamageTicks = this.maxNoDamageTicks;
- this.damageEntity0(damagesource, f);
+ // this.damageEntity0(damagesource, f);
+ // CraftBukkit end
this.aC = 10;
this.hurtTicks = this.aC;
}
@@ -858,19 +1079,29 @@
+ // CraftBukkit start
+ if (this instanceof EntityAnimal) {
+ ((EntityAnimal) this).resetLove();
+ if (this instanceof EntityTameableAnimal) {
+ ((EntityTameableAnimal) this).getGoalSit().setSitting(false);
+ }
+ }
+ // CraftBukkit end
+
this.aD = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -861,19 +1082,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@ -471,7 +472,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
@@ -878,13 +1109,15 @@
@@ -881,13 +1112,15 @@
}
this.setHealth(1.0F);
@ -491,7 +492,7 @@
}
}
@@ -955,6 +1188,12 @@
@@ -958,6 +1191,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@ -504,7 +505,7 @@
}
}
@@ -1044,8 +1283,13 @@
@@ -1047,8 +1286,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@ -513,13 +514,13 @@
+ return;
+ }
+ // CraftBukkit end
this.a(this.n(i), 1.0F, 1.0F);
this.a(this.m(i), 1.0F, 1.0F);
- this.damageEntity(DamageSource.FALL, (float) i);
+ // this.damageEntity(DamageSource.FALL, (float) i); // CraftBukkit - moved up
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
@@ -1072,7 +1316,7 @@
@@ -1075,7 +1319,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@ -528,7 +529,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.i).getValue());
}
@@ -1085,7 +1329,8 @@
@@ -1088,7 +1332,8 @@
} else {
int i;
@ -538,7 +539,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1106,22 +1351,142 @@
@@ -1119,28 +1364,164 @@
}
}
@ -547,10 +548,6 @@
- f = this.applyArmorModifier(damagesource, f);
- f = this.applyMagicModifier(damagesource, f);
- float f1 = f;
-
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- if (f != 0.0F) {
+ // CraftBukkit start
+ protected boolean damageEntity0(final DamageSource damagesource, float f) { // void -> boolean, add final
+ if (!this.isInvulnerable(damagesource)) {
@ -623,9 +620,24 @@
+ if (event.isCancelled()) {
+ return false;
+ }
+
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- float f2 = f1 - f;
+ f = (float) event.getFinalDamage();
+
+ // Resistance
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
+ if (f3 > 0.0F && f3 < 3.4028235E37F) {
+ if (this instanceof EntityPlayer) {
+ ((EntityPlayer) this).a(StatisticList.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
+ } else if (damagesource.getEntity() instanceof EntityPlayer) {
+ ((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
+ }
+ }
+ }
+
+ // Apply damage to helmet
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(EnumItemSlot.HEAD) != null) {
+ this.getEquipment(EnumItemSlot.HEAD).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this);
@ -649,6 +661,13 @@
+
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
+ this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
+ float f2 = absorptionModifier;
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof EntityPlayer) {
((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
}
- if (f != 0.0F) {
+ if (f > 0 || !human) {
+ if (human) {
+ // PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
@ -658,10 +677,10 @@
+ }
+ }
+ // CraftBukkit end
float f2 = this.getHealth();
float f3 = this.getHealth();
this.setHealth(f2 - f);
this.getCombatTracker().trackDamage(damagesource, f2, f);
this.setHealth(f3 - f);
this.getCombatTracker().trackDamage(damagesource, f3, f);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
+ // CraftBukkit start
+ if (!human) {
@ -674,6 +693,10 @@
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ if (this instanceof EntityPlayer) {
+ CriterionTriggers.h.a((EntityPlayer) this, damagesource, f, originalDamage, true);
+ f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
+ if (f2 > 0.0F && f2 < 3.4028235E37F) {
+ ((EntityPlayer) this).a(StatisticList.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
+ }
+ }
+
+ if (damagesource.getEntity() instanceof EntityPlayer) {
@ -691,7 +714,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1188,6 +1553,7 @@
@@ -1207,6 +1588,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@ -699,7 +722,7 @@
}
return this.attributeMap;
@@ -1490,6 +1856,7 @@
@@ -1509,6 +1891,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -707,7 +730,7 @@
this.setFlag(7, false);
}
} else {
@@ -1891,6 +2258,7 @@
@@ -1910,6 +2293,7 @@
}
if (!this.world.isClientSide) {
@ -715,7 +738,7 @@
this.setFlag(7, flag);
}
@@ -2018,11 +2386,11 @@
@@ -2037,11 +2421,11 @@
}
public boolean isInteractable() {
@ -729,7 +752,7 @@
}
protected void aA() {
@@ -2182,7 +2550,27 @@
@@ -2201,7 +2585,27 @@
protected void q() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
@ -758,7 +781,7 @@
this.da();
}
@@ -2261,10 +2649,18 @@
@@ -2280,10 +2684,18 @@
}
if (flag1) {

View File

@ -51,8 +51,8 @@
+
+ f = (float) event.getDamage();
+ // CraftBukkit end
this.l(-this.u());
this.e(10);
this.k(-this.u());
this.d(10);
this.aA();
@@ -105,6 +138,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
@ -83,7 +83,7 @@
+ // CraftBukkit end
+
if (this.getType() > 0) {
this.e(this.getType() - 1);
this.d(this.getType() - 1);
}
@@ -157,6 +207,8 @@

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityMinecartContainer.java
+++ b/net/minecraft/server/EntityMinecartContainer.java
@@ -3,23 +3,66 @@
@@ -3,6 +3,13 @@
import java.util.Iterator;
import java.util.Random;
import javax.annotation.Nullable;
@ -14,12 +14,10 @@
public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable {
private NonNullList<ItemStack> items;
private boolean b;
@@ -11,15 +18,51 @@
private MinecraftKey c;
- private long d;
+ public long d; // CraftBukkit private -> public
+
public long lootTableSeed;
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
@ -55,7 +53,7 @@
+ return getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
+
protected EntityMinecartContainer(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
- this.items = NonNullList.a(36, ItemStack.a);

View File

@ -20,6 +20,6 @@
+ return false;
+ }
+ // CraftBukkit end
this.die();
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
this.die();

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
@@ -15,11 +15,29 @@
@@ -15,10 +15,28 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -25,13 +25,12 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger cc = LogManager.getLogger();
private static final IChatBaseComponent cd = (new ChatMessage("multiplayer.message_not_delivered", new Object[0])).a(EnumChatFormat.RED);
- public String locale = "en_US";
+ public String locale = "en_us"; // CraftBukkit - lowercase
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
@@ -55,6 +73,19 @@
@@ -54,6 +72,19 @@
public int ping;
public boolean viewingCredits;
@ -51,8 +50,8 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super((World) worldserver, gameprofile);
playerinteractmanager.player = this;
@@ -65,8 +96,50 @@
this.cg = minecraftserver.getPlayerList().h(this);
@@ -64,8 +95,50 @@
this.cf = minecraftserver.getPlayerList().h(this);
this.Q = 1.0F;
this.a(worldserver);
+
@ -80,7 +79,7 @@
+ }
+
+ int k = (i * 2 + 1) * (i * 2 + 1);
+ int l = this.s(k);
+ int l = this.r(k);
+ int i1 = (new Random()).nextInt(k);
+
+ for (int j1 = 0; j1 < k; ++j1) {
@ -102,15 +101,15 @@
private void a(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSpawn();
@@ -133,6 +206,7 @@
@@ -132,6 +205,7 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.cz.a(nbttagcompound.getCompound("recipeBook"));
this.cy.a(nbttagcompound.getCompound("recipeBook"));
}
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
}
@@ -152,7 +226,20 @@
@@ -151,7 +225,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@ -132,10 +131,10 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -163,8 +250,34 @@
@@ -162,8 +249,34 @@
}
nbttagcompound.set("recipeBook", this.cz.e());
nbttagcompound.set("recipeBook", this.cy.e());
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
@ -167,7 +166,7 @@
public void a(int i) {
float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f;
@@ -211,6 +324,11 @@
@@ -210,6 +323,11 @@
}
public void tick() {
@ -179,17 +178,17 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
@@ -276,7 +394,7 @@
@@ -275,7 +393,7 @@
}
if (this.getHealth() != this.lastHealthSent || this.cp != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cq) {
if (this.getHealth() != this.lastHealthSent || this.co != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) {
- 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.cp = this.foodData.getFoodLevel();
this.cq = this.foodData.getSaturationLevel() == 0.0F;
@@ -307,6 +425,12 @@
this.a(IScoreboardCriteria.k, MathHelper.f((float) this.cn));
this.co = this.foodData.getFoodLevel();
this.cp = this.foodData.getSaturationLevel() == 0.0F;
@@ -306,6 +424,12 @@
this.a(IScoreboardCriteria.k, MathHelper.f((float) this.cm));
}
+ // CraftBukkit start - Force max health updates
@ -198,10 +197,10 @@
+ }
+ // CraftBukkit end
+
if (this.expLevel != this.cm) {
this.cm = this.expLevel;
this.a(IScoreboardCriteria.l, MathHelper.f((float) this.cm));
@@ -321,6 +445,16 @@
if (this.expLevel != this.cl) {
this.cl = this.expLevel;
this.a(IScoreboardCriteria.l, MathHelper.f((float) this.cl));
@@ -320,6 +444,16 @@
CriterionTriggers.p.a(this);
}
@ -218,7 +217,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -331,7 +465,8 @@
@@ -330,24 +464,50 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -228,12 +227,9 @@
scoreboardscore.setScore(i);
});
}
@@ -340,27 +475,59 @@
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag));
- if (flag) {
- ScoreboardTeamBase scoreboardteambase = this.be();
public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
+ // CraftBukkit start - fire PlayerDeathEvent
+ if (this.dead) {
+ return;
@ -248,36 +244,36 @@
+ }
+ }
+ }
+
+ IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage();
+
+ String deathmessage = chatmessage.getString();
+ 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());
- if (flag) {
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
+
+ String deathmessage = defaultMessage.getString();
+ 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?
+ IChatBaseComponent ichatbasecomponent;
+ if (deathMessage.equals(deathmessage)) {
+ ScoreboardTeamBase scoreboardteambase = this.be();
+
+ if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
+ if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
+ this.server.getPlayerList().a((EntityHuman) this, chatmessage);
+ } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
+ this.server.getPlayerList().b((EntityHuman) this, chatmessage);
+ }
+ } else {
+ this.server.getPlayerList().sendMessage(chatmessage);
}
} else {
- this.server.getPlayerList().sendMessage(this.getCombatTracker().getDeathMessage());
+ this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(deathMessage));
}
+ ichatbasecomponent = this.getCombatTracker().getDeathMessage();
+ } else {
+ ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage);
+ }
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) {
- boolean flag = true;
String s = ichatbasecomponent.a(256);
ChatMessage chatmessage = new ChatMessage("death.attack.message_too_long", new Object[] { (new ChatComponentText(s)).a(EnumChatFormat.YELLOW)});
IChatBaseComponent ichatbasecomponent1 = (new ChatMessage("death.attack.even_more_magic", new Object[] { this.getScoreboardDisplayName()})).a((chatmodifier) -> {
- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent));
+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatmessage));
});
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent1));
@@ -370,12 +530,17 @@
}
this.releaseShoulderEntities();
@ -296,11 +292,10 @@
+
+ // CraftBukkit - Get our scores instead
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), ScoreboardScore::incrementScore);
+
EntityLiving entityliving = this.cv();
if (entityliving != null) {
@@ -383,10 +550,12 @@
@@ -398,10 +563,12 @@
String s = this.getName();
String s1 = entity.getName();
@ -315,7 +310,7 @@
} else {
this.a(StatisticList.MOB_KILLS);
}
@@ -404,7 +573,8 @@
@@ -419,7 +586,8 @@
int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -325,7 +320,7 @@
}
}
@@ -445,12 +615,14 @@
@@ -461,12 +629,14 @@
}
private boolean canPvP() {
@ -335,34 +330,34 @@
}
@Nullable
public Entity d(int i) {
public Entity a(DimensionManager dimensionmanager) {
- 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.cD = new Vec3D(this.locX, this.locY, this.locZ);
} else if (this.dimension != -1 && i != 0) {
@@ -458,6 +630,7 @@
if (this.dimension == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
this.cC = new Vec3D(this.locX, this.locY, this.locZ);
} else if (this.dimension != DimensionManager.NETHER && dimensionmanager != DimensionManager.OVERWORLD) {
@@ -474,6 +644,7 @@
}
if (this.dimension == 1 && i == 1) {
if (this.dimension == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
+ this.worldChangeInvuln = true; // CraftBukkit - Moved down from above
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
@@ -471,7 +644,10 @@
i = 1;
@@ -487,7 +658,10 @@
dimensionmanager = DimensionManager.THE_END;
}
- this.server.getPlayerList().a(this, i);
- this.server.getPlayerList().a(this, dimensionmanager);
+ // CraftBukkit start
+ TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
+ this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this
+ TeleportCause cause = (this.dimension == DimensionManager.THE_END || i == DimensionManager.THE_END) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
+ this.server.getPlayerList().changeDimension(this, dimensionmanager, cause); // PAIL: check all this
+ // CraftBukkit end
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
@@ -517,6 +693,7 @@
@@ -533,6 +707,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@ -370,7 +365,7 @@
if (this.isSleeping()) {
this.getWorldServer().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
@@ -595,23 +772,55 @@
@@ -611,23 +786,55 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@ -381,12 +376,12 @@
}
public void openTileEntity(ITileEntityContainer itileentitycontainer) {
- if (itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator()) {
- if (itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable() != null && this.isSpectator()) {
+ // CraftBukkit start - Inventory open hook
+ if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator()) {
+ if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable() != null && this.isSpectator()) {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
} else {
+ boolean cancelled = itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator();
+ boolean cancelled = itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable()!= null && this.isSpectator();
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, itileentitycontainer.createContainer(this.inventory, this), cancelled);
+ if (container == null) {
+ return;
@ -426,10 +421,10 @@
+ }
+ // CraftBukkit end
+
if (iinventory instanceof ILootable && ((ILootable) iinventory).Q_() != null && this.isSpectator()) {
if (iinventory instanceof ILootable && ((ILootable) iinventory).getLootTable() != null && this.isSpectator()) {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
} else {
@@ -625,18 +834,21 @@
@@ -641,18 +848,21 @@
if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
@ -453,7 +448,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -644,8 +856,14 @@
@@ -660,8 +870,14 @@
}
public void openTrade(IMerchant imerchant) {
@ -469,7 +464,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).d();
@@ -665,13 +883,20 @@
@@ -681,13 +897,20 @@
}
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -491,7 +486,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -712,6 +937,11 @@
@@ -728,6 +951,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()));
@ -503,7 +498,7 @@
}
public void setContainerData(Container container, int i, int j) {
@@ -726,6 +956,7 @@
@@ -742,6 +970,7 @@
}
public void closeInventory() {
@ -511,10 +506,10 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.m();
}
@@ -759,14 +990,14 @@
@@ -775,14 +1004,14 @@
public void a(Statistic<?> statistic, int i) {
this.ch.b(this, statistic, i);
this.cg.b(this, statistic, i);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), (scoreboardscore) -> {
+ this.world.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
scoreboardscore.addScore(i);
@ -522,13 +517,13 @@
}
public void a(Statistic<?> statistic) {
this.ch.setStatistic(this, statistic, 0);
this.cg.setStatistic(this, statistic, 0);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), ScoreboardScore::c);
+ this.world.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), ScoreboardScore::c); // CraftBukkit - Get our scores instead
}
public int a(Collection<IRecipe> collection) {
@@ -814,8 +1045,17 @@
@@ -830,8 +1059,17 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@ -546,16 +541,16 @@
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
}
@@ -866,7 +1106,7 @@
@@ -882,7 +1120,7 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.cp = -1;
- this.cz.a((RecipeBook) entityplayer.cz);
+ // this.cz.a((RecipeBook) entityplayer.cz); // CraftBukkit
this.co = -1;
- this.cy.a((RecipeBook) entityplayer.cy);
+ // this.cy.a((RecipeBook) entityplayer.cy); // CraftBukkit
this.removeQueue.addAll(entityplayer.removeQueue);
this.cy = entityplayer.cy;
this.cD = entityplayer.cD;
@@ -925,6 +1165,18 @@
this.cx = entityplayer.cx;
this.cC = entityplayer.cC;
@@ -941,6 +1179,18 @@
}
public void a(EnumGamemode enumgamemode) {
@ -574,7 +569,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -968,6 +1220,16 @@
@@ -988,6 +1238,16 @@
}
public void a(PacketPlayInSettings packetplayinsettings) {
@ -589,18 +584,18 @@
+ }
+ // CraftBukkit end
this.locale = packetplayinsettings.b();
this.ct = packetplayinsettings.d();
this.cu = packetplayinsettings.e();
@@ -1033,7 +1295,7 @@
this.cw = (Entity) (entity == null ? this : entity);
if (entity1 != this.cw) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cw));
- this.enderTeleportTo(this.cw.locX, this.cw.locY, this.cw.locZ);
+ this.playerConnection.a(this.cw.locX, this.cw.locY, this.cw.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
this.cs = packetplayinsettings.d();
this.ct = packetplayinsettings.e();
@@ -1053,7 +1313,7 @@
this.cv = (Entity) (entity == null ? this : entity);
if (entity1 != this.cv) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cv));
- this.enderTeleportTo(this.cv.locX, this.cv.locY, this.cv.locZ);
+ this.playerConnection.a(this.cv.locX, this.cv.locY, this.cv.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
}
}
@@ -1060,7 +1322,7 @@
@@ -1080,7 +1340,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@ -609,7 +604,7 @@
}
public void a(EnumHand enumhand) {
@@ -1077,12 +1339,17 @@
@@ -1097,12 +1357,17 @@
}
public void J() {
@ -627,8 +622,8 @@
}
public AdvancementDataPlayer getAdvancementData() {
@@ -1094,9 +1361,16 @@
return this.cD;
@@ -1114,9 +1379,16 @@
return this.cC;
}
+ // CraftBukkit start
@ -644,7 +639,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
@@ -1121,6 +1395,149 @@
@@ -1141,6 +1413,149 @@
this.server.getPlayerList().b(this, worldserver);
this.server.getPlayerList().updateClient(this);
}

View File

@ -71,6 +71,6 @@
this.container.setItem(0, new ItemStack(ItemDye.a(enumcolor)));
this.container.setItem(1, new ItemStack(ItemDye.a(enumcolor1)));
+ this.container.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
ItemStack itemstack = entityanimal.world.D().craft(this.container, ((EntitySheep) entityanimal).world);
ItemStack itemstack = entityanimal.world.E().craft(this.container, ((EntitySheep) entityanimal).world);
Item item = itemstack.getItem();
EnumColor enumcolor2;

View File

@ -20,28 +20,25 @@
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
@@ -20,10 +27,17 @@
@@ -20,7 +27,16 @@
if (movingobjectposition.entity != null) {
if (!movingobjectposition.entity.isFireProof()) {
- flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
- if (flag) {
- movingobjectposition.entity.setOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
+ isIncendiary = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
+ if (isIncendiary) {
this.a(this.shooter, movingobjectposition.entity);
- movingobjectposition.entity.setOnFire(5);
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
+ movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ movingobjectposition.entity.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
}
}
} else {
@@ -32,11 +46,15 @@
+ }
+ // CraftBukkit end
flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
if (flag) {
this.a(this.shooter, movingobjectposition.entity);
@@ -32,11 +48,15 @@
flag = this.world.getGameRules().getBoolean("mobGriefing");
}

View File

@ -6,16 +6,16 @@
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ this.getDataWatcher().set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ }
+
+ public String getType() {
+ return ((MinecraftKey) PotionRegistry.a.b(this.potionRegistry)).toString();
+ return IRegistry.POTION.getKey(this.potionRegistry).toString();
+ }
+
+ public void setType(String string) {
+ this.potionRegistry = PotionRegistry.a.get(new MinecraftKey(string));
+ this.datawatcher.set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ this.potionRegistry = IRegistry.POTION.get(new MinecraftKey(string));
+ this.datawatcher.set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ }
+
+ public boolean isTipped() {
@ -24,7 +24,7 @@
+ // CraftBukkit end
+
public int getColor() {
return ((Integer) this.datawatcher.get(EntityTippedArrow.f)).intValue();
return ((Integer) this.datawatcher.get(EntityTippedArrow.g)).intValue();
}
@@ -180,7 +199,7 @@

View File

@ -1,16 +1,16 @@
--- a/net/minecraft/server/EntityTurtle.java
+++ b/net/minecraft/server/EntityTurtle.java
@@ -231,7 +231,9 @@
@@ -232,7 +232,9 @@
protected void l() {
super.l();
+ this.forceDrops = true; // CraftBukkit
this.a((IMaterial) Items.SCUTE, 1);
+ this.forceDrops = false; // CraftBukkit
}
if (this.world.getGameRules().getBoolean("doMobLoot")) {
+ this.forceDrops = true; // CraftBukkit
this.a((IMaterial) Items.SCUTE, 1);
+ this.forceDrops = false; // CraftBukkit
}
public void a(float f, float f1, float f2) {
@@ -260,7 +262,9 @@
}
@@ -263,7 +265,9 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
@ -20,7 +20,7 @@
}
public void die(DamageSource damagesource) {
@@ -438,8 +442,12 @@
@@ -441,8 +445,12 @@
} else if (this.f.bK > 200) {
World world = this.f.world;
@ -32,4 +32,4 @@
+ // CraftBukkit end
this.f.s(false);
this.f.t(false);
this.f.e(600);
this.f.d(600);

View File

@ -1,6 +1,15 @@
--- a/net/minecraft/server/EntityTypes.java
+++ b/net/minecraft/server/EntityTypes.java
@@ -148,10 +148,16 @@
@@ -121,7 +121,7 @@
public static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.a<T> entitytypes_a) {
EntityTypes entitytypes = entitytypes_a.a(s);
- IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), (Object) entitytypes);
+ IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), entitytypes); // CraftBukkit - decompile error
return entitytypes;
}
@@ -150,10 +150,16 @@
@Nullable
public T a(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, boolean flag, boolean flag1) {
@ -19,7 +28,7 @@
}
@Nullable
@@ -185,7 +191,7 @@
@@ -187,7 +193,7 @@
}
a(world, entityhuman, entity, nbttagcompound);
@ -28,12 +37,12 @@
}
}
@@ -240,7 +246,7 @@
@@ -250,7 +256,7 @@
@Nullable
public T a(World world) {
- return (Entity) this.aU.apply(world);
+ return this.aU.apply(world); // CraftBukkit - decompile error
- return (Entity) this.aT.apply(world);
+ return this.aT.apply(world); // CraftBukkit - decompile error
}
@Nullable

View File

@ -14,8 +14,8 @@
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
@@ -181,13 +187,38 @@
if (this.dA() > 0) {
i = this.dA() - 1;
if (this.dz() > 0) {
i = this.dz() - 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);
@ -48,7 +48,7 @@
+ // CraftBukkit end
}
this.e(i);
this.d(i);
if (this.ticksLived % 10 == 0) {
- this.heal(10.0F);
+ this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit

View File

@ -30,7 +30,7 @@
}
}
@@ -220,7 +234,7 @@
@@ -221,7 +235,7 @@
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@ -39,10 +39,10 @@
this.die();
}
}
@@ -251,8 +265,8 @@
@@ -252,8 +266,8 @@
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.b((Entity) entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a_(entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
- this.world.addEntity(entityzombie);
- entityzombie.setGoalTarget(entityliving);
+ this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
@ -50,7 +50,7 @@
entityzombie.prepare(this.world.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
this.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
@@ -275,7 +289,14 @@
@@ -276,7 +290,14 @@
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
@ -66,7 +66,7 @@
}
}
@@ -371,7 +392,7 @@
@@ -372,7 +393,7 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@ -75,7 +75,7 @@
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
@@ -421,7 +442,7 @@
@@ -422,7 +443,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@ -84,7 +84,7 @@
this.startRiding(entitychicken1);
}
}
@@ -494,7 +515,7 @@
@@ -495,7 +516,7 @@
}
public void die(DamageSource damagesource) {
@ -93,7 +93,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
@@ -507,6 +528,7 @@
@@ -508,6 +529,7 @@
}
}
}

View File

@ -11,7 +11,7 @@
@@ -56,6 +57,11 @@
public void tick() {
if (!this.world.isClientSide && this.isConverting()) {
int i = this.dL();
int i = this.dK();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.lastTick = MinecraftServer.currentTick;

View File

@ -40,7 +40,7 @@
HashSet hashset = Sets.newHashSet();
boolean flag = true;
@@ -75,7 +88,7 @@
@@ -76,7 +89,7 @@
f -= (f2 + 0.3F) * 0.3F;
}
@ -49,7 +49,7 @@
hashset.add(blockposition);
}
@@ -119,7 +132,16 @@
@@ -120,7 +133,16 @@
double d12 = (double) this.world.a(vec3d, entity.getBoundingBox());
double d13 = (1.0D - d7) * d12;
@ -67,7 +67,7 @@
double d14 = d13;
if (entity instanceof EntityLiving) {
@@ -155,6 +177,50 @@
@@ -156,6 +178,50 @@
BlockPosition blockposition;
if (this.b) {
@ -118,7 +118,7 @@
iterator = this.blocks.iterator();
while (iterator.hasNext()) {
@@ -186,7 +252,8 @@
@@ -187,7 +253,8 @@
if (!iblockdata.isAir()) {
if (block.a(this)) {
@ -128,7 +128,7 @@
}
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
@@ -201,7 +268,11 @@
@@ -202,7 +269,11 @@
while (iterator.hasNext()) {
blockposition = (BlockPosition) iterator.next();
if (this.world.getType(blockposition).isAir() && this.world.getType(blockposition.down()).f(this.world, blockposition.down()) && this.c.nextInt(3) == 0) {
@ -141,7 +141,7 @@
}
}
}
@@ -222,7 +293,9 @@
@@ -223,7 +294,9 @@
@Nullable
public EntityLiving getSource() {

View File

@ -1,9 +1,9 @@
--- a/net/minecraft/server/FluidTypeFlowing.java
+++ b/net/minecraft/server/FluidTypeFlowing.java
@@ -5,6 +5,11 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -14,13 +14,18 @@
import java.util.function.IntFunction;
import java.util.function.IntPredicate;
import java.util.function.Supplier;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.block.CraftBlock;
@ -12,7 +12,15 @@
public abstract class FluidTypeFlowing extends FluidType {
@@ -128,6 +133,15 @@
public static final BlockStateBoolean FALLING = BlockProperties.h;
public static final BlockStateInteger LEVEL = BlockProperties.ag;
private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.a>> e = ThreadLocal.withInitial(() -> {
- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) {
+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.a>(200) { // CraftBukkit - decompile error
protected void rehash(int i) {}
};
@@ -145,6 +150,15 @@
Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1);
if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
@ -28,7 +36,7 @@
this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1);
if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) {
this.a(generatoraccess, blockposition, fluid, iblockdata);
@@ -158,6 +172,15 @@
@@ -175,6 +189,15 @@
IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
@ -44,3 +52,69 @@
this.a(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1);
}
}
@@ -307,21 +330,25 @@
if (enumdirection1 != enumdirection) {
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
short short0 = a(blockposition1, blockposition2);
- Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (i) -> {
- IBlockData iblockdata = iworldreader.getType(blockposition);
+ // CraftBukkit start - decompile errors
+ Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (ix) -> {
+ IBlockData iblockdatax = iworldreader.getType(blockposition2);
- return Pair.of(iblockdata, iblockdata.s());
+ return Pair.of(iblockdatax, iblockdatax.s());
});
+ // CraftBukkit end
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
Fluid fluid = (Fluid) pair.getSecond();
if (this.a(iworldreader, this.e(), blockposition, iblockdata, enumdirection1, blockposition2, iblockdata1, fluid)) {
- boolean flag = short2booleanmap.computeIfAbsent(short0, (i) -> {
- BlockPosition blockposition = blockposition1.down();
- IBlockData iblockdata = iworldreader.getType(blockposition);
+ // CraftBukkit start - decompile errors
+ boolean flag = short2booleanmap.computeIfAbsent(short0, (ix) -> {
+ BlockPosition blockpositionx = blockposition2.down();
+ IBlockData iblockdatax = iworldreader.getType(blockpositionx);
- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata);
+ return this.a((IBlockAccess) iworldreader, this.e(), blockposition2, iblockdata1, blockpositionx, iblockdatax);
});
+ // CraftBukkit end
if (flag) {
return i;
@@ -383,22 +410,26 @@
EnumDirection enumdirection = (EnumDirection) iterator.next();
BlockPosition blockposition1 = blockposition.shift(enumdirection);
short short0 = a(blockposition, blockposition1);
- Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (i) -> {
- IBlockData iblockdata = iworldreader.getType(blockposition);
+ // CraftBukkit start - decompile errors
+ Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (ix) -> {
+ IBlockData iblockdatax = iworldreader.getType(blockposition1);
- return Pair.of(iblockdata, iblockdata.s());
+ return Pair.of(iblockdatax, iblockdatax.s());
});
+ // CraftBukkit end
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
Fluid fluid = (Fluid) pair.getSecond();
Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
if (this.a(iworldreader, fluid1.c(), blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, fluid)) {
BlockPosition blockposition2 = blockposition1.down();
- boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (i) -> {
- IBlockData iblockdata = iworldreader.getType(blockposition);
+ // CraftBukkit start - decompile errors
+ boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (ix) -> {
+ IBlockData iblockdatax = iworldreader.getType(blockposition2);
- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata);
+ return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition2, iblockdatax);
});
+ // CraftBukkit end
int j;
if (flag) {

View File

@ -31,7 +31,7 @@
}
@@ -139,7 +154,11 @@
if (this.a(TagsFluid.b) && fluid1.a(TagsFluid.a)) {
if (this.a(TagsFluid.LAVA) && fluid1.a(TagsFluid.WATER)) {
if (iblockdata.getBlock() instanceof BlockFluids) {
- generatoraccess.setTypeAndData(blockposition, Blocks.STONE.getBlockData(), 3);
+ // CraftBukkit start

View File

@ -57,8 +57,8 @@
+ }
+ // CraftBukkit end
+
if (packethandshakinginsetprotocol.c() > 393) {
chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13"});
if (packethandshakinginsetprotocol.c() > 401) {
chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13.1"});
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
@@ -26,6 +71,7 @@
this.b.close(chatmessage);

View File

@ -11,7 +11,7 @@
+
public class ItemArmor extends Item {
private static final UUID[] l = new UUID[] { UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
private static final UUID[] k = new UUID[] { UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
@@ -29,6 +34,32 @@
EntityLiving entityliving = (EntityLiving) list.get(0);
EnumItemSlot enumitemslot = EntityInsentient.e(itemstack);

View File

@ -60,4 +60,4 @@
+ // CraftBukkit end
}
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.k.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ItemBucket.java
+++ b/net/minecraft/server/ItemBucket.java
@@ -1,10 +1,17 @@
@@ -1,6 +1,13 @@
package net.minecraft.server;
import javax.annotation.Nullable;
@ -14,13 +14,8 @@
public class ItemBucket extends Item {
- private final FluidType a;
+ public final FluidType a; // PAIL: private->public
public ItemBucket(FluidType fluidtype, Item.Info item_info) {
super(item_info);
@@ -28,12 +35,20 @@
if (this.a == FluidTypes.a) {
@@ -26,12 +33,20 @@
if (this.fluidType == FluidTypes.a) {
iblockdata = world.getType(blockposition);
if (iblockdata.getBlock() instanceof IFluidSource) {
+ // CraftBukkit start
@ -35,13 +30,13 @@
if (fluidtype != FluidTypes.a) {
entityhuman.b(StatisticList.ITEM_USED.b(this));
entityhuman.a(fluidtype.a(TagsFluid.b) ? SoundEffects.ITEM_BUCKET_FILL_LAVA : SoundEffects.ITEM_BUCKET_FILL, 1.0F, 1.0F);
entityhuman.a(fluidtype.a(TagsFluid.LAVA) ? SoundEffects.ITEM_BUCKET_FILL_LAVA : SoundEffects.ITEM_BUCKET_FILL, 1.0F, 1.0F);
- ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b());
+ ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b(), event.getItemStack()); // CraftBukkit
if (!world.isClientSide) {
CriterionTriggers.j.a((EntityPlayer) entityhuman, new ItemStack(fluidtype.b()));
@@ -48,7 +63,7 @@
@@ -46,7 +61,7 @@
iblockdata = world.getType(blockposition);
BlockPosition blockposition1 = this.a(iblockdata, blockposition, movingobjectposition);
@ -85,13 +80,13 @@
+
+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPosition movingobjectposition, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) {
+ // CraftBukkit end
if (!(this.a instanceof FluidTypeFlowing)) {
if (!(this.fluidType instanceof FluidTypeFlowing)) {
return false;
} else {
@@ -103,8 +127,18 @@
boolean flag1 = material.isReplaceable();
if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).a((IBlockAccess) world, blockposition, iblockdata, this.a))) {
if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) {
- return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null);
+ return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null, enumdirection, clicked, itemstack); // CraftBukkit
} else {
@ -105,6 +100,6 @@
+ }
+ }
+ // CraftBukkit end
if (world.worldProvider.isNether() && this.a.a(TagsFluid.a)) {
if (world.worldProvider.isNether() && this.fluidType.a(TagsFluid.WATER)) {
int i = blockposition.getX();
int j = blockposition.getY();

View File

@ -13,7 +13,7 @@
public ItemChorusFruit(int i, float f, Item.Info item_info) {
@@ -19,6 +25,20 @@
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.aa() - 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

@ -21,7 +21,7 @@
itemstack.subtract(1);
}
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.k.nextFloat() * 0.4F + 0.8F));
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.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.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (ItemFireball.k.nextFloat() - ItemFireball.k.nextFloat()) * 0.2F + 1.0F);
world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (ItemFireball.i.nextFloat() - ItemFireball.i.nextFloat()) * 0.2F + 1.0F);
world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition));
}

View File

@ -25,10 +25,10 @@
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
@@ -30,7 +36,7 @@
entityhuman.a(enumhand);
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
} else {
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
+ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
+ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
if (!world.isClientSide) {
EntityFishingHook entityfishinghook = new EntityFishingHook(world, entityhuman);
int j = EnchantmentManager.c(itemstack);
@ -44,7 +44,7 @@
+ entityhuman.hookedFish = null;
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.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.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.k.nextFloat() * 0.4F + 0.8F);
world.a(entityhuman, blockposition, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F);
IBlockData iblockdata = ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition);

View File

@ -3,9 +3,9 @@
@@ -36,7 +36,7 @@
protected void a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (!world.isClientSide && this.l != null && world.random.nextFloat() < this.m) {
- entityhuman.addEffect(new MobEffect(this.l));
+ entityhuman.addEffect(new MobEffect(this.l), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
if (!world.isClientSide && this.k != null && world.random.nextFloat() < this.l) {
- entityhuman.addEffect(new MobEffect(this.k));
+ entityhuman.addEffect(new MobEffect(this.k), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
}
}

View File

@ -10,7 +10,7 @@
itemstack.subtract(1);
}
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.k.nextFloat() * 0.4F + 0.8F));
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.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.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.k.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
+ } else if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }

View File

@ -52,7 +52,7 @@
- private ItemStack(NBTTagCompound nbttagcompound) {
+ // CraftBukkit - break into own method
+ private void load(NBTTagCompound nbttagcompound) {
Item item = (Item) Item.REGISTRY.get(new MinecraftKey(nbttagcompound.getString("id")));
Item item = (Item) IRegistry.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
this.item = item == null ? Items.AIR : item;
this.count = nbttagcompound.getByte("Count");
@ -86,7 +86,7 @@
BlockPosition blockposition = itemactioncontext.getClickPosition();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
@@ -106,12 +146,142 @@
if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().E(), shapedetectorblock)) {
if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().F(), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here

View File

@ -16,7 +16,7 @@
public static ItemStack a(World world, int i, int j, byte b0, boolean flag, boolean flag1) {
ItemStack itemstack = new ItemStack(Items.FILLED_MAP);
- a(itemstack, world, i, j, b0, flag, flag1, world.worldProvider.getDimensionManager().getDimensionID());
- a(itemstack, world, i, j, b0, flag, flag1, world.worldProvider.getDimensionManager());
+ a(itemstack, world, i, j, b0, flag, flag1, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
return itemstack;
}
@ -25,7 +25,7 @@
WorldMap worldmap = a((GeneratorAccess) world, "map_" + e(itemstack));
if (worldmap == null && !world.isClientSide) {
- worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, world.worldProvider.getDimensionManager().getDimensionID());
- worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, world.worldProvider.getDimensionManager());
+ worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
}
@ -38,16 +38,16 @@
+ return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
}
private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, int l) {
- int i1 = world.b("map");
+ World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
+ int i1 = worldMain.b("map"); // CraftBukkit - use primary world for maps
WorldMap worldmap = new WorldMap("map_" + i1);
private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, DimensionManager dimensionmanager) {
- int l = world.a(DimensionManager.OVERWORLD, "map");
+ World worldMain = world.getServer().getServer().getWorldServer(DimensionManager.OVERWORLD); // CraftBukkit - store reference to primary world
+ int l = worldMain.a(DimensionManager.OVERWORLD, "map"); // CraftBukkit - use primary world for maps
WorldMap worldmap = new WorldMap("map_" + l);
worldmap.a(i, j, k, flag, flag1, l);
- world.a(worldmap.getId(), (PersistentBase) worldmap);
+ worldMain.a(worldmap.getId(), (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
itemstack.getOrCreateTag().setInt("map", i1);
worldmap.a(i, j, k, flag, flag1, dimensionmanager);
- world.a(DimensionManager.OVERWORLD, worldmap.getId(), (PersistentBase) worldmap);
+ worldMain.a(DimensionManager.OVERWORLD, worldmap.getId(), (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
itemstack.getOrCreateTag().setInt("map", l);
+
+ // CraftBukkit start
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
@ -58,9 +58,9 @@
@Nullable
public static WorldMap a(GeneratorAccess generatoraccess, String s) {
- return (WorldMap) generatoraccess.a(WorldMap::new, s);
- return (WorldMap) generatoraccess.a(DimensionManager.OVERWORLD, WorldMap::new, s);
+ // CraftBukkit start - use primary world for maps and call event
+ WorldMap worldmap = (WorldMap) MinecraftServer.getServer().worlds.get(0).a((id) -> {
+ WorldMap worldmap = (WorldMap) MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD).a(DimensionManager.OVERWORLD, (id) -> {
+ // We only get here when the data file exists, but is not a valid map
+ WorldMap newMap = new WorldMap(id);
+ MapInitializeEvent event = new MapInitializeEvent(newMap.mapView);
@ -72,7 +72,7 @@
}
public void a(World world, Entity entity, WorldMap worldmap) {
- if (world.worldProvider.getDimensionManager().getDimensionID() == worldmap.map && entity instanceof EntityHuman) {
- if (world.worldProvider.getDimensionManager() == worldmap.map && entity instanceof EntityHuman) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map && entity instanceof EntityHuman) {
int i = 1 << worldmap.scale;
@ -82,7 +82,7 @@
WorldMap worldmap = getSavedMap(itemstack, world);
if (worldmap != null) {
- if (world.worldProvider.getDimensionManager().getDimensionID() == worldmap.map) {
- if (world.worldProvider.getDimensionManager() == worldmap.map) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map) {
int i = 1 << worldmap.scale;

View File

@ -1,34 +0,0 @@
--- a/net/minecraft/server/ItemWrittenBook.java
+++ b/net/minecraft/server/ItemWrittenBook.java
@@ -62,6 +62,23 @@
Object object;
+ // CraftBukkit start
+ // Some commands use the worldserver variable but we leave it full of null values,
+ // so we must temporarily populate it with the world of the commandsender
+ WorldServer[] prev = MinecraftServer.getServer().worldServer;
+ MinecraftServer server = MinecraftServer.getServer();
+ server.worldServer = new WorldServer[server.worlds.size()];
+ server.worldServer[0] = (WorldServer) entityhuman.getWorld();
+ int bpos = 0;
+ for (int pos = 1; pos < server.worldServer.length; pos++) {
+ WorldServer world = server.worlds.get(bpos++);
+ if (server.worldServer[0] == world) {
+ pos--;
+ continue;
+ }
+ server.worldServer[pos] = world;
+ }
+ // CraftBukkit end
try {
IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.b(s);
@@ -69,6 +86,7 @@
} catch (Exception exception) {
object = new ChatComponentText(s);
}
+ finally { MinecraftServer.getServer().worldServer = prev; } // CraftBukkit
nbttaglist.set(i, (NBTBase) (new NBTTagString(IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object))));
}

View File

@ -57,7 +57,7 @@
+ // CraftBukkit end
} else {
this.g = LoginListener.EnumProtocolState.ACCEPTED;
if (this.server.ay() >= 0 && !this.networkManager.isLocal()) {
if (this.server.aw() >= 0 && !this.networkManager.isLocal()) {
@@ -94,9 +117,9 @@
if (entityplayer != null) {
@ -72,7 +72,7 @@
@@ -141,6 +164,43 @@
LoginListener.this.i = LoginListener.this.server.ar().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
LoginListener.this.i = LoginListener.this.server.ap().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!networkManager.isConnected()) {
@ -113,7 +113,7 @@
+ // CraftBukkit end
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.J()) {
} else if (LoginListener.this.server.H()) {
@@ -160,6 +220,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0]));
LoginListener.c.error("Couldn\'t verify username because servers are unavailable");

View File

@ -53,15 +53,15 @@
}
+ // CraftBukkit start - add looting modifier
+ public LootTableInfo.a lootingModifier(int modifier) {
+ public LootTableInfo.Builder lootingModifier(int modifier) {
+ this.lootingMod = modifier;
+ return this;
+ }
+ // CraftBukkit end
+
public LootTableInfo a() {
- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f);
+ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
public LootTableInfo build() {
- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f);
+ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
}
}
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -55,6 +55,13 @@
@@ -59,6 +59,13 @@
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -14,13 +14,12 @@
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
@@ -125,7 +132,22 @@
@@ -129,7 +136,21 @@
private boolean forceUpgrade;
private float ap;
- public MinecraftServer(@Nullable File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
+ // CraftBukkit start
+ public List<WorldServer> worlds = new ArrayList<WorldServer>();
+ public org.bukkit.craftbukkit.CraftServer server;
+ public OptionSet options;
+ public org.bukkit.command.ConsoleCommandSender console;
@ -38,10 +37,10 @@
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
this.ag = new CraftingManager();
@@ -136,22 +158,51 @@
@@ -140,22 +161,51 @@
this.al = new AdvancementDataWorld();
this.am = new CustomFunctionData(this);
this.d = proxy;
this.c = proxy;
- this.commandDispatcher = commanddispatcher;
+ this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit
this.U = yggdrasilauthenticationservice;
@ -49,10 +48,10 @@
this.W = gameprofilerepository;
this.X = usercache;
- this.universe = file;
- this.m = file == null ? null : new ServerConnection(this);
- this.l = file == null ? null : new ServerConnection(this);
- this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer);
+ // this.universe = file; // CraftBukkit
+ this.m = new ServerConnection(this); // CraftBukkit
+ this.l = new ServerConnection(this); // CraftBukkit
+ // this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init
this.dataConverterManager = datafixer;
this.ac.a((IResourcePackListener) this.ah);
@ -94,7 +93,7 @@
public abstract boolean init() throws IOException;
public void convertWorld(String s) {
@@ -176,11 +227,11 @@
@@ -180,11 +230,11 @@
}
if (this.forceUpgrade) {
@ -109,50 +108,57 @@
IChatBaseComponent ichatbasecomponent = null;
while (!worldupgrader.b()) {
@@ -219,9 +270,10 @@
@@ -223,8 +273,9 @@
}
public void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) {
- this.convertWorld(s);
+ // this.convertWorld(s); // CraftBukkit - moved down
this.b((IChatBaseComponent) (new ChatMessage("menu.loadingLevel", new Object[0])));
this.worldServer = new WorldServer[3];
+ /* CraftBukkit start - Remove ticktime arrays and worldsettings
this.f = new long[this.worldServer.length][100];
IDataManager idatamanager = this.convertable.a(s, this);
IDataManager idatamanager = this.getConvertable().a(s, this);
@@ -247,40 +299,116 @@
this.a(this.getWorld(), idatamanager);
@@ -249,54 +300,144 @@
}
this.a(idatamanager.getDirectory(), worlddata);
- PersistentCollection persistentcollection = new PersistentCollection(idatamanager);
+ */
+ int worldCount = 3;
- for (int j = 0; j < this.worldServer.length; ++j) {
- byte b0 = 0;
- this.a(idatamanager, persistentcollection, worlddata, worldsettings);
- this.a(this.getDifficulty());
- this.a(persistentcollection);
- }
+ for (int j = 0; j < worldCount; ++j) {
+ WorldServer world;
+ WorldData worlddata;
+ byte dimension = 0;
if (j == 1) {
- b0 = -1;
+
+ if (j == 1) {
+ if (getAllowNether()) {
+ dimension = -1;
+ } else {
+ continue;
+ }
}
+ }
if (j == 2) {
- b0 = 1;
- protected void a(IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, WorldSettings worldsettings) {
- if (this.L()) {
- this.worldServer.put(DimensionManager.OVERWORLD, (new DemoWorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_());
- } else {
- this.worldServer.put(DimensionManager.OVERWORLD, (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_());
- }
+ if (j == 2) {
+ if (server.getAllowEnd()) {
+ dimension = 1;
+ } else {
+ continue;
+ }
}
+ }
- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD);
+ String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
+ String name = (dimension == 0) ? s : s + "_" + worldType;
+ this.convertWorld(name); // Run conversion now
@ -161,7 +167,7 @@
+ WorldSettings worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype);
+ worldsettings.setGeneratorSettings(jsonelement);
+
if (j == 0) {
+ if (j == 0) {
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, this, this.dataConverterManager);
+ worlddata = idatamanager.getWorldData();
+ if (worlddata == null) {
@ -169,24 +175,34 @@
+ }
+ worlddata.checkName(s1); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ this.a(idatamanager.getDirectory(), worlddata);
if (this.N()) {
- this.worldServer[j] = (WorldServer) (new DemoWorldServer(this, idatamanager, worlddata, b0, this.methodProfiler)).b();
+ world = (WorldServer) (new DemoWorldServer(this, idatamanager, worlddata, dimension, this.methodProfiler)).b();
} else {
- this.worldServer[j] = (WorldServer) (new WorldServer(this, idatamanager, worlddata, b0, this.methodProfiler)).b();
+ world = (WorldServer) (new WorldServer(this, idatamanager, worlddata, dimension, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).b();
}
+ PersistentCollection persistentcollection = new PersistentCollection(idatamanager);
- this.worldServer[j].a(worldsettings);
- worldserver.a(worldsettings);
- worldserver.addIWorldAccess(new WorldManager(this, worldserver));
- if (!this.H()) {
- worldserver.getWorldData().setGameType(this.getGamemode());
- }
+ if (this.L()) {
+ world = (WorldServer) (new DemoWorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_();
+ } else {
+ world = (WorldServer) (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).i_();
+ }
- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).b();
+ world.a(worldsettings);
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
} else {
- this.worldServer[j] = (WorldServer) (new SecondaryWorldServer(this, idatamanager, b0, this.worldServer[0], this.methodProfiler)).b();
+ } else {
+ String dim = "DIM" + dimension;
+
- this.worldServer.put(DimensionManager.NETHER, secondaryworldserver);
- secondaryworldserver.addIWorldAccess(new WorldManager(this, secondaryworldserver));
- if (!this.H()) {
- secondaryworldserver.getWorldData().setGameType(this.getGamemode());
- }
+ File newWorld = new File(new File(name), dim);
+ File oldWorld = new File(new File(s), dim);
+
- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).b();
+ if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) {
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder required ----");
+ MinecraftServer.LOGGER.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
@ -216,7 +232,12 @@
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----");
+ }
+ }
+
- this.worldServer.put(DimensionManager.THE_END, secondaryworldserver1);
- secondaryworldserver1.addIWorldAccess(new WorldManager(this, secondaryworldserver1));
- if (!this.H()) {
- secondaryworldserver1.getWorldData().setGameType(this.getGamemode());
- }
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, this, this.dataConverterManager);
+ // world =, b0 to dimension, s1 to name, added Environment and gen
+ worlddata = idatamanager.getWorldData();
@ -224,35 +245,32 @@
+ worlddata = new WorldData(worldsettings, name);
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
}
- this.worldServer[j].addIWorldAccess(new WorldManager(this, this.worldServer[j]));
+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, DimensionManager.a(dimension), this.getWorldServer(DimensionManager.OVERWORLD), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
+ }
+
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
+
+ world.addIWorldAccess(new WorldManager(this, world));
if (!this.J()) {
- this.worldServer[j].getWorldData().setGameType(this.getGamemode());
+ if (!this.H()) {
+ world.getWorldData().setGameType(this.getGamemode());
}
- }
- this.s.setPlayerFileData(this.worldServer);
- if (worlddata.P() != null) {
- this.aR().a(worlddata.P());
+ worlds.add(world);
+ getPlayerList().setPlayerFileData(worlds.toArray(new WorldServer[worlds.size()]));
+ }
+
+ this.worldServer.put(world.dimension, world);
+ this.getPlayerList().setPlayerFileData(world);
- this.getPlayerList().setPlayerFileData(worldserver);
- if (worlddata.P() != null) {
- this.aP().a(worlddata.P());
+ if (worlddata.P() != null) {
+ this.aR().a(worlddata.P());
+ this.aP().a(worlddata.P());
+ }
}
+ this.s.setPlayerFileData(this.worldServer);
+ this.a(this.getDifficulty());
+ this.a(this.getWorldServer(DimensionManager.OVERWORLD).worldMaps);
+ // CraftBukkit end
this.a(this.getDifficulty());
this.g_();
@@ -289,6 +417,25 @@
}
protected void a(File file, WorldData worlddata) {
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
@ -278,12 +296,13 @@
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
this.resourcePackRepository.a();
ArrayList arraylist = Lists.newArrayList();
@@ -319,41 +466,52 @@
this.b((IChatBaseComponent) (new ChatMessage("menu.generatingTerrain", new Object[0])));
boolean flag5 = false;
@@ -325,42 +466,52 @@
boolean flag4 = true;
- MinecraftServer.LOGGER.info("Preparing start region for level 0");
- WorldServer worldserver = this.worldServer[0];
this.b((IChatBaseComponent) (new ChatMessage("menu.generatingTerrain", new Object[0])));
- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD);
- MinecraftServer.LOGGER.info("Preparing start region for dimension " + DimensionManager.a(worldserver.worldProvider.getDimensionManager()));
- BlockPosition blockposition = worldserver.getSpawn();
- ArrayList arraylist = Lists.newArrayList();
- Set set = Sets.newConcurrentHashSet();
@ -293,9 +312,8 @@
- for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
- for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
- arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
+ for (int m = 0; m < worlds.size(); m++) {
+ WorldServer worldserver = this.worlds.get(m);
+ MinecraftServer.LOGGER.info("Preparing start region for level " + m + " (Seed: " + worldserver.getSeed() + ")");
+ for (WorldServer worldserver : this.getWorlds()) {
+ MinecraftServer.LOGGER.info("Preparing start region for level " + worldserver.dimension + " (Seed: " + worldserver.getSeed() + ")");
+ if (!worldserver.getWorld().getKeepSpawnInMemory()) {
+ continue;
}
@ -306,6 +324,11 @@
+ BlockPosition blockposition = worldserver.getSpawn();
+ ArrayList arraylist = Lists.newArrayList();
+ Set set = Sets.newConcurrentHashSet();
+
+ for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
+ for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
+ arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
+ }
- while (!completablefuture.isDone()) {
- try {
@ -316,18 +339,10 @@
- if (executionexception.getCause() instanceof RuntimeException) {
- throw (RuntimeException) executionexception.getCause();
- }
+ for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
+ for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
+ arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
+ }
+
+ CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> {
+ set.add(chunk.getPos());
+ });
- throw new RuntimeException(executionexception.getCause());
- } catch (TimeoutException timeoutexception) {
- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
+
+ while (!completablefuture.isDone()) {
+ try {
+ completablefuture.get(1L, TimeUnit.SECONDS);
@ -337,7 +352,10 @@
+ if (executionexception.getCause() instanceof RuntimeException) {
+ throw (RuntimeException) executionexception.getCause();
+ }
+
- throw new RuntimeException(executionexception.getCause());
- } catch (TimeoutException timeoutexception) {
- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
+ throw new RuntimeException(executionexception.getCause());
+ } catch (TimeoutException timeoutexception) {
+ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
@ -350,34 +368,22 @@
+ }
}
+ for (WorldServer world : this.worlds) {
+ for (WorldServer world : this.getWorlds()) {
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld()));
+ }
+ // CraftBukkit end
this.m();
MinecraftServer.LOGGER.info("Time elapsed: {} ms", Long.valueOf(stopwatch.elapsed(TimeUnit.MILLISECONDS)));
}
@@ -392,14 +550,17 @@
protected void m() {
Iterator iterator = DimensionManager.b().iterator();
@@ -419,6 +570,7 @@
protected void l() {
this.w = null;
this.x = 0;
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit
}
protected void saveChunks(boolean flag) {
WorldServer[] aworldserver = this.worldServer;
int i = aworldserver.length;
- for (int j = 0; j < i; ++j) {
- WorldServer worldserver = aworldserver[j];
+ // CraftBukkit start
+ for (int j = 0; j < worlds.size(); ++j) {
+ WorldServer worldserver = worlds.get(j);
+ // CraftBukkit end
if (worldserver != null) {
if (!flag) {
@@ -416,8 +577,24 @@
@@ -442,8 +594,24 @@
}
@ -403,41 +409,15 @@
if (this.getServerConnection() != null) {
this.getServerConnection().b();
}
@@ -426,6 +603,7 @@
@@ -452,6 +620,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.s.savePlayers();
this.s.u();
+ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
if (this.worldServer != null) {
@@ -436,8 +614,10 @@
int j;
WorldServer worldserver;
- for (j = 0; j < i; ++j) {
- worldserver = aworldserver[j];
+ // CraftBukkit start
+ for (j = 0; j < worlds.size(); ++j) {
+ worldserver = worlds.get(j);
+ // CraftBukkit end
if (worldserver != null) {
worldserver.savingDisabled = false;
}
@@ -447,8 +627,10 @@
aworldserver = this.worldServer;
i = aworldserver.length;
- for (j = 0; j < i; ++j) {
- worldserver = aworldserver[j];
+ // CraftBukkit start
+ for (j = 0; j < worlds.size(); ++j) {
+ worldserver = worlds.get(j);
+ // CraftBukkit end
if (worldserver != null) {
worldserver.close();
}
@@ -491,11 +673,13 @@
MinecraftServer.LOGGER.info("Saving worlds");
@@ -516,11 +685,13 @@
if (i > 2000L && this.aa - this.Q >= 15000L) {
long j = i / 50L;
@ -448,10 +428,10 @@
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
this.v();
this.a(this::aT);
this.aa += 50L;
@@ -534,6 +718,12 @@
@@ -559,6 +730,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@ -461,11 +441,11 @@
+ } catch (Exception ignored) {
+ }
+ // CraftBukkit end
this.u();
this.t();
}
@@ -602,7 +792,7 @@
this.n.b().a(agameprofile);
@@ -627,7 +804,7 @@
this.m.b().a(agameprofile);
}
- if (this.ticks % 900 == 0) {
@ -473,18 +453,19 @@
this.methodProfiler.a("save");
this.s.savePlayers();
this.saveChunks(true);
@@ -628,6 +818,7 @@
@@ -653,6 +830,7 @@
}
public void w() {
public void b(BooleanSupplier booleansupplier) {
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
this.methodProfiler.a("jobs");
FutureTask futuretask;
@@ -640,22 +831,40 @@
@@ -665,23 +843,40 @@
this.getFunctionData().Y_();
this.methodProfiler.c("levels");
- WorldServer worldserver;
+ // CraftBukkit start
+ // Run tasks that are waiting on processing
+ while (!processQueue.isEmpty()) {
@ -501,41 +482,34 @@
+ }
+ }
+
int i;
- for (i = 0; i < this.worldServer.length; ++i) {
+ for (i = 0; i < this.worlds.size(); ++i) { // CraftBukkit
long j = SystemUtils.c();
- if (i == 0 || this.getAllowNether()) {
- WorldServer worldserver = this.worldServer[i];
+ if (true || i == 0 || this.getAllowNether()) { // CraftBukkit
+ WorldServer worldserver = this.worlds.get(i);
+ // WorldServer worldserver; // CraftBukkit - dropped down
long i;
- for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();((long[]) this.e.computeIfAbsent(worldserver.worldProvider.getDimensionManager(), (dimensionmanager) -> {
- return new long[100];
- }))[this.ticks % 100] = SystemUtils.c() - i) {
- worldserver = (WorldServer) iterator.next();
+ // CraftBukkit - dropTickTime
+ for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
+ WorldServer worldserver = (WorldServer) iterator.next();
i = SystemUtils.c();
- if (worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) {
+ if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> {
return worldserver.getWorldData().getName();
});
+ /* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
this.s.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager().getDimensionID());
this.s.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager());
this.methodProfiler.e();
}
+ // CraftBukkit end */
this.methodProfiler.a("tick");
@@ -684,7 +893,7 @@
this.methodProfiler.e();
}
- this.f[i][this.ticks % 100] = SystemUtils.c() - j;
+ // this.f[i][this.ticks % 100] = SystemUtils.c() - j; // CraftBukkit
}
this.methodProfiler.c("connection");
@@ -708,10 +917,11 @@
this.l.add(itickable);
@@ -732,10 +927,11 @@
this.k.add(itickable);
}
- public static void main(String[] astring) {
@ -547,7 +521,7 @@
boolean flag = true;
String s = null;
String s1 = ".";
@@ -759,13 +969,16 @@
@@ -783,13 +979,16 @@
++j;
}
}
@ -565,7 +539,7 @@
if (s != null) {
dedicatedserver.h(s);
}
@@ -803,6 +1016,29 @@
@@ -827,6 +1026,29 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
@ -595,10 +569,10 @@
} catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
}
@@ -814,11 +1050,13 @@
@@ -838,11 +1060,13 @@
}
public void y() {
public void v() {
+ /* CraftBukkit start - prevent abuse
this.serverThread = new Thread(this, "Server thread");
this.serverThread.setUncaughtExceptionHandler((thread, throwable) -> {
@ -609,28 +583,7 @@
}
public File c(String s) {
@@ -834,11 +1072,18 @@
}
public WorldServer getWorldServer(int i) {
- return i == -1 ? this.worldServer[1] : (i == 1 ? this.worldServer[2] : this.worldServer[0]);
+ // CraftBukkit start
+ for (WorldServer world : worlds) {
+ if (world.dimension == i) {
+ return world;
+ }
+ }
+ return worlds.get(0);
+ // CraftBukkit end
}
public WorldServer a(DimensionManager dimensionmanager) {
- return dimensionmanager == DimensionManager.NETHER ? this.worldServer[1] : (dimensionmanager == DimensionManager.THE_END ? this.worldServer[2] : this.worldServer[0]);
+ return dimensionmanager == DimensionManager.NETHER ? this.worlds.get(1) : (dimensionmanager == DimensionManager.THE_END ? this.worlds.get(2) : this.worlds.get(0)); // CraftBukkit
}
public String getVersion() {
@@ -858,7 +1103,7 @@
@@ -882,7 +1106,7 @@
}
public boolean isDebugging() {
@ -639,7 +592,7 @@
}
public void f(String s) {
@@ -873,7 +1118,7 @@
@@ -897,7 +1121,7 @@
}
public String getServerModName() {
@ -648,52 +601,17 @@
}
public CrashReport b(CrashReport crashreport) {
@@ -909,7 +1154,7 @@
@@ -933,7 +1157,7 @@
}
public boolean F() {
public boolean D() {
- return this.universe != null;
+ return true; // CraftBukkit
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@@ -953,11 +1198,13 @@
}
public void a(EnumDifficulty enumdifficulty) {
- WorldServer[] aworldserver = this.worldServer;
- int i = aworldserver.length;
+ // CraftBukkit start
+ // WorldServer[] aworldserver = this.worldServer;
+ int i = this.worlds.size();
for (int j = 0; j < i; ++j) {
- WorldServer worldserver = aworldserver[j];
+ WorldServer worldserver = this.worlds.get(j);
+ // CraftBukkit end
if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) {
@@ -1024,13 +1271,11 @@
int i = 0;
if (this.worldServer != null) {
- WorldServer[] aworldserver = this.worldServer;
- int j = aworldserver.length;
-
- for (int k = 0; k < j; ++k) {
- WorldServer worldserver = aworldserver[k];
-
+ // CraftBukkit start
+ for (int j = 0; j < this.worlds.size(); ++j) {
+ WorldServer worldserver = this.worlds.get(j);
if (worldserver != null) {
+ // CraftBukkit end
WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID()));
@@ -1056,7 +1301,7 @@
public abstract boolean S();
@@ -1073,7 +1297,7 @@
public abstract boolean Q();
public boolean getOnlineMode() {
- return this.onlineMode;
@ -701,24 +619,7 @@
}
public void setOnlineMode(boolean flag) {
@@ -1138,13 +1383,9 @@
public abstract boolean af();
public void setGamemode(EnumGamemode enumgamemode) {
- WorldServer[] aworldserver = this.worldServer;
- int i = aworldserver.length;
-
- for (int j = 0; j < i; ++j) {
- WorldServer worldserver = aworldserver[j];
-
- worldserver.getWorldData().setGameType(enumgamemode);
+ // CraftBukkit start
+ for (int i = 0; i < this.worlds.size(); ++i) {
+ worlds.get(i).getWorldData().setGameType(enumgamemode);
}
}
@@ -1217,7 +1458,7 @@
@@ -1233,7 +1457,7 @@
public <V> ListenableFuture<V> a(Callable<V> callable) {
Validate.notNull(callable);
@ -726,17 +627,8 @@
+ if (!this.isMainThread()) { // CraftBukkit && !this.isStopped()) {
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
this.g.add(listenablefuturetask);
@@ -1274,7 +1515,7 @@
} else {
this.getPlayerList().savePlayers();
this.resourcePackRepository.a();
- this.a(this.worldServer[0].getWorldData());
+ this.a(this.worlds.get(0).getWorldData()); // CraftBukkit
this.getPlayerList().reload();
}
}
@@ -1288,8 +1529,8 @@
this.f.add(listenablefuturetask);
@@ -1304,8 +1528,8 @@
if (!worlddata.N().contains(resourcepackloader.e()) && !arraylist.contains(resourcepackloader)) {
MinecraftServer.LOGGER.info("Found new data pack {}, loading it automatically", resourcepackloader.e());
@ -747,7 +639,7 @@
}, false);
}
}
@@ -1298,7 +1539,7 @@
@@ -1314,7 +1538,7 @@
ArrayList arraylist1 = Lists.newArrayList();
this.resourcePackRepository.d().forEach((resourcepackloader) -> {
@ -756,25 +648,7 @@
});
this.ac.a((List) arraylist1);
worlddata.O().clear();
@@ -1348,7 +1589,7 @@
}
public CommandListenerWrapper getServerCommandListener() {
- return new CommandListenerWrapper(this, this.worldServer[0] == null ? Vec3D.a : new Vec3D(this.worldServer[0].getSpawn()), Vec2F.a, this.worldServer[0], 4, "Server", new ChatComponentText("Server"), this, (Entity) null);
+ return new CommandListenerWrapper(this, this.worlds.isEmpty() ? Vec3D.a : new Vec3D(this.worlds.get(0).getSpawn()), Vec2F.a, this.worlds.isEmpty() ? null : this.worlds.get(0), 4, "Server", new ChatComponentText("Server"), this, (Entity) null); // CraftBukkit
}
public boolean a() {
@@ -1376,7 +1617,7 @@
}
public GameRules aQ() {
- return this.worldServer[0].getGameRules();
+ return this.worlds.get(0).getGameRules(); // CraftBukkit
}
public BossBattleCustomData aR() {
@@ -1400,4 +1641,11 @@
@@ -1416,4 +1640,11 @@
return 0;
}
}

View File

@ -11,17 +11,17 @@
+
public class MobEffectList {
public static final RegistryMaterials<MinecraftKey, MobEffectList> REGISTRY = new RegistryMaterials();
@@ -26,7 +31,7 @@
private final Map<IAttribute, AttributeModifier> a = Maps.newHashMap();
@@ -25,7 +30,7 @@
}
public static int getId(MobEffectList mobeffectlist) {
- return MobEffectList.REGISTRY.a((Object) mobeffectlist);
+ return MobEffectList.REGISTRY.a(mobeffectlist); // CraftBukkit - decompile error
- return IRegistry.MOB_EFFECT.a((Object) mobeffectlist);
+ return IRegistry.MOB_EFFECT.a(mobeffectlist); // CraftBukkit - decompile error
}
protected MobEffectList(boolean flag, int i) {
@@ -48,11 +53,11 @@
@@ -47,11 +52,11 @@
public void tick(EntityLiving entityliving, int i) {
if (this == MobEffects.REGENERATION) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
@ -35,7 +35,7 @@
}
} else if (this == MobEffects.WITHER) {
entityliving.damageEntity(DamageSource.WITHER, 1.0F);
@@ -60,14 +65,25 @@
@@ -59,14 +64,25 @@
((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1));
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
if (!entityliving.world.isClientSide) {
@ -63,7 +63,7 @@
}
}
@@ -88,7 +104,7 @@
@@ -87,7 +103,7 @@
}
} else {
j = (int) (d0 * (double) (4 << i) + 0.5D);
@ -72,12 +72,12 @@
}
}
@@ -217,6 +233,11 @@
@@ -216,6 +232,11 @@
a(28, "slow_falling", (new MobEffectList(false, 16773073)).b(8, 0).l());
a(29, "conduit_power", (new MobEffectList(false, 1950417)).b(9, 0).l());
a(30, "dolphins_grace", (new MobEffectList(false, 8954814)).b(10, 0).l());
+ // CraftBukkit start
+ for (Object effect : REGISTRY) {
+ for (Object effect : IRegistry.MOB_EFFECT) {
+ org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType((MobEffectList) effect));
+ }
+ // CraftBukkit end

View File

@ -3,7 +3,7 @@
@@ -41,6 +41,7 @@
public void setMobName(EntityTypes<?> entitytypes) {
this.spawnData.b().setString("id", ((MinecraftKey) EntityTypes.REGISTRY.b(entitytypes)).toString());
this.spawnData.b().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
+ this.mobs.clear(); // CraftBukkit - SPIGOT-3496, MC-92282
}

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