Update to Minecraft 1.9.2

This commit is contained in:
Thinkofname 2016-03-30 20:50:59 +01:00
parent 7fc5cd856e
commit 6e527e5b88
30 changed files with 126 additions and 182 deletions

View file

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

View file

@ -23,11 +23,3 @@
}
}
@@ -117,6 +131,6 @@
public int a() {
int i = this.b.b();
- return 1 + this.c.a() + PacketDataSerializer.a(i) + i * 8;
+ return 1 + this.c.a() + PacketDataSerializer.a(i) + this.b.a().length * 8; // CraftBukkit - Backport fix, remove on update
}
}

View file

@ -105,7 +105,7 @@
+
thread.setDaemon(true);
thread.start();
DedicatedServer.LOGGER.info("Starting minecraft server version 1.9");
DedicatedServer.LOGGER.info("Starting minecraft server version 1.9.2");
@@ -77,7 +123,7 @@
}

View file

@ -121,7 +121,7 @@
return itemstack;
}
@@ -147,13 +213,44 @@
@@ -147,8 +213,38 @@
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
@ -162,13 +162,7 @@
return itemstack;
}
protected void a(ISourceBlock isourceblock) {
isourceblock.getWorld().triggerEffect(1018, isourceblock.getBlockPosition(), 0);
+
}
});
BlockDispenser.REGISTRY.a(Items.aG, new DispenserRegistry.a(EntityBoat.EnumBoatType.OAK));
@@ -169,9 +266,48 @@
@@ -169,9 +265,48 @@
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
@ -219,7 +213,7 @@
return itemstack;
} else {
return this.b.a(isourceblock, itemstack);
@@ -202,6 +338,30 @@
@@ -202,6 +337,30 @@
item = Items.LAVA_BUCKET;
}
@ -250,7 +244,7 @@
world.setAir(blockposition);
if (--itemstack.count == 0) {
itemstack.setItem(item);
@@ -220,11 +380,39 @@
@@ -220,11 +379,39 @@
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
@ -293,7 +287,7 @@
} else if (world.getType(blockposition).getBlock() == Blocks.TNT) {
Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
world.setAir(blockposition);
@@ -252,6 +440,30 @@
@@ -252,6 +439,30 @@
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
@ -324,7 +318,7 @@
if (ItemDye.a(itemstack, world, blockposition)) {
if (!world.isClientSide) {
world.triggerEffect(2005, blockposition, 0);
@@ -279,11 +491,40 @@
@@ -279,11 +490,40 @@
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
@ -361,13 +355,13 @@
+ // CraftBukkit end
world.addEntity(entitytntprimed);
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gk, SoundCategory.BLOCKS, 1.0F, 1.0F);
- --itemstack.count;
+ // --itemstack.count; // CraftBukkit - handled above
return itemstack;
}
});
@@ -437,12 +678,40 @@
@@ -437,12 +677,40 @@
d3 = 0.0D;
}

View file

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

View file

@ -49,7 +49,7 @@
public void m() {
super.m();
if (this.lifeTicks == 2) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dh, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.di, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
+ // CraftBukkit start - Use relative location for far away sounds
+ // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dc, SoundCategory.d, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
+ float pitch = 0.8F + this.random.nextFloat() * 0.2F;
@ -62,13 +62,13 @@
+ double deltaLength = Math.sqrt(distanceSquared);
+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dh, SoundCategory.WEATHER, relativeX, this.locY, relativeZ, 10000.0F, pitch));
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.di, SoundCategory.WEATHER, relativeX, this.locY, relativeZ, 10000.0F, pitch));
+ } else {
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.dh, SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 10000.0F, pitch));
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.di, SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 10000.0F, pitch));
+ }
+ }
+ // CraftBukkit end
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dg, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dh, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
}
@@ -57,13 +86,17 @@

View file

@ -47,7 +47,7 @@
this.i = true;
this.aL = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.setPosition(this.locX, this.locY, this.locZ);
@@ -125,7 +149,13 @@
@@ -126,7 +150,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -62,7 +62,7 @@
}
}
@@ -183,7 +213,11 @@
@@ -188,7 +218,11 @@
this.stopRiding();
}
} else {
@ -75,7 +75,7 @@
}
if (!this.world.isClientSide) {
@@ -240,6 +274,18 @@
@@ -245,6 +279,18 @@
this.world.methodProfiler.b();
}
@ -94,7 +94,7 @@
protected void b(BlockPosition blockposition) {
int i = EnchantmentManager.a(Enchantments.j, this);
@@ -255,19 +301,19 @@
@@ -260,19 +306,19 @@
protected void bC() {
++this.deathTicks;
@ -123,7 +123,7 @@
this.die();
@@ -421,6 +467,17 @@
@@ -426,6 +472,17 @@
}
}
@ -141,7 +141,7 @@
if (nbttagcompound.hasKeyOfType("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -436,9 +493,15 @@
@@ -441,9 +498,15 @@
}
@ -157,7 +157,7 @@
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist);
@@ -452,6 +515,16 @@
@@ -457,6 +520,16 @@
this.a(mobeffect, false);
}
}
@ -174,7 +174,7 @@
if (this.updateEffects) {
if (!this.world.isClientSide) {
@@ -548,6 +621,12 @@
@@ -553,6 +626,12 @@
}
public void addEffect(MobEffect mobeffect) {
@ -187,7 +187,7 @@
if (this.d(mobeffect)) {
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
@@ -579,6 +658,12 @@
@@ -584,6 +663,12 @@
}
public MobEffect c(MobEffectList mobeffectlist) {
@ -200,7 +200,7 @@
return (MobEffect) this.effects.remove(mobeffectlist);
}
@@ -618,20 +703,52 @@
@@ -623,20 +708,52 @@
}
@ -254,7 +254,7 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
@@ -647,14 +764,16 @@
@@ -652,14 +769,16 @@
} else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
} else {
@ -273,7 +273,7 @@
this.k(f);
if (damagesource.a()) {
f = 0.0F;
@@ -673,19 +792,38 @@
@@ -678,19 +797,38 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
@ -314,7 +314,7 @@
this.az = 0.0F;
Entity entity = damagesource.getEntity();
@@ -825,6 +963,12 @@
@@ -830,6 +968,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@ -327,7 +327,7 @@
}
}
@@ -912,8 +1056,13 @@
@@ -917,8 +1061,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@ -342,21 +342,18 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
@@ -940,20 +1089,20 @@
@@ -945,8 +1094,8 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
- this.damageArmor(f);
- f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.h).getValue());
+ // this.damageArmor(f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
f = CombatMath.a(f, (float) this.getArmorStrength());
+ f = CombatMath.a(f, (float) this.getArmorStrength());
}
return f;
}
-
protected float applyMagicModifier(DamageSource damagesource, float f) {
if (damagesource.isStarvation()) {
return f;
@@ -958,7 +1107,8 @@
} else {
int i;
@ -366,7 +363,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -974,22 +1123,127 @@
@@ -979,22 +1129,127 @@
}
}
@ -504,7 +501,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1055,6 +1309,7 @@
@@ -1060,6 +1315,7 @@
public AttributeMapBase getAttributeMap() {
if (this.bp == null) {
this.bp = new AttributeMapServer();
@ -512,7 +509,7 @@
}
return this.bp;
@@ -1329,6 +1584,7 @@
@@ -1334,6 +1590,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -520,7 +517,7 @@
this.setFlag(7, false);
}
} else {
@@ -1689,6 +1945,7 @@
@@ -1694,6 +1951,7 @@
}
if (!this.world.isClientSide) {
@ -528,7 +525,7 @@
this.setFlag(7, flag);
}
@@ -1702,6 +1959,13 @@
@@ -1707,6 +1965,13 @@
if (!list.isEmpty()) {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
@ -542,7 +539,7 @@
this.C(entity);
}
@@ -1777,11 +2041,11 @@
@@ -1782,11 +2047,11 @@
}
public boolean isInteractable() {
@ -556,7 +553,7 @@
}
protected void ao() {
@@ -1918,7 +2182,22 @@
@@ -1923,7 +2188,22 @@
protected void v() {
if (this.bm != null && this.cs()) {
this.a(this.bm, 16);

View file

@ -53,7 +53,7 @@
public EntityMinecartContainer(World world) {
super(world);
}
@@ -75,7 +112,7 @@
@@ -71,7 +108,7 @@
}
public int getMaxStackSize() {

View file

@ -26,7 +26,7 @@
+ // CraftBukkit end */
protected MinecraftKey J() {
return LootTables.J;
return LootTables.K;
@@ -122,7 +126,8 @@
}

View file

@ -49,7 +49,7 @@
}
@@ -212,11 +222,30 @@
@@ -219,11 +229,30 @@
}
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, (EntityLiving) this) > 0 || this.getSkeletonType() == 1) {
@ -76,7 +76,7 @@
}
+ // CraftBukkit end
this.a(SoundEffects.fn, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
this.a(SoundEffects.fo, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
- this.world.addEntity(entitytippedarrow);
+ // this.world.addEntity(entitytippedarrow); // CraftBukkit - moved up
}

View file

@ -18,7 +18,7 @@
private final MinecraftServer a;
private final NetworkManager b;
@@ -11,12 +21,48 @@
@@ -11,21 +21,58 @@
}
public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {
@ -28,7 +28,6 @@
this.b.setProtocol(EnumProtocol.LOGIN);
ChatComponentText chatcomponenttext;
- if (packethandshakinginsetprotocol.b() > 107) {
+ // CraftBukkit start - Connection throttle
+ try {
+ long currentTime = System.currentTimeMillis();
@ -64,11 +63,14 @@
+ }
+ // CraftBukkit end
+
+ if (packethandshakinginsetprotocol.b() > 109) {
chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9");
if (packethandshakinginsetprotocol.b() > 109) {
chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9.2");
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
@@ -26,6 +72,7 @@
- } else if (packethandshakinginsetprotocol.b() < 109) {
+ } else if (packethandshakinginsetprotocol.b() < 107) {
chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.9.2");
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
} else {
this.b.setPacketListener(new LoginListener(this.a, this.b));

View file

@ -11,8 +11,8 @@
+
public class ItemArmor extends Item {
private static final int[] m = new int[] { 13, 15, 16, 11};
@@ -35,7 +40,33 @@
private static final int[] n = new int[] { 13, 15, 16, 11};
@@ -36,7 +41,33 @@
} else {
EntityLiving entityliving = (EntityLiving) list.get(0);
EnumItemSlot enumitemslot = EntityInsentient.d(itemstack);
@ -47,7 +47,7 @@
itemstack1.count = 1;
entityliving.setSlot(enumitemslot, itemstack1);
@@ -43,7 +74,7 @@
@@ -44,7 +75,7 @@
((EntityInsentient) entityliving).a(enumitemslot, 2.0F);
}

View file

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

View file

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

View file

@ -21,7 +21,7 @@
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
+ // CraftBukkit end
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.H, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.H, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F));
if (!world.isClientSide) {
- world.addEntity(new EntityFishingHook(world, entityhuman));
+ world.addEntity(hook); // CraftBukkit - moved creation up

View file

@ -29,7 +29,7 @@
+
+ CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ // CraftBukkit end
world.a(entityhuman, blockposition, SoundEffects.bw, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F);
world.a(entityhuman, blockposition, SoundEffects.bx, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.j.nextFloat() * 0.4F + 0.8F);
world.setTypeAndData(blockposition, Blocks.FIRE.getBlockData(), 11);
+
+ // CraftBukkit start

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ItemSnowball.java
+++ b/net/minecraft/server/ItemSnowball.java
@@ -8,17 +8,27 @@
@@ -8,17 +8,28 @@
}
public InteractionResultWrapper<ItemStack> a(ItemStack itemstack, World world, EntityHuman entityhuman, EnumHand enumhand) {
@ -10,8 +10,8 @@
--itemstack.count;
}
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.fG, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.fG, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));*/
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.fH, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
+ */
if (!world.isClientSide) {
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
@ -22,7 +22,7 @@
+ --itemstack.count;
+ }
+
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.fG, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.fH, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.j.nextFloat() * 0.4F + 0.8F));
+ } else if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }

View file

@ -72,10 +72,14 @@
}
}
@@ -205,5 +221,10 @@
@@ -203,7 +219,12 @@
MobEffectList.REGISTRY.a(23, new MinecraftKey("saturation"), (new InstantMobEffect(false, 16262179)).c("effect.saturation").j());
MobEffectList.REGISTRY.a(24, new MinecraftKey("glowing"), (new MobEffectList(false, 9740385)).c("effect.glowing").b(4, 2));
MobEffectList.REGISTRY.a(25, new MinecraftKey("levitation"), (new MobEffectList(true, 13565951)).c("effect.levitation").b(3, 2));
MobEffectList.REGISTRY.a(26, new MinecraftKey("luck"), (new MobEffectList(false, 3381504)).c("effect.luck").b(5, 2).j().a(GenericAttributes.h, "03C3C89D-7037-4B42-869F-B146BCB64D2E", 1.0D, 0));
MobEffectList.REGISTRY.a(27, new MinecraftKey("unluck"), (new MobEffectList(true, 12624973)).c("effect.unluck").b(6, 2).a(GenericAttributes.h, "CC5AF142-2BD2-4215-B636-2605AED11727", -1.0D, 0));
- MobEffectList.REGISTRY.a(26, new MinecraftKey("luck"), (new MobEffectList(false, 3381504)).c("effect.luck").b(5, 2).j().a(GenericAttributes.i, "03C3C89D-7037-4B42-869F-B146BCB64D2E", 1.0D, 0));
- MobEffectList.REGISTRY.a(27, new MinecraftKey("unluck"), (new MobEffectList(true, 12624973)).c("effect.unluck").b(6, 2).a(GenericAttributes.i, "CC5AF142-2BD2-4215-B636-2605AED11727", -1.0D, 0));
+ MobEffectList.REGISTRY.a(26, new MinecraftKey("luck"), (new MobEffectList(false, 3381504)).c("effect.luck").b(5, 2).j().a(GenericAttributes.h, "03C3C89D-7037-4B42-869F-B146BCB64D2E", 1.0D, 0));
+ MobEffectList.REGISTRY.a(27, new MinecraftKey("unluck"), (new MobEffectList(true, 12624973)).c("effect.unluck").b(6, 2).a(GenericAttributes.h, "CC5AF142-2BD2-4215-B636-2605AED11727", -1.0D, 0));
+ // CraftBukkit start
+ for (MobEffectList effect : REGISTRY) {
+ org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType(effect));

View file

@ -13,25 +13,7 @@
public PacketDataSerializer(ByteBuf bytebuf) {
this.a = bytebuf;
@@ -44,8 +47,16 @@
return this;
}
+ // CraftBukkit start - limit length
public byte[] a() {
- byte[] abyte = new byte[this.g()];
+ return readByteArray(Short.MAX_VALUE);
+ }
+
+ public byte[] readByteArray(int limit) {
+ int len = this.g();
+ if (len > limit) throw new DecoderException("The received a byte array longer than allowed " + len + " > " + limit);
+ byte[] abyte = new byte[len];
+ // CraftBukkit end
this.readBytes(abyte);
return abyte;
@@ -99,7 +110,7 @@
@@ -119,7 +122,7 @@
}
public <T extends Enum<T>> T a(Class<T> oclass) {
@ -40,7 +22,7 @@
}
public PacketDataSerializer a(Enum<?> oenum) {
@@ -176,7 +187,7 @@
@@ -196,7 +199,7 @@
} else {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@ -49,7 +31,7 @@
throw new EncoderException(ioexception);
}
}
@@ -202,7 +213,7 @@
@@ -222,7 +225,7 @@
}
public PacketDataSerializer a(ItemStack itemstack) {
@ -58,7 +40,7 @@
this.writeShort(-1);
} else {
this.writeShort(Item.getId(itemstack.getItem()));
@@ -230,6 +241,11 @@
@@ -250,6 +253,11 @@
itemstack = new ItemStack(Item.getById(short0), b0, short1);
itemstack.setTag(this.j());

View file

@ -14,7 +14,7 @@
PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf);
+ packetdataserializer.version = version; // CraftBukkit
packetdataserializer.b(integer.intValue());
packetdataserializer.d(integer.intValue());
@@ -42,7 +44,7 @@
}

