Even more patches for 1.14
Dieser Commit ist enthalten in:
Ursprung
9d3524b908
Commit
df6c35d757
@ -1,4 +1,4 @@
|
||||
From d83d55251a2b2bf4b9408f88226935e421c430f8 Mon Sep 17 00:00:00 2001
|
||||
From f528a12b1b3b67cfd3718621f96e1db6c24590c9 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 10 Jun 2018 20:20:15 -0400
|
||||
Subject: [PATCH] Fix CraftEntity hashCode
|
||||
@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle()
|
||||
However, replaced it too to make it clearer of intent.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 84a58c7dcd..a0e1a70d43 100644
|
||||
index e0ae72bbc..65621f966 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -558,14 +558,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -686,14 +686,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return false;
|
||||
}
|
||||
final CraftEntity other = (CraftEntity) obj;
|
@ -0,0 +1,135 @@
|
||||
From a3244fa27146516e44847fe9cbba51338ae4348e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 15 Jun 2018 00:30:32 -0400
|
||||
Subject: [PATCH] Configurable Alternative LootPool Luck Formula
|
||||
|
||||
Rewrites the Vanilla luck application formula so that luck can be
|
||||
applied to items that do not have any quality defined.
|
||||
|
||||
See: https://luckformula.emc.gs for data and details
|
||||
-----------
|
||||
|
||||
The rough summary is:
|
||||
My goal was that in a pool, when luck was applied, the pool
|
||||
rebalances so the percentages for bigger items is
|
||||
lowered and smaller items is boosted.
|
||||
|
||||
Do this by boosting and then reducing the weight value,
|
||||
so that larger numbers are penalized more than smaller numbers.
|
||||
resulting in a larger reduction of entries for more common
|
||||
items than the reduction on small weights,
|
||||
giving smaller weights more of a chance
|
||||
|
||||
-----------
|
||||
|
||||
This work kind of obsoletes quality, but quality would be useful
|
||||
for 2 items with same weight that you want luck to impact
|
||||
in varying directions.
|
||||
|
||||
Fishing still falls into that as the weights are closer, so luck
|
||||
will invalidate junk more.
|
||||
|
||||
This change will result in some major changes to fishing formulas.
|
||||
|
||||
-----------
|
||||
|
||||
I would love to see this change in Vanilla, so Mojang please pull :)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 7fba61a6d..c8f9c45e5 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -276,4 +276,12 @@ public class PaperConfig {
|
||||
"such as inventories, experience points, advancements and the like will not be saved when they log out.");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static boolean useAlternativeLuckFormula = false;
|
||||
+ private static void useAlternativeLuckFormula() {
|
||||
+ useAlternativeLuckFormula = getBoolean("settings.use-alternative-luck-formula", false);
|
||||
+ if (useAlternativeLuckFormula) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
index 929053491..62cac814d 100644
|
||||
--- a/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
@@ -13,8 +13,8 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
public abstract class LootSelectorEntry extends LootEntryAbstract {
|
||||
|
||||
- protected final int e;
|
||||
- protected final int f;
|
||||
+ protected final int e; public int getWeight() { return e; } // Paper - OBFHELPER
|
||||
+ protected final int f; public int getQuality() { return f; } // Paper - OBFHELPER
|
||||
protected final LootItemFunction[] g;
|
||||
private final BiFunction<ItemStack, LootTableInfo, ItemStack> c;
|
||||
private final LootEntry h = new LootSelectorEntry.c() {
|
||||
@@ -127,7 +127,7 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
|
||||
@Override
|
||||
public T b(LootItemFunction.a lootitemfunction_a) {
|
||||
this.c.add(lootitemfunction_a.b());
|
||||
- return (LootSelectorEntry.a) this.d();
|
||||
+ return this.d(); // Paper - decompile fix -- move to mcdev fixes
|
||||
}
|
||||
|
||||
protected LootItemFunction[] a() {
|
||||
@@ -136,22 +136,49 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
|
||||
|
||||
public T a(int i) {
|
||||
this.a = i;
|
||||
- return (LootSelectorEntry.a) this.d();
|
||||
+ return this.d(); // Paper - decompile fix -- move to mcdev fixes
|
||||
}
|
||||
|
||||
public T b(int i) {
|
||||
this.b = i;
|
||||
- return (LootSelectorEntry.a) this.d();
|
||||
+ return this.d(); // Paper - decompile fix -- MOVE UP
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class c implements LootEntry {
|
||||
|
||||
- protected c() {}
|
||||
+ protected c() {
|
||||
+ }
|
||||
|
||||
@Override
|
||||
public int a(float f) {
|
||||
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.e + (float) LootSelectorEntry.this.f * f), 0);
|
||||
+ // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
|
||||
+ // SEE: https://luckformula.emc.gs for details and data
|
||||
+ if (lastLuck != null && lastLuck == f) {
|
||||
+ return lastWeight;
|
||||
+ }
|
||||
+ // This is vanilla
|
||||
+ float qualityModifer = (float) getQuality() * f;
|
||||
+ double baseWeight = (getWeight() + qualityModifer);
|
||||
+ if (com.destroystokyo.paper.PaperConfig.useAlternativeLuckFormula) {
|
||||
+ // Random boost to avoid losing precision in the final int cast on return
|
||||
+ final int weightBoost = 100;
|
||||
+ baseWeight *= weightBoost;
|
||||
+ // If we have vanilla 1, bump that down to 0 so nothing is is impacted
|
||||
+ // vanilla 3 = 300, 200 basis = impact 2%
|
||||
+ // =($B2*(($B2-100)/100/100))
|
||||
+ double impacted = baseWeight * ((baseWeight - weightBoost) / weightBoost / 100);
|
||||
+ // =($B$7/100)
|
||||
+ float luckModifier = Math.min(100, f * 10) / 100;
|
||||
+ // =B2 - (C2 *($B$7/100))
|
||||
+ baseWeight = Math.ceil(baseWeight - (impacted * luckModifier));
|
||||
+ }
|
||||
+ lastLuck = f;
|
||||
+ lastWeight = (int) Math.max(0, Math.floor(baseWeight));
|
||||
+ return lastWeight;
|
||||
}
|
||||
}
|
||||
+ private Float lastLuck = null;
|
||||
+ private int lastWeight = 0;
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,19 +1,19 @@
|
||||
From b19ec64b2b7728405a294db829c98d4c37b137da Mon Sep 17 00:00:00 2001
|
||||
From 42956378a65b0412666a7f30f8a29fca334e5ce6 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 15 Jun 2018 20:37:03 -0400
|
||||
Subject: [PATCH] Print Error details when failing to save player data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
index d5e21cc33c..577ba1b5f9 100644
|
||||
index e60e10c57..350ac42d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -154,7 +154,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
|
||||
@@ -151,7 +151,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
|
||||
file.renameTo(file1);
|
||||
} catch (Exception exception) {
|
||||
- WorldNBTStorage.b.warn("Failed to save player data for {}", entityhuman.getDisplayName().getString());
|
||||
+ WorldNBTStorage.b.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
|
||||
- WorldNBTStorage.LOGGER.warn("Failed to save player data for {}", entityhuman.getDisplayName().getString());
|
||||
+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
From 43309180bebc7a1df2dd169fed98dd2f02737f59 Mon Sep 17 00:00:00 2001
|
||||
From b3cdaca5ce72cb5807c5b6fb21744a9c0de5be0c Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 16 Jun 2018 01:18:16 -0500
|
||||
Subject: [PATCH] Make shield blocking delay configurable
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 4727ac6eb5..47f8dfcc41 100644
|
||||
index fe9415b1d..ce17447fa 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -442,4 +442,9 @@ public class PaperWorldConfig {
|
||||
log("Villages can load chunks - Warning this can cause intense TPS loss. Strongly consider disabling this.");
|
||||
}
|
||||
@@ -365,4 +365,9 @@ public class PaperWorldConfig {
|
||||
disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit);
|
||||
log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
|
||||
}
|
||||
+
|
||||
+ public int shieldBlockingDelay = 5;
|
||||
@ -19,23 +19,22 @@ index 4727ac6eb5..47f8dfcc41 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 02fcfc449c..deb50b84f7 100644
|
||||
index 9ef605ba3..8c6d53f44 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2701,7 +2701,7 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -2915,7 +2915,7 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.isHandRaised() && !this.activeItem.isEmpty()) {
|
||||
Item item = this.activeItem.getItem();
|
||||
|
||||
- return item.d(this.activeItem) != EnumAnimation.BLOCK ? false : item.c(this.activeItem) - this.bu >= 5;
|
||||
+ return item.d(this.activeItem) != EnumAnimation.BLOCK ? false : item.c(this.activeItem) - this.bu >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
|
||||
- return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bo >= 5;
|
||||
+ return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bo >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -2789,4 +2789,16 @@ public abstract class EntityLiving extends Entity {
|
||||
public boolean df() {
|
||||
return true;
|
||||
@@ -3151,4 +3151,15 @@ public abstract class EntityLiving extends Entity {
|
||||
public void d(EnumHand enumhand) {
|
||||
this.c(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public int shieldBlockingDelay = world.paperConfig.shieldBlockingDelay;
|
||||
+
|
||||
@ -49,10 +48,10 @@ index 02fcfc449c..deb50b84f7 100644
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 2f96842bb9..8e65bfc78e 100644
|
||||
index f95347df0..182145ccf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -558,5 +558,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -559,5 +559,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setArrowsStuck(int arrows) {
|
||||
getHandle().setArrowCount(arrows);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
From cc6a121371a695b0890a0a4a88221769e8f08e43 Mon Sep 17 00:00:00 2001
|
||||
From 6731f23f1615e38fd9d7d0b6d89e50045ce2f016 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 16 Jun 2018 16:23:38 -0400
|
||||
Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors
|
||||
@ -6,31 +6,31 @@ Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors
|
||||
This code was causing NPE's in saving player data, potentially related to reloads.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/RecipeBookServer.java b/src/main/java/net/minecraft/server/RecipeBookServer.java
|
||||
index 5a21aed438..4d9f3d3695 100644
|
||||
index 440e8f134..091c4abbd 100644
|
||||
--- a/src/main/java/net/minecraft/server/RecipeBookServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/RecipeBookServer.java
|
||||
@@ -78,6 +78,10 @@ public class RecipeBookServer extends RecipeBook {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
MinecraftKey minecraftkey = (MinecraftKey) iterator.next();
|
||||
|
||||
+ // Paper start - ignore missing recipes
|
||||
+ IRecipe recipe = this.h.a(minecraftkey);
|
||||
+ if (recipe == null) continue;
|
||||
+ final Optional<? extends IRecipe<?>> recipe = this.l.a(minecraftkey);
|
||||
+ if (!recipe.isPresent()) continue;
|
||||
+ // Paper end
|
||||
nbttaglist.add((NBTBase) (new NBTTagString(minecraftkey.toString())));
|
||||
}
|
||||
|
||||
nbttaglist.add(new NBTTagString(minecraftkey.toString()));
|
||||
}
|
||||
@@ -88,6 +92,10 @@ public class RecipeBookServer extends RecipeBook {
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
MinecraftKey minecraftkey1 = (MinecraftKey) iterator1.next();
|
||||
|
||||
+ // Paper start - ignore missing recipes
|
||||
+ IRecipe recipe = this.h.a(minecraftkey1);
|
||||
+ if (recipe == null) continue;
|
||||
+ final Optional<? extends IRecipe<?>> recipe = this.l.a(minecraftkey1);
|
||||
+ if (!recipe.isPresent()) continue;
|
||||
+ // Paper end
|
||||
nbttaglist1.add((NBTBase) (new NBTTagString(minecraftkey1.toString())));
|
||||
}
|
||||
|
||||
nbttaglist1.add(new NBTTagString(minecraftkey1.toString()));
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 72ff41a6569670f3194ca52bf850eef0349b13a8 Mon Sep 17 00:00:00 2001
|
||||
From 874ba3a727fad9bf8f9784944ac3a2e23a5c155d Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
||||
Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
|
||||
@ -6,10 +6,10 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
|
||||
Adds ability to get what arrow was shot, and control if it should be consumed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
index 749a8a5272..6e2ee04c77 100644
|
||||
index e575d3cff..85157e80d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
@@ -152,7 +152,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
||||
@@ -157,7 +157,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
// CraftBukkit start
|
||||
@ -19,10 +19,10 @@ index 749a8a5272..6e2ee04c77 100644
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
index 6934114005..52bc68e6a6 100644
|
||||
index 50b815dc8..4ec02c8ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
@@ -55,6 +55,7 @@ public class ItemBow extends Item {
|
||||
@@ -36,6 +36,7 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
if ((double) f >= 0.1D) {
|
||||
boolean flag1 = flag && itemstack1.getItem() == Items.ARROW;
|
||||
|
||||
@ -30,7 +30,7 @@ index 6934114005..52bc68e6a6 100644
|
||||
if (!world.isClientSide) {
|
||||
ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW));
|
||||
EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman);
|
||||
@@ -80,7 +81,7 @@ public class ItemBow extends Item {
|
||||
@@ -61,7 +62,7 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
entityarrow.setOnFire(100);
|
||||
}
|
||||
// CraftBukkit start
|
||||
@ -39,17 +39,17 @@ index 6934114005..52bc68e6a6 100644
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
@@ -88,7 +89,8 @@ public class ItemBow extends Item {
|
||||
// CraftBukkit end
|
||||
|
||||
itemstack.damage(1, entityhuman);
|
||||
@@ -71,7 +72,8 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.d(entityhuman.getRaisedHand());
|
||||
});
|
||||
- if (flag1 || entityhuman.abilities.canInstantlyBuild && (itemstack1.getItem() == Items.SPECTRAL_ARROW || itemstack1.getItem() == Items.TIPPED_ARROW)) {
|
||||
+ consumeArrow = event.getConsumeArrow(); // Paper
|
||||
+ if (!consumeArrow || flag1 || (entityhuman.abilities.canInstantlyBuild && ((itemstack1.getItem() == Items.SPECTRAL_ARROW) || (itemstack1.getItem() == Items.TIPPED_ARROW)))) { // Paper - add !consumeArrow
|
||||
+ if (!consumeArrow || flag1 || (entityhuman.abilities.canInstantlyBuild && ((itemstack1.getItem() == Items.SPECTRAL_ARROW) || (itemstack1.getItem() == Items.TIPPED_ARROW)))) { // Paper - add
|
||||
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
}
|
||||
|
||||
@@ -105,7 +107,7 @@ public class ItemBow extends Item {
|
||||
@@ -88,7 +90,7 @@ public class ItemBow extends ItemProjectileWeapon {
|
||||
}
|
||||
|
||||
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);
|
||||
@ -58,25 +58,48 @@ index 6934114005..52bc68e6a6 100644
|
||||
itemstack1.subtract(1);
|
||||
if (itemstack1.isEmpty()) {
|
||||
entityhuman.inventory.f(itemstack1);
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
index 569e117b7..144c63c9a 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
||||
@@ -208,7 +208,7 @@ public class ItemCrossbow extends ItemProjectileWeapon {
|
||||
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
|
||||
}
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, (Entity) object, f);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (IProjectile) object, f); // Paper // TODO: consume??
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index c02619bb57..acc80d0684 100644
|
||||
index 8d3dca2a9..4a16f2f53 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -332,7 +332,7 @@ public class CraftEventFactory {
|
||||
@@ -47,6 +47,7 @@ import net.minecraft.server.GeneratorAccess;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.IInventory;
|
||||
+import net.minecraft.server.IProjectile;
|
||||
import net.minecraft.server.ItemActionContext;
|
||||
import net.minecraft.server.ItemStack;
|
||||
import net.minecraft.server.Items;
|
||||
@@ -437,16 +438,16 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* EntityShootBowEvent
|
||||
*/
|
||||
- public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
|
||||
+ public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, /*bow*/ItemStack itemstack, /*arrow*/ ItemStack arrowItem, EntityArrow entityArrow, float force) { // Paper
|
||||
- public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, Entity entityArrow, float force) {
|
||||
+ public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, ItemStack arrowItem, IProjectile entityArrow, float force) { // paper
|
||||
LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
Arrow arrow = (Arrow) entityArrow.getBukkitEntity();
|
||||
@@ -341,7 +341,7 @@ public class CraftEventFactory {
|
||||
- org.bukkit.entity.Entity arrow = entityArrow.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity arrow = ((Entity) entityArrow).getBukkitEntity(); // Paper
|
||||
|
||||
if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
|
||||
itemInHand = null;
|
||||
}
|
||||
|
||||
- EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
|
||||
+ EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, CraftItemStack.asCraftMirror(arrowItem), arrow, force); // Paper
|
||||
+ EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, CraftItemStack.asCraftMirror(arrowItem), (Projectile) arrow, force); // Paper
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
42
Spigot-Server-Patches/0241-PlayerReadyArrowEvent.patch
Normale Datei
42
Spigot-Server-Patches/0241-PlayerReadyArrowEvent.patch
Normale Datei
@ -0,0 +1,42 @@
|
||||
From 0cdddf9367dc7f2c534b18f99bce0f153d4cc7da Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 18 Jun 2018 01:12:53 -0400
|
||||
Subject: [PATCH] PlayerReadyArrowEvent
|
||||
|
||||
Called when a player is firing a bow and the server is choosing an arrow to use.
|
||||
Plugins can skip selection of certain arrows and control which is used.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 27bf83f37..3031d73f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -2032,6 +2032,17 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
return (EntitySize) EntityHuman.b.getOrDefault(entitypose, EntityHuman.bs);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ protected boolean tryReadyArrow(ItemStack bow, ItemStack itemstack) {
|
||||
+ return !(this instanceof EntityPlayer) ||
|
||||
+ new com.destroystokyo.paper.event.player.PlayerReadyArrowEvent(
|
||||
+ ((EntityPlayer) this).getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(bow),
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)
|
||||
+ ).callEvent();
|
||||
+ // Paper end
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public ItemStack f(ItemStack itemstack) {
|
||||
if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) {
|
||||
@@ -2048,7 +2059,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
for (int i = 0; i < this.inventory.getSize(); ++i) {
|
||||
ItemStack itemstack2 = this.inventory.getItem(i);
|
||||
|
||||
- if (predicate.test(itemstack2)) {
|
||||
+ if (predicate.test(itemstack2) && tryReadyArrow(itemstack, itemstack2)) { // Paper
|
||||
return itemstack2;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 534d093b17cb43c542e46b2efe94bbe4e8f7dfbd Mon Sep 17 00:00:00 2001
|
||||
From 15f975b03733628dbc8406c8b3dab599b68ea3bb Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 18 Jun 2018 22:19:36 -0400
|
||||
Subject: [PATCH] Fire EntityShootBowEvent for Illusioner
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
index 08af4453fa..8b595979e7 100644
|
||||
index 378267314..96ad67889 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
@@ -123,8 +123,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
|
||||
@@ -138,8 +138,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
@ -27,7 +27,7 @@ index 08af4453fa..8b595979e7 100644
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected EntityArrow v(float f) {
|
||||
class a extends EntityIllagerWizard.c {
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,31 @@
|
||||
From 4312a5c952e133eafb39adc49e655f1445468cd7 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:46:23 +0200
|
||||
Subject: [PATCH] Implement EntityKnockbackByEntityEvent
|
||||
|
||||
This event is called when an entity receives knockback by another entity.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 8c6d53f44..d65933e9e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1424,6 +1424,16 @@ public abstract class EntityLiving extends Entity {
|
||||
Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f);
|
||||
|
||||
this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+
|
||||
+ // Paper start - call EntityKnockbackByEntityEvent
|
||||
+ Vec3D currentMot = this.getMot();
|
||||
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z);
|
||||
+ // Restore old velocity to be able to access it in the event
|
||||
+ this.setMot(vec3d);
|
||||
+ if (entity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), entity.getBukkitEntity(), f, delta).callEvent()) {
|
||||
+ this.setMot(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 440eeef40055f8f50ababeb0f190fba4bac3cd9c Mon Sep 17 00:00:00 2001
|
||||
From 3fe29c64acb5071f4ee13259b444dcb4d298e859 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 20 Jun 2018 23:17:24 -0400
|
||||
Subject: [PATCH] Expand Explosions API
|
||||
@ -6,12 +6,12 @@ Subject: [PATCH] Expand Explosions API
|
||||
Add Entity as a Source capability, and add more API choices, and on Location.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 1cc42edae8..cfa35740b4 100644
|
||||
index 3ed9d3f47..c8cbedb5c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -539,6 +539,11 @@ public class CraftWorld implements World {
|
||||
@@ -710,6 +710,11 @@ public class CraftWorld implements World {
|
||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) {
|
||||
return !world.createExplosion(null, x, y, z, power, setFire, breakBlocks).wasCanceled;
|
||||
return !world.createExplosion(null, x, y, z, power, setFire, breakBlocks ? Explosion.Effect.BREAK : Explosion.Effect.NONE).wasCanceled;
|
||||
}
|
||||
+ // Paper start
|
||||
+ public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) {
|
@ -1,4 +1,4 @@
|
||||
From b0ace26dda67fe67e597961dc025a8df70d902f6 Mon Sep 17 00:00:00 2001
|
||||
From 42e917cd4fe357b4ebee9bb1e2adfff968f3b020 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 29 Jun 2018 00:21:28 -0400
|
||||
Subject: [PATCH] LivingEntity Hand Raised/Item Use API
|
||||
@ -6,36 +6,36 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
|
||||
How long an entity has raised hands to charge an attack or use an item
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 164e4b412a..bc1ab273bd 100644
|
||||
index d65933e9e..58bfe8c1c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -106,7 +106,7 @@ public abstract class EntityLiving extends Entity {
|
||||
private float bI;
|
||||
private int bJ;
|
||||
private float bK;
|
||||
@@ -109,7 +109,7 @@ public abstract class EntityLiving extends Entity {
|
||||
private float bD;
|
||||
private int jumpTicks;
|
||||
private float bF;
|
||||
- protected ItemStack activeItem;
|
||||
+ public ItemStack activeItem; // Paper - public
|
||||
protected int bu;
|
||||
protected int bv;
|
||||
private BlockPosition bL;
|
||||
@@ -2690,10 +2690,12 @@ public abstract class EntityLiving extends Entity {
|
||||
protected int bo;
|
||||
protected int bp;
|
||||
private BlockPosition bG;
|
||||
@@ -2893,10 +2893,12 @@ public abstract class EntityLiving extends Entity {
|
||||
return this.activeItem;
|
||||
}
|
||||
|
||||
+ public int getItemUseRemainingTime() { return cX(); } // Paper - OBFHELPER
|
||||
public int cX() {
|
||||
return this.bu;
|
||||
+ public int getItemUseRemainingTime() { return dm(); } // Paper - OBFHELPER
|
||||
public int dm() {
|
||||
return this.bo;
|
||||
}
|
||||
|
||||
+ public int getHandRaisedTime() { return cY(); } // Paper - OBFHELPER
|
||||
public int cY() {
|
||||
return this.isHandRaised() ? this.activeItem.k() - this.cX() : 0;
|
||||
+ public int getHandRaisedTime() { return dn(); } // Paper - OBFHELPER
|
||||
public int dn() {
|
||||
return this.isHandRaised() ? this.activeItem.k() - this.dm() : 0;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 8e65bfc78e..52834b6da3 100644
|
||||
index 182145ccf..29b23e30f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -568,5 +568,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -569,5 +569,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setShieldBlockingDelay(int delay) {
|
||||
getHandle().setShieldBlockingDelay(delay);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
From 4e5232bc88f4f7f5c7913f8cbd30e71973252d33 Mon Sep 17 00:00:00 2001
|
||||
From 14ffddbe3a78171ba0871e8c122359580ecec888 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 26 Jun 2018 22:00:49 -0400
|
||||
Subject: [PATCH] RangedEntity API
|
||||
@ -8,7 +8,7 @@ and to perform an attack.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java
|
||||
new file mode 100644
|
||||
index 0000000000..696660b089
|
||||
index 000000000..696660b08
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java
|
||||
@@ -0,0 +1,19 @@
|
||||
@ -32,21 +32,21 @@ index 0000000000..696660b089
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java
|
||||
index 4fd69850fd..b763bd11dd 100644
|
||||
index b4178ce1e..9b79ac77d 100644
|
||||
--- a/src/main/java/net/minecraft/server/IRangedEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/IRangedEntity.java
|
||||
@@ -2,7 +2,7 @@ package net.minecraft.server;
|
||||
@@ -2,5 +2,8 @@ package net.minecraft.server;
|
||||
|
||||
public interface IRangedEntity {
|
||||
|
||||
- void a(EntityLiving entityliving, float f);
|
||||
+ void a(EntityLiving entityliving, float f); default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper - OBFHELPER
|
||||
|
||||
- void s(boolean flag);
|
||||
+ void s(boolean flag); default void setChargingAttack(boolean flag) { s(flag); } // Paper - OBFHELPER
|
||||
+
|
||||
+ // - see EntitySkeletonAbstract melee goal
|
||||
+ void q(boolean flag); default void setChargingAttack(boolean charging) { q(charging); }; // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
||||
index 2ec1af8be4..f31d3eed3a 100644
|
||||
index 2ec1af8be..f31d3eed3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
||||
@@ -1,11 +1,12 @@
|
||||
@ -64,7 +64,7 @@ index 2ec1af8be4..f31d3eed3a 100644
|
||||
public CraftIllusioner(CraftServer server, EntityIllagerIllusioner entity) {
|
||||
super(server, entity);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
||||
index 23ab78da15..3f94c5a920 100644
|
||||
index 23ab78da1..3f94c5a92 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -84,15 +84,14 @@ index 23ab78da15..3f94c5a920 100644
|
||||
public CraftLlama(CraftServer server, EntityLlama entity) {
|
||||
super(server, entity);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
index 4ed89615fd..4fa5e84ea4 100644
|
||||
index 9fef81cc2..1dc9b4412 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
@@ -1,12 +1,13 @@
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
||||
import net.minecraft.server.EntitySkeletonAbstract;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
@ -103,7 +102,7 @@ index 4ed89615fd..4fa5e84ea4 100644
|
||||
public CraftSkeleton(CraftServer server, EntitySkeletonAbstract entity) {
|
||||
super(server, entity);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
index 0349f0a574..2e3d8fcdfa 100644
|
||||
index 0349f0a57..2e3d8fcdf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
@@ -1,11 +1,12 @@
|
||||
@ -121,25 +120,25 @@ index 0349f0a574..2e3d8fcdfa 100644
|
||||
super(server, entity);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
||||
index c08833cb7a..f25998eb6d 100644
|
||||
index fb14179c3..49e0f2206 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
||||
+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper
|
||||
import net.minecraft.server.EntityWitch;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Witch;
|
||||
|
||||
-public class CraftWitch extends CraftMonster implements Witch {
|
||||
+public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity<EntityWitch> { // Paper
|
||||
-public class CraftWitch extends CraftRaider implements Witch {
|
||||
+public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<EntityWitch> { // Paper
|
||||
public CraftWitch(CraftServer server, EntityWitch entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
index 3df0fcb9b6..a1d04ff284 100644
|
||||
index 3df0fcb9b..a1d04ff28 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -1,5 +1,6 @@
|
@ -1,14 +1,14 @@
|
||||
From 0b1be3cdc11bb23eee5fe71b501121bafb812ddd Mon Sep 17 00:00:00 2001
|
||||
From 578426cb83913b333e58ee88e26f12aa7e016c17 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 22 Jun 2018 10:38:31 -0500
|
||||
Subject: [PATCH] Add config to disable ender dragon legacy check
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 47f8dfcc41..aa2be2ede6 100644
|
||||
index ce17447fa..3294fbbea 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -447,4 +447,9 @@ public class PaperWorldConfig {
|
||||
@@ -370,4 +370,9 @@ public class PaperWorldConfig {
|
||||
private void shieldBlockingDelay() {
|
||||
shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5);
|
||||
}
|
||||
@ -19,7 +19,7 @@ index 47f8dfcc41..aa2be2ede6 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
index a6259d9e6c..aad7ce93f6 100644
|
||||
index 5ae20b132..60ba37c92 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
@@ -28,10 +28,10 @@ public class EnderDragonBattle {
|
@ -1,14 +1,14 @@
|
||||
From f0ca58a8e0ebfb5e2e3b90874b70a7c01562a0fa Mon Sep 17 00:00:00 2001
|
||||
From a2240a33505d12875b4c786d32e28c961acc6904 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Tue, 3 Jul 2018 16:08:14 +0200
|
||||
Subject: [PATCH] Implement World.getEntity(UUID) API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index cfa35740b4..609b911265 100644
|
||||
index c8cbedb5c..f8870f37b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -890,6 +890,14 @@ public class CraftWorld implements World {
|
||||
@@ -1061,6 +1061,14 @@ public class CraftWorld implements World {
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ index cfa35740b4..609b911265 100644
|
||||
+ // Paper end
|
||||
+
|
||||
public void save() {
|
||||
// Spigot start
|
||||
save(true);
|
||||
this.server.checkSaveState();
|
||||
try {
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 1d495495333e3af2404bad9dc68d0b11ca1e0537 Mon Sep 17 00:00:00 2001
|
||||
From bee370a5eb7dc4c813473fa4262b6ff0df258974 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 3 Jul 2018 21:56:23 -0400
|
||||
Subject: [PATCH] InventoryCloseEvent Reason API
|
||||
@ -6,34 +6,12 @@ Subject: [PATCH] InventoryCloseEvent Reason API
|
||||
Allows you to determine why an inventory was closed, enabling plugin developers
|
||||
to "confirm" things based on if it was player triggered close or not.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index a6cacd7da9..c2f12f92b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -944,7 +944,7 @@ public class Chunk implements IChunkAccess {
|
||||
{
|
||||
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
|
||||
{
|
||||
- ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory();
|
||||
+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -969,7 +969,7 @@ public class Chunk implements IChunkAccess {
|
||||
{
|
||||
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
|
||||
{
|
||||
- ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory();
|
||||
+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index d4618d644a..cc1bc01b16 100644
|
||||
index 3031d73f5..f665dc0eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -158,7 +158,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.dg();
|
||||
@@ -149,7 +149,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.dA();
|
||||
super.tick();
|
||||
if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) {
|
||||
- this.closeInventory();
|
||||
@ -41,8 +19,8 @@ index d4618d644a..cc1bc01b16 100644
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
@@ -360,6 +360,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
return this.getHealth() <= 0.0F || this.isSleeping();
|
||||
@@ -336,6 +336,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
return 20;
|
||||
}
|
||||
|
||||
+ // Paper start - unused code, but to keep signatures aligned
|
||||
@ -56,10 +34,10 @@ index d4618d644a..cc1bc01b16 100644
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index e4e1d999e9..dc72538de6 100644
|
||||
index 27ade8d7d..634c30d93 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -344,7 +344,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@@ -359,7 +359,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
// Paper end
|
||||
if (!this.world.isClientSide && !this.activeContainer.canUse(this)) {
|
||||
@ -68,25 +46,25 @@ index e4e1d999e9..dc72538de6 100644
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
if (!event.getKeepInventory()) {
|
||||
this.inventory.clear();
|
||||
}
|
||||
-
|
||||
+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DEATH); // Paper
|
||||
this.setSpectatorTarget(this); // Remove spectated target
|
||||
// CraftBukkit end
|
||||
@@ -527,7 +527,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
@@ -873,7 +873,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
// SPIGOT-943 - only call if they have an inventory open
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
- this.closeInventory();
|
||||
+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DEATH); // Paper
|
||||
}
|
||||
|
||||
String deathMessage = event.getDeathMessage();
|
||||
@@ -1036,7 +1036,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
- this.closeInventory();
|
||||
+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
|
||||
}
|
||||
|
||||
if (iinventory instanceof ITileInventory) {
|
||||
@@ -946,7 +946,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.nextContainerCounter();
|
||||
@@ -1086,7 +1086,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
@ -94,10 +72,10 @@ index e4e1d999e9..dc72538de6 100644
|
||||
+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
|
||||
}
|
||||
|
||||
this.nextContainerCounter();
|
||||
@@ -1011,7 +1011,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
// this.nextContainerCounter(); // CraftBukkit - moved up
|
||||
@@ -1150,7 +1150,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
- CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit
|
||||
+ // Paper start
|
||||
@ -110,10 +88,10 @@ index e4e1d999e9..dc72538de6 100644
|
||||
this.m();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 6dea9456a4..0b5dc66897 100644
|
||||
index c9caf4423..fbdc755e8 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -2001,7 +2001,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -2050,7 +2050,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
||||
|
||||
if (this.player.isFrozen()) return; // CraftBukkit
|
||||
@ -123,10 +101,10 @@ index 6dea9456a4..0b5dc66897 100644
|
||||
this.player.m();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 96eff10ffa..ddaa73e83d 100644
|
||||
index b855e7968..6d464a3dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -422,7 +422,7 @@ public abstract class PlayerList {
|
||||
@@ -400,7 +400,7 @@ public abstract class PlayerList {
|
||||
entityplayer.a(StatisticList.LEAVE_GAME);
|
||||
|
||||
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
@ -135,11 +113,33 @@ index 96eff10ffa..ddaa73e83d 100644
|
||||
|
||||
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
|
||||
cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index e400cc05d..79be8cfa3 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -988,7 +988,7 @@ public class WorldServer extends World {
|
||||
{
|
||||
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
|
||||
{
|
||||
- ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory();
|
||||
+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1011,7 +1011,7 @@ public class WorldServer extends World {
|
||||
{
|
||||
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
|
||||
{
|
||||
- ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory();
|
||||
+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index 9b19dce9bd..cb7697f80b 100644
|
||||
index 6478d6126..356c503dd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -513,8 +513,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
@@ -567,8 +567,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
}
|
||||
|
||||
public void closeInventory() {
|
||||
@ -155,10 +155,10 @@ index 9b19dce9bd..cb7697f80b 100644
|
||||
public boolean isBlocking() {
|
||||
return getHandle().isBlocking();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 62235efde9..47426d8fda 100644
|
||||
index 01e260024..6ceb02200 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -743,7 +743,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -769,7 +769,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
// Close any foreign inventory
|
||||
if (getHandle().activeContainer != getHandle().defaultContainer) {
|
||||
@ -168,10 +168,10 @@ index 62235efde9..47426d8fda 100644
|
||||
|
||||
// Check if the fromWorld and toWorld are the same.
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index acc80d0684..2cfe8afe13 100644
|
||||
index 4a16f2f53..de081ca1c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1110,8 +1110,19 @@ public class CraftEventFactory {
|
||||
@@ -1225,8 +1225,19 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 9c190db2972a8f21254928867c46fb46f765ea81 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 03:39:51 -0400
|
||||
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
|
||||
|
||||
In many places where we simply want the current chunk the entity
|
||||
is in, instead of doing a hashmap lookup for it, we now have access
|
||||
to the object directly on the Entity/TileEntity object we can directly grab.
|
||||
|
||||
Use that local value instead to reduce lookups in many hot places.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3737fca81..6bd181565 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -759,7 +759,8 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
if (!tileentity.isRemoved() && tileentity.hasWorld()) {
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
- if (this.isLoaded(blockposition) && this.getWorldBorder().a(blockposition)) {
|
||||
+ Chunk currentChunk = tileentity.getCurrentChunk(); // Paper
|
||||
+ if (currentChunk != null && this.getWorldBorder().a(blockposition)) { // Paper
|
||||
try {
|
||||
gameprofilerfiller.a(() -> {
|
||||
return String.valueOf(TileEntityTypes.a(tileentity.q()));
|
||||
@@ -793,7 +794,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
// Spigot end
|
||||
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
- if (this.isLoaded(tileentity.getPosition())) {
|
||||
+ if (tileentity.getCurrentChunk() != null ) { // Paper - avoid lookups
|
||||
this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition());
|
||||
}
|
||||
}
|
||||
@@ -814,8 +815,9 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
- if (this.isLoaded(tileentity1.getPosition())) {
|
||||
- Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
+ Chunk chunk = tileentity1.getCurrentChunk(); // Paper
|
||||
+ if (chunk != null) { // Paper
|
||||
+ //Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); // Paper
|
||||
IBlockData iblockdata = chunk.getType(tileentity1.getPosition());
|
||||
|
||||
chunk.setTileEntity(tileentity1.getPosition(), tileentity1);
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 79be8cfa3..af62ab182 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -1068,7 +1068,7 @@ public class WorldServer extends World {
|
||||
}
|
||||
|
||||
this.entitiesByUUID.remove(entity.getUniqueID());
|
||||
- this.getChunkProvider().removeEntity(entity);
|
||||
+ if (entity.getCurrentChunk() != null ) this.getChunkProvider().removeEntity(entity); // Paper
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
@@ -1122,9 +1122,12 @@ public class WorldServer extends World {
|
||||
}
|
||||
|
||||
private void removeEntityFromChunk(Entity entity) {
|
||||
- IChunkAccess ichunkaccess = this.getChunkAt(entity.chunkX, entity.chunkZ, ChunkStatus.FULL, false);
|
||||
+ // Paper start
|
||||
+ if (!entity.inChunk) return;
|
||||
+ IChunkAccess ichunkaccess = this.getChunkIfLoaded(entity.chunkX, entity.chunkZ);
|
||||
+ // Paper start
|
||||
|
||||
- if (ichunkaccess instanceof Chunk) {
|
||||
+ if (ichunkaccess != null) {
|
||||
((Chunk) ichunkaccess).b(entity);
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
105
Spigot-Server-Patches/0251-Configurable-Bed-Search-Radius.patch
Normale Datei
105
Spigot-Server-Patches/0251-Configurable-Bed-Search-Radius.patch
Normale Datei
@ -0,0 +1,105 @@
|
||||
From 123cf353a72db41320695ad0ca68af2be035beb5 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 15:22:06 -0400
|
||||
Subject: [PATCH] Configurable Bed Search Radius
|
||||
|
||||
Allows you to increase how far to check for a safe place to respawn
|
||||
a player near their bed, allowing a better chance to respawn the
|
||||
player at their bed should it of became obstructed.
|
||||
|
||||
Defaults to vanilla 1.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 3294fbbea..83e54cb90 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -375,4 +375,15 @@ public class PaperWorldConfig {
|
||||
private void scanForLegacyEnderDragon() {
|
||||
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
|
||||
}
|
||||
+
|
||||
+ public int bedSearchRadius = 1;
|
||||
+ private void bedSearchRadius() {
|
||||
+ bedSearchRadius = getInt("bed-search-radius", 1);
|
||||
+ if (bedSearchRadius < 1) {
|
||||
+ bedSearchRadius = 1;
|
||||
+ }
|
||||
+ if (bedSearchRadius > 1) {
|
||||
+ log("Bed Search Radius: " + bedSearchRadius);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
|
||||
index 2a451025f..75331c986 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockBed.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockBed.java
|
||||
@@ -171,6 +171,58 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
||||
|
||||
public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) {
|
||||
EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING);
|
||||
+ // Paper - configurable bed search radius
|
||||
+ World world = (World) iworldreader;
|
||||
+ int radius = world.paperConfig.bedSearchRadius;
|
||||
+ if (radius > 0) {
|
||||
+ for (int r = 1; r <= radius; r++) {
|
||||
+ int x = -r;
|
||||
+ int z = r;
|
||||
+
|
||||
+ // Iterates the edge of half of the box; then negates for other half.
|
||||
+ while (x <= r && z > -r) {
|
||||
+ for (int y = -1; y <= 1; y++) {
|
||||
+ BlockPosition pos = blockposition.add(x, y, z);
|
||||
+ Optional<Vec3D> vector;
|
||||
+ vector = isSafeRespawn(entitytypes, world, pos);
|
||||
+ if (vector.isPresent()) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return vector;
|
||||
+ }
|
||||
+ }
|
||||
+ pos = blockposition.add(-x, y, -z);
|
||||
+ vector = isSafeRespawn(entitytypes, world, pos);
|
||||
+ if (vector.isPresent()) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return vector;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ vector = isSafeRespawn(entitytypes, world, pos);
|
||||
+ if (vector.isPresent()) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return vector;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ vector = isSafeRespawn(entitytypes, world, pos);
|
||||
+ if (vector.isPresent()) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return vector;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (x < r) {
|
||||
+ x++;
|
||||
+ } else {
|
||||
+ z--;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ // Paper end
|
||||
int j = blockposition.getX();
|
||||
int k = blockposition.getY();
|
||||
int l = blockposition.getZ();
|
||||
@@ -200,6 +252,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
+ protected static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entityTypes, IWorldReader iworldreader, BlockPosition blockPosition) { return a(entityTypes, iworldreader, blockPosition); } // Paper -- obfhelper
|
||||
protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
|
||||
VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition);
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 21a3bb2c4364a30d0d8a1596884bbfe151c22e1f Mon Sep 17 00:00:00 2001
|
||||
From 0c4b39af55f46555a3913eaef96d6ea0e2afc844 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 15:30:22 -0400
|
||||
Subject: [PATCH] Vex#getSummoner API
|
||||
@ -6,19 +6,19 @@ Subject: [PATCH] Vex#getSummoner API
|
||||
Get's the NPC that summoned this Vex
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java
|
||||
index 388d341262..c3864b869e 100644
|
||||
index ecfc057a1..83e022c91 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVex.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVex.java
|
||||
@@ -86,6 +86,7 @@ public class EntityVex extends EntityMonster {
|
||||
@@ -92,6 +92,7 @@ public class EntityVex extends EntityMonster {
|
||||
|
||||
}
|
||||
|
||||
+ public EntityInsentient getOwner() { return l(); } // Paper - OBFHELPER
|
||||
public EntityInsentient l() {
|
||||
return this.b;
|
||||
return this.c;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
||||
index 0f01fc591d..c96a5df80a 100644
|
||||
index 737a37b6f..169c951ec 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
||||
@@ -1,8 +1,10 @@
|
@ -1,4 +1,4 @@
|
||||
From 831e570a9d59d466810523e85b1fa31867af7cf2 Mon Sep 17 00:00:00 2001
|
||||
From 288ab6704822a825fba34d1d9d44fdb44d12f5df Mon Sep 17 00:00:00 2001
|
||||
From: Minecrell <minecrell@minecrell.net>
|
||||
Date: Fri, 13 Jul 2018 14:54:43 +0200
|
||||
Subject: [PATCH] Refresh player inventory when cancelling
|
||||
@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
|
||||
cancelled to avoid this problem.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 0b5dc66897..6d04c5733c 100644
|
||||
index fbdc755e8..a0f6addef 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1916,6 +1916,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -1964,6 +1964,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
@ -0,0 +1,22 @@
|
||||
From a0ac76e611c316afe5b54e884aa833f58380a427 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:05:00 -0400
|
||||
Subject: [PATCH] Don't change the Entity Random seed for squids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
index d5dff4b88..77c0ed42f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
@@ -19,7 +19,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
|
||||
public EntitySquid(EntityTypes<? extends EntitySquid> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
- this.random.setSeed((long) this.getId());
|
||||
+ //this.random.setSeed((long) this.getId()); // Paper
|
||||
this.bF = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,26 @@
|
||||
From b92318c67ab59e8e299a7a1a8908bf62cee0c69e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:08:05 -0400
|
||||
Subject: [PATCH] Re-add vanilla entity warnings for duplicates
|
||||
|
||||
These are a critical sign that somethin went wrong, and you've lost some data....
|
||||
|
||||
We should kind of know about these things you know.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index af62ab182..0b4990a00 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -973,7 +973,8 @@ public class WorldServer extends World {
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
- // WorldServer.LOGGER.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit
|
||||
+ WorldServer.LOGGER.error("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit // paper
|
||||
+ WorldServer.LOGGER.error("Deleting duplicate entity {}", entity); // CraftBukkit // paper
|
||||
return true;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,24 +1,24 @@
|
||||
From 04e89bbfc9881b015778fc6e3916d3df9274d0bb Mon Sep 17 00:00:00 2001
|
||||
From d8d88222f6045eb3afdb50a693eec564b1825252 Mon Sep 17 00:00:00 2001
|
||||
From: Hugo Manrique <hugmanrique@gmail.com>
|
||||
Date: Mon, 16 Jul 2018 12:42:20 +0200
|
||||
Subject: [PATCH] Avoid item merge if stack size above max stack size
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index e9986420c2..c9473087ad 100644
|
||||
index c582c6711..c5fefa060 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -173,6 +173,10 @@ public class EntityItem extends Entity {
|
||||
@@ -166,6 +166,10 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
private void v() {
|
||||
private void mergeNearby() {
|
||||
+ // Paper start - avoid item merge if stack size above max stack size
|
||||
+ ItemStack stack = getItemStack();
|
||||
+ if (stack.getCount() >= stack.getMaxStackSize()) return;
|
||||
+ // Paper end
|
||||
// Spigot start
|
||||
double radius = world.spigotConfig.itemMerge;
|
||||
Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator();
|
||||
List<EntityItem> list = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius), (entityitem) -> {
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 82e41eb16264f724aa8745bc2ab2b2f0a50e94e8 Mon Sep 17 00:00:00 2001
|
||||
From aef479838d337b9eb508d751c6544760f5001d1c Mon Sep 17 00:00:00 2001
|
||||
From: Minecrell <minecrell@minecrell.net>
|
||||
Date: Tue, 17 Jul 2018 16:42:17 +0200
|
||||
Subject: [PATCH] Use asynchronous Log4j 2 loggers
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 3ad5af3463..9cbd4880f7 100644
|
||||
index 16799b4cd..8c18a0c09 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -74,6 +74,13 @@
|
||||
@ -24,7 +24,7 @@ index 3ad5af3463..9cbd4880f7 100644
|
||||
<artifactId>asm</artifactId>
|
||||
diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties
|
||||
new file mode 100644
|
||||
index 0000000000..ee7c90784c
|
||||
index 000000000..ee7c90784
|
||||
--- /dev/null
|
||||
+++ b/src/main/resources/log4j2.component.properties
|
||||
@@ -0,0 +1 @@
|
@ -1,4 +1,4 @@
|
||||
From 2f51486373507742b96ba70777b50ad07388317c Mon Sep 17 00:00:00 2001
|
||||
From 07e48b2c5dbbf935e62fd18340ec507326878d8f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:13:28 -0400
|
||||
Subject: [PATCH] add more information to Entity.toString()
|
||||
@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
|
||||
UUID, ticks lived, valid, dead
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index debab1a715..69a058d830 100644
|
||||
index c28b498a2..c7d19d957 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2514,7 +2514,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -2423,7 +2423,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
public String toString() {
|
@ -0,0 +1,88 @@
|
||||
From a862de455ad3f18990ad3c2debc852ca691c4857 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 21 Jul 2018 08:25:40 -0400
|
||||
Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
|
||||
|
||||
Add -Ddebug.entities=true to your JVM flags to gain more information
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index c7d19d957..8dd589aae 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -72,6 +72,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
||||
protected CraftEntity bukkitEntity;
|
||||
|
||||
+ EntityTrackerEntry tracker; // Paper
|
||||
+ Throwable addedToWorldStack; // Paper - entity debug
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (bukkitEntity == null) {
|
||||
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 6bd181565..f9f0a94e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -68,6 +68,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
public boolean pvpMode;
|
||||
public boolean keepSpawnInMemory = true;
|
||||
public org.bukkit.generator.ChunkGenerator generator;
|
||||
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
|
||||
|
||||
public boolean captureBlockStates = false;
|
||||
public boolean captureTreeGeneration = false;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 0b4990a00..3e41c080d 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -77,6 +77,9 @@ public class WorldServer extends World {
|
||||
public final DimensionManager dimension;
|
||||
private int tickPosition;
|
||||
boolean hasPhysicsEvent = true; // Paper
|
||||
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
+ }
|
||||
|
||||
// Add env and gen to constructor
|
||||
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||
@@ -937,6 +940,12 @@ public class WorldServer extends World {
|
||||
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
|
||||
if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
|
||||
if (entity.dead) {
|
||||
+ // Paper start
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ new Throwable("Tried to add entity " + entity + " but it was marked as removed already").printStackTrace(); // CraftBukkit
|
||||
+ getAddToWorldStackTrace(entity).printStackTrace();
|
||||
+ }
|
||||
+ // Paper end
|
||||
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
||||
} else if (this.isUUIDTaken(entity)) {
|
||||
@@ -1099,7 +1108,24 @@ public class WorldServer extends World {
|
||||
}
|
||||
}
|
||||
|
||||
- this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ entity.addedToWorldStack = getAddToWorldStackTrace(entity);
|
||||
+ }
|
||||
+
|
||||
+ Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
+ if (old != null && old.getId() != entity.getId() && old.valid) {
|
||||
+ Logger logger = LogManager.getLogger();
|
||||
+ logger.error("Overwrote an existing entity " + old + " with " + entity);
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ if (old.addedToWorldStack != null) {
|
||||
+ old.addedToWorldStack.printStackTrace();
|
||||
+ } else {
|
||||
+ logger.error("Oddly, the old entity was not added to the world in the normal way. Plugins?");
|
||||
+ }
|
||||
+ entity.addedToWorldStack.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
this.getChunkProvider().addEntity(entity);
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.I.add(((EntityInsentient) entity).getNavigation());
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,16 +1,16 @@
|
||||
From 807b6b37d1576b5cf82fb5c8a9423c69647fca98 Mon Sep 17 00:00:00 2001
|
||||
From e572a4cfb10329466bb5f5fa0a7dc4c55c168796 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 21 Jul 2018 01:51:27 -0500
|
||||
Subject: [PATCH] EnderDragon Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
|
||||
index 1906bcfc96..50d291139c 100644
|
||||
index 4ab310cd6..90f6d58dd 100644
|
||||
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
|
||||
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
|
||||
@@ -63,7 +63,9 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
|
||||
@@ -65,7 +65,9 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
|
||||
this.d.setDuration(200);
|
||||
this.d.setParticle(Particles.j);
|
||||
this.d.setParticle(Particles.DRAGON_BREATH);
|
||||
this.d.a(new MobEffect(MobEffects.HARM));
|
||||
+ if (new com.destroystokyo.paper.event.entity.EnderDragonFlameEvent((org.bukkit.entity.EnderDragon) this.a.getBukkitEntity(), (org.bukkit.entity.AreaEffectCloud) this.d.getBukkitEntity()).callEvent()) // Paper
|
||||
this.a.world.addEntity(this.d);
|
||||
@ -18,19 +18,20 @@ index 1906bcfc96..50d291139c 100644
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,6 +75,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
|
||||
@@ -76,6 +78,8 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
|
||||
++this.c;
|
||||
}
|
||||
|
||||
+
|
||||
+ public void removeAreaEffect() { this.e(); } // Paper - OBFHELPER
|
||||
@Override
|
||||
public void e() {
|
||||
if (this.d != null) {
|
||||
this.d.die();
|
||||
diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
|
||||
index e742586765..141ba1e5e6 100644
|
||||
index b46660576..bf15964e7 100644
|
||||
--- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java
|
||||
+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
|
||||
@@ -67,7 +67,9 @@ public class DragonControllerStrafe extends AbstractDragonController {
|
||||
@@ -68,7 +68,9 @@ public class DragonControllerStrafe extends AbstractDragonController {
|
||||
EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11);
|
||||
|
||||
entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F);
|
||||
@ -41,10 +42,10 @@ index e742586765..141ba1e5e6 100644
|
||||
if (this.d != null) {
|
||||
while (!this.d.b()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
||||
index 7df8fd4d74..c0d66a0233 100644
|
||||
index 239be99c5..2195b83ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
||||
@@ -39,8 +39,10 @@ public class EntityDragonFireball extends EntityFireball {
|
||||
@@ -40,8 +40,10 @@ public class EntityDragonFireball extends EntityFireball {
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,19 @@
|
||||
From df3cc340d9321a3ffd4b9d60edce8159c44f749d Mon Sep 17 00:00:00 2001
|
||||
From 142259f15f4baeeb62a3e50a16feeea0ab76f918 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 21 Jul 2018 01:59:59 -0500
|
||||
Subject: [PATCH] PlayerElytraBoostEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
index dbb422e9da..13938775ba 100644
|
||||
index aea46ffae..9e86ef4ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
@@ -33,9 +33,15 @@ public class ItemFireworks extends Item {
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
|
||||
entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper
|
||||
|
||||
@@ -35,11 +35,16 @@ public class ItemFireworks extends Item {
|
||||
// Paper start
|
||||
final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
|
||||
entityfireworks.spawningEntity = entityhuman.getUniqueID();
|
||||
- world.addEntity(entityfireworks);
|
||||
- // Paper end
|
||||
- if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
- itemstack.subtract(1);
|
||||
+ // Paper start
|
||||
@ -23,10 +24,11 @@ index dbb422e9da..13938775ba 100644
|
||||
+ } else ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ } else if (entityhuman instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
}
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, entityhuman.b(enumhand));
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,14 +1,14 @@
|
||||
From a247cf802ea037f8e9df044e64fddc17ed3a43ef Mon Sep 17 00:00:00 2001
|
||||
From 63edfb2b28cc8754bf733769d831ddcaec199744 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 21 Jul 2018 03:11:03 -0500
|
||||
Subject: [PATCH] PlayerLaunchProjectileEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java
|
||||
index 18e8825c48..5f3926d830 100644
|
||||
index 2bdb65bf8..f526af45f 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemEgg.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemEgg.java
|
||||
@@ -9,16 +9,34 @@ public class ItemEgg extends Item {
|
||||
@@ -10,17 +10,35 @@ public class ItemEgg extends Item {
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
@ -22,6 +22,7 @@ index 18e8825c48..5f3926d830 100644
|
||||
if (!world.isClientSide) {
|
||||
EntityEgg entityegg = new EntityEgg(world, entityhuman);
|
||||
|
||||
entityegg.setItem(itemstack);
|
||||
entityegg.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
||||
- world.addEntity(entityegg);
|
||||
+ // Paper start
|
||||
@ -45,12 +46,12 @@ index 18e8825c48..5f3926d830 100644
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemEnderPearl.java b/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
||||
index 3672996c2d..719210da15 100644
|
||||
index eb5f62dec..e8e52d726 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
||||
@@ -14,7 +14,19 @@ public class ItemEnderPearl extends Item {
|
||||
EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, entityhuman);
|
||||
@@ -16,7 +16,19 @@ public class ItemEnderPearl extends Item {
|
||||
|
||||
entityenderpearl.setItem(itemstack);
|
||||
entityenderpearl.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
||||
- if (!world.addEntity(entityenderpearl)) {
|
||||
+ // Paper start
|
||||
@ -69,7 +70,7 @@ index 3672996c2d..719210da15 100644
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
}
|
||||
@@ -22,13 +34,15 @@ public class ItemEnderPearl extends Item {
|
||||
@@ -24,13 +36,15 @@ public class ItemEnderPearl extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,11 +94,11 @@ index 3672996c2d..719210da15 100644
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, itemstack);
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java
|
||||
index d26b42f710..23b06169e2 100644
|
||||
index 35f842ede..eb626a6f0 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemExpBottle.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemExpBottle.java
|
||||
@@ -8,17 +8,34 @@ public class ItemExpBottle extends Item {
|
||||
|
||||
@@ -9,18 +9,35 @@ public class ItemExpBottle extends Item {
|
||||
@Override
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
-
|
||||
@ -111,6 +112,7 @@ index d26b42f710..23b06169e2 100644
|
||||
if (!world.isClientSide) {
|
||||
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, entityhuman);
|
||||
|
||||
entitythrownexpbottle.setItem(itemstack);
|
||||
entitythrownexpbottle.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.7F, 1.0F);
|
||||
- world.addEntity(entitythrownexpbottle);
|
||||
+ // Paper start
|
||||
@ -134,11 +136,11 @@ index d26b42f710..23b06169e2 100644
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
||||
index a74c803e72..8d882b81bb 100644
|
||||
index e3683bdae..f3ad1cd6d 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
||||
@@ -8,14 +8,38 @@ public class ItemLingeringPotion extends ItemPotion {
|
||||
|
||||
@@ -9,15 +9,40 @@ public class ItemLingeringPotion extends ItemPotion {
|
||||
@Override
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
+ /* // Paper start
|
||||
@ -147,14 +149,16 @@ index a74c803e72..8d882b81bb 100644
|
||||
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F));
|
||||
+ */ // Paper end
|
||||
if (!world.isClientSide) {
|
||||
+
|
||||
+ // Paper start - ensure stack count matches vanilla behavior without modifying original stack yet
|
||||
+ ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack1.setCount(1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
EntityPotion entitypotion = new EntityPotion(world, entityhuman, itemstack1);
|
||||
EntityPotion entitypotion = new EntityPotion(world, entityhuman);
|
||||
|
||||
entitypotion.setItem(itemstack1);
|
||||
entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F);
|
||||
- world.addEntity(entitypotion);
|
||||
+ // Paper start
|
||||
@ -178,12 +182,12 @@ index a74c803e72..8d882b81bb 100644
|
||||
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemSnowball.java b/src/main/java/net/minecraft/server/ItemSnowball.java
|
||||
index d8879e0847..95194ccdc8 100644
|
||||
index 624989dd7..c119785b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemSnowball.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemSnowball.java
|
||||
@@ -21,15 +21,23 @@ public class ItemSnowball extends Item {
|
||||
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
|
||||
@@ -23,15 +23,23 @@ public class ItemSnowball extends Item {
|
||||
|
||||
entitysnowball.setItem(itemstack);
|
||||
entitysnowball.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
||||
- if (world.addEntity(entitysnowball)) {
|
||||
- if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
@ -211,11 +215,11 @@ index d8879e0847..95194ccdc8 100644
|
||||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
||||
index 87e2825a84..2bddefb802 100644
|
||||
index e267e43fe..fa6d627db 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
||||
@@ -8,14 +8,38 @@ public class ItemSplashPotion extends ItemPotion {
|
||||
|
||||
@@ -9,15 +9,39 @@ public class ItemSplashPotion extends ItemPotion {
|
||||
@Override
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
+ /* // Paper start
|
||||
@ -224,14 +228,15 @@ index 87e2825a84..2bddefb802 100644
|
||||
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F));
|
||||
+ */ // Paper end
|
||||
if (!world.isClientSide) {
|
||||
EntityPotion entitypotion = new EntityPotion(world, entityhuman);
|
||||
+ // Paper start - ensure stack count matches vanilla behavior without modifying original stack yet
|
||||
+ ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack1.setCount(1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
EntityPotion entitypotion = new EntityPotion(world, entityhuman, itemstack1);
|
||||
|
||||
entitypotion.setItem(itemstack1);
|
||||
entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F);
|
||||
- world.addEntity(entitypotion);
|
||||
+ // Paper start
|
@ -1,4 +1,4 @@
|
||||
From a37310c6dad755affd1bf6e87c34649cc598b732 Mon Sep 17 00:00:00 2001
|
||||
From 44546c450aad2cfac08a12d27bf967dd28e0eaba Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Wed, 30 Nov 2016 20:56:58 -0600
|
||||
Subject: [PATCH] Speedup BlockPos by fixing inlining
|
||||
@ -21,7 +21,7 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt
|
||||
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index 4c7793f86d..cc17a414f5 100644
|
||||
index 7cb46d7a9..e96428bb2 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -7,22 +7,22 @@ import javax.annotation.concurrent.Immutable;
|
||||
@ -55,7 +55,7 @@ index 4c7793f86d..cc17a414f5 100644
|
||||
}
|
||||
|
||||
public BaseBlockPosition(double d0, double d1, double d2) {
|
||||
@@ -49,17 +49,19 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
@@ -49,24 +49,26 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
}
|
||||
|
||||
@ -79,40 +79,32 @@ index 4c7793f86d..cc17a414f5 100644
|
||||
|
||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
||||
return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 80e13dfb2e..20cf9255ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -202,18 +202,18 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
if (this.g == null) {
|
||||
this.g = new BlockPosition.MutableBlockPosition(i, j, k);
|
||||
return this.g;
|
||||
- } else if (this.g.b == l && this.g.c == i1 && this.g.d == j1) {
|
||||
+ } else if (this.g.x == l && this.g.y == i1 && this.g.z == j1) {
|
||||
return (BlockPosition.MutableBlockPosition) this.endOfData();
|
||||
} else {
|
||||
- if (this.g.b < l) {
|
||||
- ++this.g.b;
|
||||
- } else if (this.g.c < i1) {
|
||||
- this.g.b = i; // Paper - decompile fix Readd line removed by the decompiler
|
||||
- ++this.g.c;
|
||||
- } else if (this.g.d < j1) {
|
||||
- this.g.b = i; // Paper - decompile fix Readd line removed by the decompiler
|
||||
- this.g.c = j; // Paper - decompile fix Readd line removed by the decompiler
|
||||
- ++this.g.d;
|
||||
+ if (this.g.x < l) {
|
||||
+ ++this.g.x;
|
||||
+ } else if (this.g.y < i1) {
|
||||
+ this.g.x = i; // Paper - decompile fix Readd line removed by the decompiler
|
||||
+ ++this.g.y;
|
||||
+ } else if (this.g.z < j1) {
|
||||
+ this.g.x = i; // Paper - decompile fix Readd line removed by the decompiler
|
||||
+ this.g.y = j; // Paper - decompile fix Readd line removed by the decompiler
|
||||
+ ++this.g.z;
|
||||
}
|
||||
|
||||
return this.g;
|
||||
@@ -296,11 +296,12 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
public boolean a(BaseBlockPosition baseblockposition, double d0) {
|
||||
- return this.distanceSquared((double) baseblockposition.a, (double) baseblockposition.b, (double) baseblockposition.c, false) < d0 * d0;
|
||||
+ return this.distanceSquared((double) baseblockposition.x, (double) baseblockposition.y, (double) baseblockposition.z, false) < d0 * d0; // Paper
|
||||
}
|
||||
|
||||
public boolean a(IPosition iposition, double d0) {
|
||||
@@ -91,9 +93,9 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
}
|
||||
|
||||
public int n(BaseBlockPosition baseblockposition) {
|
||||
- float f = (float) Math.abs(baseblockposition.getX() - this.a);
|
||||
- float f1 = (float) Math.abs(baseblockposition.getY() - this.b);
|
||||
- float f2 = (float) Math.abs(baseblockposition.getZ() - this.c);
|
||||
+ float f = (float) Math.abs(baseblockposition.getX() - this.x); // Paper
|
||||
+ float f1 = (float) Math.abs(baseblockposition.getY() - this.y); // Paper
|
||||
+ float f2 = (float) Math.abs(baseblockposition.getZ() - this.z); // Paper
|
||||
|
||||
return (int) (f + f1 + f2);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 64700b97c..a5e5a4eba 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -335,11 +335,12 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public static class MutableBlockPosition extends BlockPosition {
|
||||
@ -127,7 +119,7 @@ index 80e13dfb2e..20cf9255ba 100644
|
||||
@Override
|
||||
public boolean isValidLocation() {
|
||||
return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256;
|
||||
@@ -309,6 +310,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
@@ -348,6 +349,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
public boolean isInvalidYLocation() {
|
||||
return c < 0 || c >= 256;
|
||||
}
|
||||
@ -135,7 +127,7 @@ index 80e13dfb2e..20cf9255ba 100644
|
||||
// Paper end
|
||||
|
||||
public MutableBlockPosition() {
|
||||
@@ -320,10 +322,13 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
@@ -359,10 +361,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public MutableBlockPosition(int i, int j, int k) {
|
||||
@ -150,26 +142,27 @@ index 80e13dfb2e..20cf9255ba 100644
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public BlockPosition a(double d0, double d1, double d2) {
|
||||
@@ -342,6 +347,8 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
return super.a(enumblockrotation).h();
|
||||
public MutableBlockPosition(double d0, double d1, double d2) {
|
||||
@@ -389,6 +394,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
return super.a(enumblockrotation).immutableCopy();
|
||||
}
|
||||
|
||||
+
|
||||
+ /*
|
||||
+ // Paper start - use parent getters
|
||||
@Override
|
||||
public int getX() {
|
||||
return this.b;
|
||||
}
|
||||
@@ -352,13 +359,16 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
||||
@@ -402,13 +410,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
@Override
|
||||
public int getZ() {
|
||||
return this.d;
|
||||
- }
|
||||
+ }*/
|
||||
+ // Paper end
|
||||
|
||||
public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return c(i, j, k);} // Paper - OBFHELPER
|
||||
public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
|
||||
public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
|
||||
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
|
||||
- this.b = i;
|
||||
- this.c = j;
|
||||
- this.d = k;
|
||||
@ -181,17 +174,17 @@ index 80e13dfb2e..20cf9255ba 100644
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -376,15 +386,15 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
@@ -438,15 +449,15 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
|
||||
- return this.c(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i);
|
||||
+ return this.c(x + enumdirection.getAdjacentX() * i, y + enumdirection.getAdjacentY() * i, z + enumdirection.getAdjacentZ() * i); // Paper - use xyz
|
||||
- return this.d(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i);
|
||||
+ return this.d(this.x + enumdirection.getAdjacentX() * i, this.y + enumdirection.getAdjacentY() * i, this.z + enumdirection.getAdjacentZ() * i);
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
|
||||
- return this.c(this.b + i, this.c + j, this.d + k);
|
||||
+ return this.c(x + i, y + j, z + k); // Paper - use xyz
|
||||
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
|
||||
- return this.d(this.b + i, this.c + j, this.d + k);
|
||||
+ return this.d(this.x + i, this.y + j, this.z + k);
|
||||
}
|
||||
|
||||
public void p(int i) {
|
||||
@ -199,7 +192,7 @@ index 80e13dfb2e..20cf9255ba 100644
|
||||
+ this.y = i; // Paper change to y
|
||||
}
|
||||
|
||||
public BlockPosition toBlockPosition() { return h(); } // Paper - OBFHELPER
|
||||
@Override
|
||||
--
|
||||
2.21.0
|
||||
|
24
Spigot-Server-Patches/0264-Don-t-save-Proto-Chunks.patch
Normale Datei
24
Spigot-Server-Patches/0264-Don-t-save-Proto-Chunks.patch
Normale Datei
@ -0,0 +1,24 @@
|
||||
From f29752f88bfc321f53e982778b9fa3004aaeca8b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 22 Jul 2018 21:21:41 -0400
|
||||
Subject: [PATCH] Don't save Proto Chunks
|
||||
|
||||
These chunks are unfinished, and waste cpu time saving these unfinished chunks.
|
||||
the loadChunk method refuses to acknoledge they exists, and will restart
|
||||
a new chunk generation process to begin with, so saving them serves no benefit.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 3fab45aa9..26fd5dd1e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -614,6 +614,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
}
|
||||
|
||||
public void saveChunk(IChunkAccess ichunkaccess, boolean save) {
|
||||
+ if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.PROTOCHUNK) { return; } // Paper - don't save proto chunks
|
||||
// CraftBukkit end
|
||||
this.n.a(ichunkaccess.getPos());
|
||||
if (save) { // CraftBukkit
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,108 +0,0 @@
|
||||
From ca534128e22e65b35817572014741051107a190f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 15 Jun 2018 00:30:32 -0400
|
||||
Subject: [PATCH] Configurable Alternative LootPool Luck Formula
|
||||
|
||||
Rewrites the Vanilla luck application formula so that luck can be
|
||||
applied to items that do not have any quality defined.
|
||||
|
||||
See: https://luckformula.emc.gs for data and details
|
||||
-----------
|
||||
|
||||
The rough summary is:
|
||||
My goal was that in a pool, when luck was applied, the pool
|
||||
rebalances so the percentages for bigger items is
|
||||
lowered and smaller items is boosted.
|
||||
|
||||
Do this by boosting and then reducing the weight value,
|
||||
so that larger numbers are penalized more than smaller numbers.
|
||||
resulting in a larger reduction of entries for more common
|
||||
items than the reduction on small weights,
|
||||
giving smaller weights more of a chance
|
||||
|
||||
-----------
|
||||
|
||||
This work kind of obsoletes quality, but quality would be useful
|
||||
for 2 items with same weight that you want luck to impact
|
||||
in varying directions.
|
||||
|
||||
Fishing still falls into that as the weights are closer, so luck
|
||||
will invalidate junk more.
|
||||
|
||||
This change will result in some major changes to fishing formulas.
|
||||
|
||||
-----------
|
||||
|
||||
I would love to see this change in Vanilla, so Mojang please pull :)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index b85cd10437..d42853d14c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -300,4 +300,12 @@ public class PaperConfig {
|
||||
"such as inventories, experience points, advancements and the like will not be saved when they log out.");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static boolean useAlternativeLuckFormula = false;
|
||||
+ private static void useAlternativeLuckFormula() {
|
||||
+ useAlternativeLuckFormula = getBoolean("settings.use-alternative-luck-formula", false);
|
||||
+ if (useAlternativeLuckFormula) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
index 3e313bba7c..80f9f9a252 100644
|
||||
--- a/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java
|
||||
@@ -14,8 +14,8 @@ import java.util.Random;
|
||||
|
||||
public abstract class LootSelectorEntry {
|
||||
|
||||
- protected final int c;
|
||||
- protected final int d;
|
||||
+ protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER
|
||||
+ protected final int d; public int getQuality() { return d; } // Paper - OBFHELPER
|
||||
protected final LootItemCondition[] e;
|
||||
|
||||
protected LootSelectorEntry(int i, int j, LootItemCondition[] alootitemcondition) {
|
||||
@@ -25,8 +25,34 @@ public abstract class LootSelectorEntry {
|
||||
}
|
||||
|
||||
public int a(float f) {
|
||||
- return Math.max(MathHelper.d((float) this.c + (float) this.d * f), 0);
|
||||
+ // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
|
||||
+ // SEE: https://luckformula.emc.gs for details and data
|
||||
+ if (lastLuck != null && lastLuck == f) {
|
||||
+ return lastWeight;
|
||||
+ }
|
||||
+ // This is vanilla
|
||||
+ float qualityModifer = (float) this.getQuality() * f;
|
||||
+ double baseWeight = (this.getWeight() + qualityModifer);
|
||||
+ if (com.destroystokyo.paper.PaperConfig.useAlternativeLuckFormula) {
|
||||
+ // Random boost to avoid losing precision in the final int cast on return
|
||||
+ final int weightBoost = 100;
|
||||
+ baseWeight *= weightBoost;
|
||||
+ // If we have vanilla 1, bump that down to 0 so nothing is is impacted
|
||||
+ // vanilla 3 = 300, 200 basis = impact 2%
|
||||
+ // =($B2*(($B2-100)/100/100))
|
||||
+ double impacted = baseWeight * ((baseWeight - weightBoost) / weightBoost / 100);
|
||||
+ // =($B$7/100)
|
||||
+ float luckModifier = Math.min(100, f * 10) / 100;
|
||||
+ // =B2 - (C2 *($B$7/100))
|
||||
+ baseWeight = Math.ceil(baseWeight - (impacted * luckModifier));
|
||||
+ }
|
||||
+ lastLuck = f;
|
||||
+ lastWeight = (int) Math.max(0, Math.floor(baseWeight));
|
||||
+ return lastWeight;
|
||||
}
|
||||
+ private Float lastLuck = null;
|
||||
+ private int lastWeight = 0;
|
||||
+ // Paper end
|
||||
|
||||
public abstract void a(Collection<ItemStack> collection, Random random, LootTableInfo loottableinfo);
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 82c0f3c7cdd722722ee6bfd3047ecc52fab78026 Mon Sep 17 00:00:00 2001
|
||||
From 6d8bc880e02369cc0c7c8db23895c3c8c3e1459b Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Steinborn <git@steinborn.me>
|
||||
Date: Mon, 23 Jul 2018 13:08:19 -0400
|
||||
Subject: [PATCH] Optimize RegistryID.c()
|
||||
@ -6,7 +6,7 @@ Subject: [PATCH] Optimize RegistryID.c()
|
||||
This is a frequent hotspot for world loading/saving.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
|
||||
index 5a5c464ea1..37641fa865 100644
|
||||
index e15d28671..e8a48b9a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegistryID.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegistryID.java
|
||||
@@ -14,12 +14,14 @@ public class RegistryID<K> implements Registry<K> {
|
||||
@ -24,7 +24,7 @@ index 5a5c464ea1..37641fa865 100644
|
||||
}
|
||||
|
||||
public int getId(@Nullable K k0) {
|
||||
@@ -43,9 +45,14 @@ public class RegistryID<K> implements Registry<K> {
|
||||
@@ -44,9 +46,14 @@ public class RegistryID<K> implements Registry<K> {
|
||||
}
|
||||
|
||||
private int c() {
|
||||
@ -39,7 +39,7 @@ index 5a5c464ea1..37641fa865 100644
|
||||
|
||||
return this.e;
|
||||
}
|
||||
@@ -59,6 +66,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
@@ -60,6 +67,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
this.d = (K[]) (new Object[i]); // Paper - decompile fix
|
||||
this.e = 0;
|
||||
this.f = 0;
|
||||
@ -47,7 +47,7 @@ index 5a5c464ea1..37641fa865 100644
|
||||
|
||||
for (int j = 0; j < ak.length; ++j) {
|
||||
if (ak[j] != null) {
|
||||
@@ -84,6 +92,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
@@ -85,6 +93,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
this.b[k] = k0;
|
||||
this.c[k] = i;
|
||||
this.d[i] = k0;
|
||||
@ -55,7 +55,7 @@ index 5a5c464ea1..37641fa865 100644
|
||||
++this.f;
|
||||
if (i == this.e) {
|
||||
++this.e;
|
||||
@@ -148,6 +157,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
@@ -149,6 +158,7 @@ public class RegistryID<K> implements Registry<K> {
|
||||
Arrays.fill(this.d, (Object) null);
|
||||
this.e = 0;
|
||||
this.f = 0;
|
@ -1,14 +1,14 @@
|
||||
From 6244aa55134ca674298f84bd72c07d62cc31a54d Mon Sep 17 00:00:00 2001
|
||||
From fb75e9482864768f1f26db3e016ac518ce57e478 Mon Sep 17 00:00:00 2001
|
||||
From: Hugo Manrique <hugmanrique@gmail.com>
|
||||
Date: Mon, 23 Jul 2018 12:57:39 +0200
|
||||
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 8c4ff18868..6c4cb61dc5 100644
|
||||
index 83e54cb90..f06bb3ae1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -375,6 +375,11 @@ public class PaperWorldConfig {
|
||||
@@ -326,6 +326,11 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ index 8c4ff18868..6c4cb61dc5 100644
|
||||
private void maxEntityCollision() {
|
||||
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index a5f4b9ad94..28fca165cd 100644
|
||||
index f9f0a94e9..79ded224c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1539,6 +1539,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
}
|
||||
@@ -866,6 +866,14 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
+ // Paper start - Prevent armor stands from doing entity lookups
|
@ -1,80 +0,0 @@
|
||||
From 279fcab87ebe9244d2907f4554af9cd125dcb293 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 18 Jun 2018 01:12:53 -0400
|
||||
Subject: [PATCH] PlayerReadyArrowEvent
|
||||
|
||||
Called when a player is firing a bow and the server is choosing an arrow to use.
|
||||
Plugins can skip selection of certain arrows and control which is used.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
index 52bc68e6a6..f8dbc3c400 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBow.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemBow.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+
|
||||
public class ItemBow extends Item {
|
||||
|
||||
public ItemBow(Item.Info item_info) {
|
||||
@@ -16,16 +18,16 @@ public class ItemBow extends Item {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- private ItemStack a(EntityHuman entityhuman) {
|
||||
- if (this.e_(entityhuman.b(EnumHand.OFF_HAND))) {
|
||||
+ private ItemStack a(EntityHuman entityhuman, ItemStack bow) { // Paper
|
||||
+ if (this.e_(entityhuman, bow, entityhuman.b(EnumHand.OFF_HAND))) { // Paper
|
||||
return entityhuman.b(EnumHand.OFF_HAND);
|
||||
- } else if (this.e_(entityhuman.b(EnumHand.MAIN_HAND))) {
|
||||
+ } else if (this.e_(entityhuman, bow, entityhuman.b(EnumHand.MAIN_HAND))) {
|
||||
return entityhuman.b(EnumHand.MAIN_HAND);
|
||||
} else {
|
||||
for (int i = 0; i < entityhuman.inventory.getSize(); ++i) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItem(i);
|
||||
|
||||
- if (this.e_(itemstack)) {
|
||||
+ if (this.e_(entityhuman, bow, itemstack)) {
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -34,15 +36,23 @@ public class ItemBow extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
- protected boolean e_(ItemStack itemstack) {
|
||||
- return itemstack.getItem() instanceof ItemArrow;
|
||||
+ // Paper start
|
||||
+ protected boolean e_(EntityHuman player, ItemStack bow, ItemStack itemstack) {
|
||||
+ return itemstack.getItem() instanceof ItemArrow && (
|
||||
+ !(player instanceof EntityPlayer) ||
|
||||
+ new com.destroystokyo.paper.event.player.PlayerReadyArrowEvent(
|
||||
+ ((EntityPlayer) player).getBukkitEntity(),
|
||||
+ CraftItemStack.asCraftMirror(bow),
|
||||
+ CraftItemStack.asCraftMirror(itemstack)
|
||||
+ ).callEvent());
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, World world, EntityLiving entityliving, int i) {
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
boolean flag = entityhuman.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_INFINITE, itemstack) > 0;
|
||||
- ItemStack itemstack1 = this.a(entityhuman);
|
||||
+ ItemStack itemstack1 = this.a(entityhuman, itemstack); // Paper
|
||||
|
||||
if (!itemstack1.isEmpty() || flag) {
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -141,7 +151,7 @@ public class ItemBow extends Item {
|
||||
|
||||
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
- boolean flag = !this.a(entityhuman).isEmpty();
|
||||
+ boolean flag = !this.a(entityhuman, itemstack).isEmpty(); // Paper
|
||||
|
||||
if (!entityhuman.abilities.canInstantlyBuild && !flag) {
|
||||
return flag ? new InteractionResultWrapper<>(EnumInteractionResult.PASS, itemstack) : new InteractionResultWrapper<>(EnumInteractionResult.FAIL, itemstack);
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,46 +0,0 @@
|
||||
From b554c6c2f5953c364a8872108a0f6fd331225c31 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:46:23 +0200
|
||||
Subject: [PATCH] Implement EntityKnockbackByEntityEvent
|
||||
|
||||
This event is called when an entity receives knockback by another entity.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index deb50b84f7..164e4b412a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1251,6 +1251,12 @@ public abstract class EntityLiving extends Entity {
|
||||
this.impulse = true;
|
||||
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
|
||||
|
||||
+ // Paper start - preserve old velocity
|
||||
+ double oldMotX = this.motX;
|
||||
+ double oldMotY = this.motY;
|
||||
+ double oldMotZ = this.motZ;
|
||||
+ // Paper end
|
||||
+
|
||||
this.motX /= 2.0D;
|
||||
this.motZ /= 2.0D;
|
||||
this.motX -= d0 / (double) f1 * (double) f;
|
||||
@@ -1263,6 +1269,18 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - call EntityKnockbackByEntityEvent
|
||||
+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(this.motX - oldMotX, this.motY - oldMotY, this.motZ - oldMotZ);
|
||||
+ // Restore old velocity to be able to access it in the event
|
||||
+ this.motX = oldMotX;
|
||||
+ this.motY = oldMotY;
|
||||
+ this.motZ = oldMotZ;
|
||||
+ if (entity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), entity.getBukkitEntity(), f, delta).callEvent()) {
|
||||
+ this.motX += delta.getX();
|
||||
+ this.motY += delta.getY();
|
||||
+ this.motZ += delta.getZ();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,79 +0,0 @@
|
||||
From bc5d4dcd27553b19ebbd6f37ba6281fc26c5f2be Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 03:39:51 -0400
|
||||
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
|
||||
|
||||
In many places where we simply want the current chunk the entity
|
||||
is in, instead of doing a hashmap lookup for it, we now have access
|
||||
to the object directly on the Entity/TileEntity object we can directly grab.
|
||||
|
||||
Use that local value instead to reduce lookups in many hot places.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d87b08a49e..c7712d2e71 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1110,9 +1110,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
int i = entity.chunkX;
|
||||
int j = entity.chunkZ;
|
||||
|
||||
- if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
|
||||
- this.getChunkAt(i, j).b(entity);
|
||||
- }
|
||||
+ Chunk chunk = entity.getCurrentChunk(); // Paper
|
||||
+ if (chunk != null) chunk.removeEntity(entity); // Paper
|
||||
|
||||
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
|
||||
int index = this.entityList.indexOf(entity);
|
||||
@@ -1196,9 +1195,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
int k = entity.chunkX;
|
||||
|
||||
j = entity.chunkZ;
|
||||
- if (entity.inChunk && this.isChunkLoaded(k, j, true)) {
|
||||
- this.getChunkAt(k, j).b(entity);
|
||||
- }
|
||||
+ Chunk chunk = entity.getCurrentChunk(); // Paper
|
||||
+ if (chunk != null) chunk.removeEntity(entity); // Paper
|
||||
//} // Paper - merge
|
||||
|
||||
//for (Entity e : this.g) { // Paper - merge
|
||||
@@ -1262,9 +1260,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
j = entity.chunkX;
|
||||
int l = entity.chunkZ;
|
||||
|
||||
- if (entity.inChunk && this.isChunkLoaded(j, l, true)) {
|
||||
- this.getChunkAt(j, l).b(entity);
|
||||
- }
|
||||
+ // Paper start
|
||||
+ Chunk chunk = entity.getCurrentChunk();
|
||||
+ if (chunk != null) chunk.removeEntity(entity);
|
||||
+ // Paper end
|
||||
|
||||
guardEntityList = false; // Spigot
|
||||
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
|
||||
@@ -1309,7 +1308,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
// Paper start - Skip ticking in chunks scheduled for unload
|
||||
- net.minecraft.server.Chunk chunk = this.getChunkIfLoaded(blockposition);
|
||||
+ net.minecraft.server.Chunk chunk = tileentity.getCurrentChunk();
|
||||
boolean shouldTick = chunk != null;
|
||||
if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
|
||||
shouldTick = shouldTick && chunk.scheduledForUnload == null;
|
||||
@@ -1345,8 +1344,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
tilesThisCycle--;
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
- if (this.isLoaded(tileentity.getPosition())) {
|
||||
- this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition());
|
||||
+ // Paper start
|
||||
+ net.minecraft.server.Chunk chunk = tileentity.getCurrentChunk();
|
||||
+ if (chunk != null) {
|
||||
+ chunk.removeTileEntity(tileentity.getPosition());
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,105 +0,0 @@
|
||||
From f1cf963f3f14757f6fb2f07fe26fdd50e8201883 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 15:22:06 -0400
|
||||
Subject: [PATCH] Configurable Bed Search Radius
|
||||
|
||||
Allows you to increase how far to check for a safe place to respawn
|
||||
a player near their bed, allowing a better chance to respawn the
|
||||
player at their bed should it of became obstructed.
|
||||
|
||||
Defaults to vanilla 1.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index aa2be2ede6..f5b2e88f3b 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -452,4 +452,15 @@ public class PaperWorldConfig {
|
||||
private void scanForLegacyEnderDragon() {
|
||||
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
|
||||
}
|
||||
+
|
||||
+ public int bedSearchRadius = 1;
|
||||
+ private void bedSearchRadius() {
|
||||
+ bedSearchRadius = getInt("bed-search-radius", 1);
|
||||
+ if (bedSearchRadius < 1) {
|
||||
+ bedSearchRadius = 1;
|
||||
+ }
|
||||
+ if (bedSearchRadius > 1) {
|
||||
+ log("Bed Search Radius: " + bedSearchRadius);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
|
||||
index 06f627002c..d81a2db6cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockBed.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockBed.java
|
||||
@@ -187,6 +187,52 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
||||
@Nullable
|
||||
public static BlockPosition a(IBlockAccess iblockaccess, BlockPosition blockposition, int i) {
|
||||
EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockBed.FACING);
|
||||
+ // Paper - replace whole method
|
||||
+ World world = (World) iblockaccess;
|
||||
+ int radius = world.paperConfig.bedSearchRadius;
|
||||
+ for (int r = 1; r <= radius; r++) {
|
||||
+ int x = -r;
|
||||
+ int z = r;
|
||||
+
|
||||
+ // Iterates the edge of half of the box; then negates for other half.
|
||||
+ while (x <= r && z > -r) {
|
||||
+ for (int y = -1; y <= 1; y++) {
|
||||
+ BlockPosition pos = blockposition.add(x, y, z);
|
||||
+ if (isSafeRespawn(world, pos)) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return pos;
|
||||
+ }
|
||||
+ }
|
||||
+ pos = blockposition.add(-x, y, -z);
|
||||
+ if (isSafeRespawn(world, pos)) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return pos;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pos = blockposition.add(enumdirection.getAdjacentX() + x, y, enumdirection.getAdjacentZ() + z);
|
||||
+ if (isSafeRespawn(world, pos)) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return pos;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pos = blockposition.add(enumdirection.getAdjacentX() - x, y, enumdirection.getAdjacentZ() - z);
|
||||
+ if (isSafeRespawn(world, pos)) {
|
||||
+ if (i-- <= 0) {
|
||||
+ return pos;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (x < r) {
|
||||
+ x++;
|
||||
+ } else {
|
||||
+ z--;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return null; /* // Paper comment out
|
||||
int j = blockposition.getX();
|
||||
int k = blockposition.getY();
|
||||
int l = blockposition.getZ();
|
||||
@@ -212,9 +258,12 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
|
||||
}
|
||||
}
|
||||
|
||||
- return null;
|
||||
+ return null;*/ // Paper
|
||||
}
|
||||
|
||||
+ protected static boolean isSafeRespawn(IBlockAccess iblockaccess, BlockPosition blockposition) { // Paper - OBFHELPER + behavior improvement
|
||||
+ return a(iblockaccess, blockposition) && iblockaccess.getType(blockposition.down()).getMaterial().isBuildable(); // Paper - ensure solid block
|
||||
+ }
|
||||
protected static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
return iblockaccess.getType(blockposition.down()).q() && !iblockaccess.getType(blockposition).getMaterial().isBuildable() && !iblockaccess.getType(blockposition.up()).getMaterial().isBuildable();
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,22 +0,0 @@
|
||||
From d4d2715633e038dca7705ed0ecbda6daff2dfae4 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:05:00 -0400
|
||||
Subject: [PATCH] Don't change the Entity Random seed for squids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
index b9c76325db..ab79317a2d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
@@ -22,7 +22,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
public EntitySquid(World world) {
|
||||
super(EntityTypes.SQUID, world);
|
||||
this.setSize(0.8F, 0.8F);
|
||||
- this.random.setSeed((long) (1 + this.getId()));
|
||||
+ //this.random.setSeed((long) (1 + this.getId())); // Paper
|
||||
this.bI = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,26 +0,0 @@
|
||||
From c0b99f356c30002ae8fb2536b5e0b78a7b8bfc4c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 19 Jul 2018 01:08:05 -0400
|
||||
Subject: [PATCH] Re-add vanilla entity warnings for duplicates
|
||||
|
||||
These are a critical sign that somethin went wrong, and you've lost some data....
|
||||
|
||||
We should kind of know about these things you know.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index c08ee62e84..85a30652c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -963,7 +963,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
this.g.remove(entity1);
|
||||
} else {
|
||||
if (!(entity instanceof EntityHuman)) {
|
||||
- // WorldServer.a.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.P()), uuid.toString()); // CraftBukkit
|
||||
+ WorldServer.a.error("Keeping entity {} that already exists with UUID {} - " + entity1, EntityTypes.getName(entity1.P()), uuid.toString()); // CraftBukkit // Paper
|
||||
+ WorldServer.a.error("Deleting duplicate entity {}", entity); // Paper
|
||||
return false;
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,107 +0,0 @@
|
||||
From 0a837c25363d2b05d8a03aa1f80adf0502ca126c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 21 Jul 2018 08:25:40 -0400
|
||||
Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
|
||||
|
||||
Add -Ddebug.entities=true to your JVM flags to gain more information
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 69a058d830..b6c46e01d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
protected CraftEntity bukkitEntity;
|
||||
|
||||
EntityTrackerEntry tracker; // Paper
|
||||
+ Throwable addedToWorldStack; // Paper - entity debug
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (bukkitEntity == null) {
|
||||
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c7712d2e71..1496125ddf 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -110,6 +110,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
public boolean pvpMode;
|
||||
public boolean keepSpawnInMemory = true;
|
||||
public ChunkGenerator generator;
|
||||
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
|
||||
|
||||
public boolean captureBlockStates = false;
|
||||
public boolean captureTreeGeneration = false;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 85a30652c4..6d1f70b39e 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -51,6 +51,9 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
||||
// CraftBukkit start
|
||||
public final DimensionManager dimension;
|
||||
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
+ }
|
||||
|
||||
// Add env and gen to constructor
|
||||
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, DimensionManager dimensionmanager, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||
@@ -951,7 +954,12 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
||||
private boolean j(Entity entity) {
|
||||
if (entity.dead) {
|
||||
- // WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.P())); // CraftBukkit
|
||||
+ // Paper start
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ new Throwable("Tried to add entity " + entity + " but it was marked as removed already").printStackTrace(); // CraftBukkit
|
||||
+ getAddToWorldStackTrace(entity).printStackTrace();
|
||||
+ }
|
||||
+ // Paper end
|
||||
return false;
|
||||
} else {
|
||||
UUID uuid = entity.getUniqueID();
|
||||
@@ -963,8 +971,15 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
this.g.remove(entity1);
|
||||
} else {
|
||||
if (!(entity instanceof EntityHuman)) {
|
||||
- WorldServer.a.error("Keeping entity {} that already exists with UUID {} - " + entity1, EntityTypes.getName(entity1.P()), uuid.toString()); // CraftBukkit // Paper
|
||||
- WorldServer.a.error("Deleting duplicate entity {}", entity); // Paper
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper
|
||||
+ WorldServer.a.error("Deleting duplicate entity {}", entity); // Paper
|
||||
+
|
||||
+ if (entity1.addedToWorldStack != null) {
|
||||
+ entity1.addedToWorldStack.printStackTrace();
|
||||
+ }
|
||||
+ getAddToWorldStackTrace(entity).printStackTrace();
|
||||
+ }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -981,7 +996,25 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
protected void b(Entity entity) {
|
||||
super.b(entity);
|
||||
this.entitiesById.a(entity.getId(), entity);
|
||||
- this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
+ // Paper start
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ entity.addedToWorldStack = getAddToWorldStackTrace(entity);
|
||||
+ }
|
||||
+
|
||||
+ Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
+ if (old != null && old.getId() != entity.getId() && old.valid) {
|
||||
+ Logger logger = LogManager.getLogger();
|
||||
+ logger.error("Overwrote an existing entity " + old + " with " + entity);
|
||||
+ if (DEBUG_ENTITIES) {
|
||||
+ if (old.addedToWorldStack != null) {
|
||||
+ old.addedToWorldStack.printStackTrace();
|
||||
+ } else {
|
||||
+ logger.error("Oddly, the old entity was not added to the world in the normal way. Plugins?");
|
||||
+ }
|
||||
+ entity.addedToWorldStack.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
Entity[] aentity = entity.bi();
|
||||
|
||||
if (aentity != null) {
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 745f1a69fc7480310f06db300dd9b112b92ceb00 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 22 Jul 2018 21:21:41 -0400
|
||||
Subject: [PATCH] Don't save Proto Chunks
|
||||
|
||||
These chunks are unfinished, and waste cpu time saving these unfinished chunks.
|
||||
the loadChunk method refuses to acknoledge they exists, and will restart
|
||||
a new chunk generation process to begin with, so saving them serves no benefit.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 0fc4d9f520..2c4a4fc6b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -304,6 +304,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
}
|
||||
|
||||
public void saveChunk(World world, IChunkAccess ichunkaccess, boolean unloaded) throws IOException, ExceptionWorldConflict {
|
||||
+ if (ichunkaccess.i().d() == ChunkStatus.Type.PROTOCHUNK) { return; } // Paper - don't save proto chunks
|
||||
// Spigot end
|
||||
world.checkSession();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
|
||||
index 70a95c2636..56958a5ce3 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
|
||||
@@ -21,7 +21,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
|
||||
protected boolean a(Scheduler<ChunkCoordIntPair, ChunkStatus, ProtoChunk>.a scheduler_a) {
|
||||
ProtoChunk protochunk = (ProtoChunk) scheduler_a.a();
|
||||
|
||||
- return !protochunk.ab_() && !protochunk.h();
|
||||
+ return !protochunk.ab_() /*&& !protochunk.h()*/; // Paper
|
||||
}
|
||||
};
|
||||
|
||||
@@ -85,6 +85,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
|
||||
}
|
||||
|
||||
public void a(BooleanSupplier booleansupplier) {
|
||||
+ if (true) return; // Paper - we don't save proto chunks, and don't want to block thread
|
||||
IChunkLoader ichunkloader = this.e;
|
||||
|
||||
synchronized (this.e) {
|
||||
--
|
||||
2.21.0
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren