Update to Minecraft 1.14-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-04-23 12:00:00 +10:00
parent 0e98365784
commit a0f2b74c8d
560 changed files with 10642 additions and 10867 deletions

View File

@@ -11,37 +11,14 @@
+import org.bukkit.potion.PotionEffect;
+// CraftBukkit end
+
public class TileEntityBeacon extends TileEntityContainer implements IWorldInventory, ITickable {
public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable {
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}};
@@ -22,6 +29,38 @@
public MobEffectList secondaryEffect;
private ItemStack inventorySlot;
private IChatBaseComponent o;
@@ -24,6 +31,15 @@
public IChatBaseComponent customName;
public ChestLock chestLock;
private final IContainerProperties containerProperties;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public List<ItemStack> getContents() {
+ return Arrays.asList(this.inventorySlot);
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ public PotionEffect getPrimaryEffect() {
+ return (this.primaryEffect != null) ? CraftPotionUtil.toBukkit(new MobEffect(this.primaryEffect, getLevel(), getAmplification(), true, true)) : null;
+ }
@@ -53,12 +30,12 @@
public TileEntityBeacon() {
super(TileEntityTypes.BEACON);
@@ -55,41 +94,79 @@
this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
@@ -185,39 +201,78 @@
}
- private void applyEffects() {
- if (this.i && this.levels > 0 && !this.world.isClientSide && this.primaryEffect != null) {
- if (!this.world.isClientSide && this.primaryEffect != null) {
- double d0 = (double) (this.levels * 10 + 10);
+ // CraftBukkit start - split into components
+ private byte getAmplification() {
@@ -84,10 +61,7 @@
+ {
+ double d0 = (double) (this.levels * 10 + 10);
+
int j = this.position.getX();
int k = this.position.getY();
int l = this.position.getZ();
AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double) j, (double) k, (double) l, (double) (j + 1), (double) (k + 1), (double) (l + 1))).g(d0).b(0.0D, (double) this.world.getHeight(), 0.0D);
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(this.position)).g(d0).b(0.0D, (double) this.world.getHeight(), 0.0D);
List<EntityHuman> list = this.world.a(EntityHuman.class, axisalignedbb);
+
+ return list;
@@ -112,19 +86,21 @@
+ {
if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect != null) {
- iterator = list.iterator();
+ return true;
+ }
-
- while (iterator.hasNext()) {
- entityhuman = (EntityHuman) iterator.next();
- entityhuman.addEffect(new MobEffect(this.secondaryEffect, i, 0, true, true));
- }
+ return true;
}
+ return false;
+ }
+ }
+
}
}
+ private void applyEffects() {
+ if (this.i && this.levels > 0 && !this.world.isClientSide && this.primaryEffect != null) {
+ if (!this.world.isClientSide && this.primaryEffect != null) {
+ double d0 = (double) (this.levels * 10 + 10);
+ byte b0 = getAmplification();
+
+ int i = getLevel();
@@ -134,24 +110,25 @@
+
+ if (hasSecondaryEffect()) {
+ applyEffect(list, this.secondaryEffect, i, 0);
}
}
}
+ }
+ }
+
+ }
+ // CraftBukkit end
private void E() {
int i = this.position.getX();
@@ -209,8 +286,10 @@
+
public void a(SoundEffect soundeffect) {
this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -247,8 +302,10 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);
- this.primaryEffect = e(nbttagcompound.getInt("Primary"));
- this.secondaryEffect = e(nbttagcompound.getInt("Secondary"));
- this.primaryEffect = b(nbttagcompound.getInt("Primary"));
- this.secondaryEffect = b(nbttagcompound.getInt("Secondary"));
+ // Craftbukkit start - persist manually set non-default beacon effects (SPIGOT-3598)
+ this.primaryEffect = MobEffectList.fromId(nbttagcompound.getInt("Primary"));
+ this.secondaryEffect = MobEffectList.fromId(nbttagcompound.getInt("Secondary"));
+ // Craftbukkit end
this.levels = nbttagcompound.getInt("Levels");
}
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
}