View file

@ -1,15 +0,0 @@
--- a/net/minecraft/server/PacketLoginInEncryptionBegin.java
+++ b/net/minecraft/server/PacketLoginInEncryptionBegin.java
@@ -12,8 +12,10 @@
public PacketLoginInEncryptionBegin() {}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
- this.a = packetdataserializer.a();
- this.b = packetdataserializer.a();
+ // CraftBukkit start - limit length
+ this.a = packetdataserializer.readByteArray(256);
+ this.b = packetdataserializer.readByteArray(256);
+ // CraftBukkit end
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {

View file

@ -4,7 +4,7 @@
}
packetdataserializer.writeByte(i);
- packetdataserializer.writeByte(this.d);
- packetdataserializer.writeInt(this.d);
+ // CraftBukkit start
+ if (packetdataserializer.version < 108) {
+ packetdataserializer.writeByte(this.d);

View file

@ -109,8 +109,8 @@
+ int version = minecraftServer.getServerPing().getServerData().getProtocolVersion();
+ if (this.networkManager.channel.pipeline().get(PacketEncoder.class).version == 108) {
+ version = 108;
+ } else if (this.networkManager.channel.pipeline().get(PacketEncoder.class).version == 109) {
+ version = 109;
+ } else if (this.networkManager.channel.pipeline().get(PacketEncoder.class).version == 107) {
+ version = 107;
+ }
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
+

View file

@ -100,8 +100,8 @@
this.world.applyPhysics(this.position, this.getBlock());
this.world.applyPhysics(this.position.down(), this.getBlock());
}
@@ -371,6 +426,13 @@
this.n = i;
@@ -366,6 +421,13 @@
}
+ // CraftBukkit start

View file

@ -11,7 +11,7 @@
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class TileEntityDispenser extends TileEntityContainer implements IInventory {
public class TileEntityDispenser extends TileEntityLootable implements IInventory {
private static final Random f = new Random();
private ItemStack[] items = new ItemStack[9];
@ -45,7 +45,7 @@
public TileEntityDispenser() {}
public int getSize() {
@@ -38,6 +70,7 @@
@@ -42,6 +74,7 @@
for (int k = 0; k < this.items.length; ++k) {
if (this.items[k] != null && TileEntityDispenser.f.nextInt(j++) == 0) {
@ -53,7 +53,7 @@
i = k;
}
}
@@ -120,7 +153,7 @@
@@ -130,7 +163,7 @@
}
public int getMaxStackSize() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldGenRegistration.java
+++ b/net/minecraft/server/WorldGenRegistration.java
@@ -160,7 +160,7 @@
@@ -158,7 +158,7 @@
entitywitch.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
entitywitch.prepare(world.D(new BlockPosition(i, j, k)), (GroupDataEntity) null);

View file

@ -1,20 +1,6 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
@@ -3,7 +3,6 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.File;
import java.util.ArrayList;
@@ -12,20 +11,29 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
-import java.util.Set;
-import java.util.TreeSet;
import java.util.UUID;
@@ -18,14 +18,25 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -42,7 +28,7 @@
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
public boolean savingDisabled;
private boolean O;
@@ -37,14 +45,22 @@
@@ -37,14 +48,22 @@
private int T;
private List<NextTickListEntry> U = Lists.newArrayList();
@ -68,7 +54,7 @@
this.H();
this.I();
this.getWorldBorder().a(minecraftserver.aD());
@@ -63,6 +79,7 @@
@@ -63,6 +82,7 @@
this.villages.a((World) this);
}
@ -76,7 +62,7 @@
this.scoreboard = new ScoreboardServer(this.server);
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard");
@@ -73,6 +90,11 @@
@@ -73,6 +93,11 @@
persistentscoreboard.a(this.scoreboard);
((ScoreboardServer) this.scoreboard).a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard)));
@ -88,7 +74,7 @@
this.B = new LootTableRegistry(new File(new File(this.dataManager.getDirectory(), "data"), "loot_tables"));
this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C());
this.getWorldBorder().setDamageAmount(this.worldData.H());
@@ -85,9 +107,98 @@
@@ -85,9 +110,98 @@
this.getWorldBorder().setSize(this.worldData.D());
}
@ -187,7 +173,7 @@
public void doTick() {
super.doTick();
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
@@ -105,9 +216,11 @@
@@ -105,9 +219,11 @@
this.f();
}
@ -202,7 +188,7 @@
}
this.methodProfiler.c("chunkSource");
@@ -136,6 +249,8 @@
@@ -136,6 +252,8 @@
this.portalTravelAgent.a(this.getTime());
this.methodProfiler.b();
this.ao();
@ -211,7 +197,7 @@
}
public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
@@ -162,7 +277,7 @@
@@ -162,7 +280,7 @@
if (entityhuman.isSpectator()) {
++i;
@ -220,7 +206,7 @@
++j;
}
}
@@ -188,25 +303,46 @@
@@ -188,25 +306,46 @@
}
private void c() {
@ -271,7 +257,7 @@
return false;
} else {
@@ -277,7 +413,7 @@
@@ -277,7 +416,7 @@
entityhorse.x(true);
entityhorse.setAgeRaw(0);
entityhorse.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -280,7 +266,7 @@
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
} else {
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
@@ -293,11 +429,29 @@
@@ -293,11 +432,29 @@
BlockPosition blockposition1 = blockposition.down();
if (this.v(blockposition1)) {
@ -312,7 +298,7 @@
}
if (flag && this.getBiome(blockposition1).d()) {
@@ -372,7 +526,7 @@
@@ -372,7 +529,7 @@
public boolean b(BlockPosition blockposition, Block block) {
NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block);
@ -321,7 +307,7 @@
}
public void a(BlockPosition blockposition, Block block, int i) {
@@ -413,8 +567,8 @@
@@ -411,8 +568,8 @@
nextticklistentry.a(j);
}
@ -332,7 +318,7 @@
this.nextTickList.add(nextticklistentry);
}
}
@@ -436,15 +590,15 @@
@@ -434,15 +591,15 @@
nextticklistentry.a((long) i + this.worldData.getTime());
}
@ -351,7 +337,7 @@
if (this.emptyTime++ >= 300) {
return;
}
@@ -514,11 +668,17 @@
@@ -512,11 +669,17 @@
} else {
int i = this.nextTickList.size();
@ -359,19 +345,19 @@
+ if (false) { // CraftBukkit
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (i > 1000) {
- i = 1000;
if (i > 65536) {
- i = 65536;
+ // CraftBukkit start - If the server has too much to process over time, try to alleviate that
+ if (i > 20 * 1000) {
+ if (i > 20 * 65536) {
+ i = i / 20;
+ } else {
+ i = 1000;
+ i = 65536;
+ }
+ // CraftBukkit end
}
this.methodProfiler.a("cleaning");
@@ -531,8 +691,9 @@
@@ -529,8 +692,9 @@
break;
}
@ -382,7 +368,7 @@
this.U.add(nextticklistentry);
}
@@ -600,7 +761,7 @@
@@ -598,7 +762,7 @@
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
if (flag) {
if (i == 0) {
@ -391,7 +377,7 @@
}
iterator.remove();
@@ -618,6 +779,7 @@
@@ -616,6 +780,7 @@
return arraylist;
}
@ -399,7 +385,7 @@
public void entityJoinedWorld(Entity entity, boolean flag) {
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
@@ -629,6 +791,7 @@
@@ -627,6 +792,7 @@
super.entityJoinedWorld(entity, flag);
}
@ -407,7 +393,7 @@
private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs();
@@ -641,12 +804,42 @@
@@ -639,12 +805,42 @@
protected IChunkProvider n() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
@ -451,7 +437,7 @@
for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
BlockPosition blockposition = tileentity.getPosition();
@@ -655,6 +848,8 @@
@@ -653,6 +849,8 @@
arraylist.add(tileentity);
}
}
@ -460,7 +446,7 @@
return arraylist;
}
@@ -718,6 +913,23 @@
@@ -716,6 +914,23 @@
int j = this.worldProvider.getSeaLevel();
int k = 8;
@ -484,7 +470,7 @@
if (blockposition != null) {
i = blockposition.getX();
k = blockposition.getZ();
@@ -727,7 +939,7 @@
@@ -725,7 +940,7 @@
int l = 0;
@ -493,7 +479,7 @@
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
@@ -768,6 +980,7 @@
@@ -766,6 +981,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
if (chunkproviderserver.e()) {
@ -501,7 +487,7 @@
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
@@ -778,7 +991,8 @@
@@ -776,7 +992,8 @@
}
chunkproviderserver.a(flag);
@ -511,7 +497,7 @@
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
@@ -813,6 +1027,12 @@
@@ -811,6 +1028,12 @@
}
}
@ -524,7 +510,7 @@
this.worldData.a(this.getWorldBorder().getSize());
this.worldData.d(this.getWorldBorder().getCenterX());
this.worldData.c(this.getWorldBorder().getCenterZ());
@@ -822,8 +1042,12 @@
@@ -820,8 +1043,12 @@
this.worldData.k(this.getWorldBorder().getWarningTime());
this.worldData.b(this.getWorldBorder().j());
this.worldData.e(this.getWorldBorder().i());
@ -538,7 +524,7 @@
}
public boolean addEntity(Entity entity) {
@@ -847,7 +1071,7 @@
@@ -845,7 +1072,7 @@
private boolean i(Entity entity) {
if (entity.dead) {
@ -547,7 +533,7 @@
return false;
} else {
UUID uuid = entity.getUniqueID();
@@ -859,7 +1083,7 @@
@@ -857,7 +1084,7 @@
this.f.remove(entity1);
} else {
if (!(entity instanceof EntityHuman)) {
@ -556,7 +542,7 @@
return false;
}
@@ -902,6 +1126,14 @@
@@ -900,6 +1127,14 @@
}
public boolean strikeLightning(Entity entity) {
@ -571,7 +557,7 @@
if (super.strikeLightning(entity)) {
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutSpawnEntityWeather(entity));
return true;
@@ -919,10 +1151,20 @@
@@ -917,10 +1152,20 @@
}
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@ -592,7 +578,7 @@
if (!flag1) {
explosion.clearBlocks();
}
@@ -968,7 +1210,8 @@
@@ -966,7 +1211,8 @@
BlockActionData blockactiondata = (BlockActionData) iterator.next();
if (this.a(blockactiondata)) {
@ -602,7 +588,7 @@
}
}
@@ -991,6 +1234,7 @@
@@ -989,6 +1235,7 @@
boolean flag = this.W();
super.t();
@ -610,7 +596,7 @@
if (this.n != this.o) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
}
@@ -1009,6 +1253,21 @@
@@ -1007,6 +1254,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
}
@ -632,7 +618,7 @@
}
@@ -1037,10 +1296,20 @@
@@ -1035,10 +1297,20 @@
}
public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {

View file

@ -4,14 +4,14 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.9-R0.1-SNAPSHOT</version>
<version>1.9.2-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
<minecraft.version>1.9</minecraft.version>
<minecraft.version>1.9.2</minecraft.version>
<minecraft_version>1_9_R1</minecraft_version>
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
<buildtag.suffix></buildtag.suffix>

View file

@ -424,6 +424,7 @@ public enum CraftSound {
ITEM_BUCKET_FILL("item.bucket.fill"),
ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"),
ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"),
ITEM_ELYTRA_FLYING("item.elytra.flying"),
ITEM_FIRECHARGE_USE("item.firecharge.use"),
ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"),
ITEM_HOE_TILL("item.hoe.till"),

View file

@ -22,6 +22,7 @@ public final class CraftItemFactory implements ItemFactory {
ConfigurationSerialization.registerClass(CraftMetaItem.SerializableMeta.class);
KNOWN_NBT_ATTRIBUTE_NAMES = ImmutableSet.<String>builder()
.add("generic.armor")
.add("generic.armorToughness")
.add("generic.attackDamage")
.add("generic.followRange")
.add("generic.knockbackResistance")