mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 14:35:11 +01:00
more patches
This commit is contained in:
parent
18a839d265
commit
8cf470d6b1
49 changed files with 582 additions and 738 deletions
|
@ -5,11 +5,11 @@ Subject: [PATCH] Clarify the Javadocs for Entity.getEntitySpawnReason()
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 4ed8c74f874dbd1017764d7592acfdafbc5d5fe1..14470b23f7b4102cf2dca777bc832ebcbcd5edc6 100644
|
||||
index 8cfe08cbc869e468edc0f0bdaa28d5bf1f6201a2..a9e455c5b3bbe4edbdb71f86f5c6eebc2f605547 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -710,7 +710,7 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
Chunk getChunk();
|
||||
@@ -713,7 +713,7 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
}
|
||||
|
||||
/**
|
||||
- * @return The {@link org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason} that spawned this entity.
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 828b2b0538d4f936bee57d9fca55774723e13970..7aa9fb852dce23c53fee80e97e0dcdb278ae82ba 100644
|
||||
index 6bc4f12e4ef35979c9d99273d14d7b31833d3f75..d281d270bba71da5a7d1326112e73d9cdb1ed57b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1916,6 +1916,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1943,6 +1943,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@NotNull
|
||||
<T> T getClientOption(@NotNull ClientOption<T> option);
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 3a930ee1b1dce3639d590a8646f68b4ab92207fb..a498c5267458767e1f7802ab3d3b7a22f987d985 100644
|
||||
index af0cf1fe3db1efd39bc06a89216413fc4415b007..bad4593447ca390b3e2f3bc71b4ea9f4dd673445 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -962,6 +962,27 @@ public final class Bukkit {
|
||||
|
@ -37,7 +37,7 @@ index 3a930ee1b1dce3639d590a8646f68b4ab92207fb..a498c5267458767e1f7802ab3d3b7a22
|
|||
* Gets the player by the given UUID, regardless if they are offline or
|
||||
* online.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 9d8886526ae0cd31ec5771462f3cd57692b1cb53..bbc7a1a35da6c8c66c18779ba4fb1aca1a567e6f 100644
|
||||
index 64316a3bcba881f9366d9bf9e16b205e2b817707..48c6434a6a5b1659d4cc8ddf8fe23806628c3b7e 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -808,6 +808,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
|
|||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index e6647c45f65bae916759cd899256f8130790d242..e4e3be0ee9c557e04d9ed1ab6f1569bd36a0e846 100644
|
||||
index 024deba760c41787190d20e4ac5c541920bb4991..e759a03ccf7b341db36f455879e0004a6d6d4d07 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -592,5 +592,29 @@ public interface Block extends Metadatable {
|
||||
@@ -618,5 +618,29 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
@NotNull
|
||||
String getTranslationKey();
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 9bf525b795ff1d88d2596b1f2bc787ce0df047bb..e535750d01a6c1bf4b1fe94df518166213da9b08 100644
|
||||
index c4fe44dce3bcb3502b26af7c76ec6b36c2a2bebe..b96b5f4f2fc754298e2223b2f449a0755469278c 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -766,6 +766,13 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|
@ -3,6 +3,7 @@ From: chickeneer <emcchickeneer@gmail.com>
|
|||
Date: Wed, 18 Mar 2020 00:07:46 -0500
|
||||
Subject: [PATCH] MC-147729: Drop items that are extra from a crafting recipe
|
||||
|
||||
1.17: Issue seems to be fixed (source: Mojira)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
|
||||
index a18aa176850bef45afcaf5742e9afbfa39281e22..c6ba6aabf94c26cccbd14689ea32373c17bbccc4 100644
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Sun, 4 Oct 2020 19:55:25 -0700
|
||||
Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a623c22cd03ad92657e661851fddc76a30986755..90e9797cc1f3a4aa0a2bee28dca364e6f6dd0c0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3180,7 +3180,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
}
|
||||
|
||||
public Stream<Entity> getSelfAndPassengers() {
|
||||
- return Stream.concat(Stream.of(this), this.passengers.stream().flatMap(Entity::getSelfAndPassengers));
|
||||
+ return Stream.concat(Stream.of(this), com.google.common.collect.ImmutableList.copyOf(this.passengers).stream().flatMap(Entity::getSelfAndPassengers)); // Paper
|
||||
}
|
||||
|
||||
public boolean hasOnePlayerPassenger() {
|
|
@ -1,28 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
Date: Sat, 25 Apr 2020 17:10:55 -0700
|
||||
Subject: [PATCH] Reduce blockpos allocation from pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index 7ae24381b91c282745b7fe5f6897865e74bc0acf..3c460682611969a5db136aa41ca0d230c6228d56 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -498,7 +498,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
return BlockPathTypes.DANGER_FIRE;
|
||||
}
|
||||
|
||||
- if (iblockaccess.getFluidState(blockposition_mutableblockposition).is((Tag) FluidTags.WATER)) {
|
||||
+ if (iblockdata.getFluidState().is((Tag) FluidTags.WATER)) { // Paper - remove another getType call
|
||||
return BlockPathTypes.WATER_BORDER;
|
||||
}
|
||||
} // Paper
|
||||
@@ -528,7 +528,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
} else if (iblockdata.is(Blocks.COCOA)) {
|
||||
return BlockPathTypes.COCOA;
|
||||
} else {
|
||||
- FluidState fluid = iblockaccess.getFluidState(blockposition);
|
||||
+ FluidState fluid = iblockdata.getFluidState(); // Paper - remove another get type call
|
||||
|
||||
return fluid.is((Tag) FluidTags.WATER) ? BlockPathTypes.WATER : (fluid.is((Tag) FluidTags.LAVA) ? BlockPathTypes.LAVA : (isBurningBlock(iblockdata) ? BlockPathTypes.DAMAGE_FIRE : (DoorBlock.isWoodenDoor(iblockdata) && !(Boolean) iblockdata.getValue(DoorBlock.OPEN) ? BlockPathTypes.DOOR_WOOD_CLOSED : (block instanceof DoorBlock && material == Material.ORE && !(Boolean) iblockdata.getValue(DoorBlock.OPEN) ? BlockPathTypes.DOOR_IRON_CLOSED : (block instanceof DoorBlock && (Boolean) iblockdata.getValue(DoorBlock.OPEN) ? BlockPathTypes.DOOR_OPEN : (block instanceof BaseRailBlock ? BlockPathTypes.RAIL : (block instanceof LeavesBlock ? BlockPathTypes.LEAVES : (!block.is((Tag) BlockTags.FENCES) && !block.is((Tag) BlockTags.WALLS) && (!(block instanceof FenceGateBlock) || (Boolean) iblockdata.getValue(FenceGateBlock.OPEN)) ? (!iblockdata.isPathfindable(iblockaccess, blockposition, PathComputationType.LAND) ? BlockPathTypes.BLOCKED : BlockPathTypes.OPEN) : BlockPathTypes.FENCE))))))));
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 3 Oct 2020 20:32:25 -0500
|
||||
Subject: [PATCH] Fix item locations dropped from campfires
|
||||
|
||||
Fixes #4259 by not flooring the blockposition among other weirdness
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
index 0c90b1b13611843ba4402c8ccf0b15781b85e773..6c38361d744eae763b6c131ad314485f5a88fcfc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.Clearable;
|
||||
import net.minecraft.world.ContainerHelper;
|
||||
import net.minecraft.world.Containers;
|
||||
import net.minecraft.world.SimpleContainer;
|
||||
+import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CampfireCookingRecipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
@@ -91,7 +92,11 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable, Ticka
|
||||
result = blockCookEvent.getResult();
|
||||
itemstack1 = CraftItemStack.asNMSCopy(result);
|
||||
// CraftBukkit end
|
||||
- Containers.dropItemStack(this.level, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
|
||||
+ // Paper start
|
||||
+ ItemEntity droppedItem = new ItemEntity(this.level, blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D, itemstack1.split(this.level.random.nextInt(21) + 10));
|
||||
+ droppedItem.setDeltaMovement(this.level.random.nextGaussian() * 0.05D, this.level.random.nextGaussian() * 0.05D + 0.2D, this.level.random.nextGaussian() * 0.05D);
|
||||
+ this.level.addFreshEntity(droppedItem);
|
||||
+ // Paper end
|
||||
this.items.set(i, ItemStack.EMPTY);
|
||||
this.markUpdated();
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: giacomo <32515303+giacomozama@users.noreply.github.com>
|
||||
Date: Sat, 10 Oct 2020 12:15:33 +0200
|
||||
Subject: [PATCH] Fixed TileEntityBell memory leak
|
||||
|
||||
TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
index aa45a142aa11acc9fd08b4877891741f3cbd936d..3f9179a7678091875161a34d13b6ec0e78025c4c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
@@ -27,8 +27,8 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity
|
||||
public int ticks;
|
||||
public boolean shaking;
|
||||
public Direction clickDirection;
|
||||
- private List<LivingEntity> nearbyEntities;
|
||||
- private boolean resonating;
|
||||
+ private List<LivingEntity> nearbyEntities; private List<LivingEntity> getEntitiesAtRing() { return this.nearbyEntities; } // Paper - OBFHELPER
|
||||
+ private boolean resonating; private boolean getShouldReveal() { return this.resonating; } // Paper - OBFHELPER
|
||||
private int resonationTicks;
|
||||
|
||||
public BellBlockEntity() {
|
||||
@@ -57,6 +57,11 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity
|
||||
|
||||
if (this.ticks >= 50) {
|
||||
this.shaking = false;
|
||||
+ // Paper start
|
||||
+ if (!this.getShouldReveal()) {
|
||||
+ this.getEntitiesAtRing().clear();
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.ticks = 0;
|
||||
}
|
||||
|
||||
@@ -71,6 +76,7 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity
|
||||
} else {
|
||||
this.makeRaidersGlow(this.level);
|
||||
this.showBellParticles(this.level);
|
||||
+ this.getEntitiesAtRing().clear(); // Paper
|
||||
this.resonating = false;
|
||||
}
|
||||
}
|
||||
@@ -111,11 +117,12 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity
|
||||
LivingEntity entityliving = (LivingEntity) iterator.next();
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.removed && blockposition.closerThan((Position) entityliving.position(), 32.0D)) {
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.HEARD_BELL_TIME, (Object) this.level.getGameTime());
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.HEARD_BELL_TIME, this.level.getGameTime()); // Paper - decompile fix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ this.getEntitiesAtRing().removeIf(e -> !e.isAlive()); // Paper
|
||||
}
|
||||
|
||||
private boolean areRaidersNearby() {
|
|
@ -1,90 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 24 Jun 2020 12:39:08 -0600
|
||||
Subject: [PATCH] Beacon API - custom effect ranges
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index 5f75c6d653a31f65fcf9c0e280d796e15d059c00..fed29e5707e2a7f64159d284c52647dd91e1948e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -71,6 +71,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
return (hasSecondaryEffect()) ? CraftPotionUtil.toBukkit(new MobEffectInstance(this.secondaryPower, getLevelCb(), getAmplification(), true, true)) : null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - add field/methods for custom range
|
||||
+ private final String PAPER_RANGE_TAG = "Paper.Range";
|
||||
+ private double effectRange = -1;
|
||||
+
|
||||
+ public double getEffectRange() {
|
||||
+ if (this.effectRange < 0) {
|
||||
+ return this.levels * 10 + 10;
|
||||
+ } else {
|
||||
+ return effectRange;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void setEffectRange(double range) {
|
||||
+ this.effectRange = range;
|
||||
+ }
|
||||
+
|
||||
+ public void resetEffectRange() {
|
||||
+ this.effectRange = -1;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public BeaconBlockEntity() {
|
||||
super(BlockEntityType.BEACON);
|
||||
@@ -261,7 +281,8 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
|
||||
public List getHumansInRange() {
|
||||
{
|
||||
- double d0 = (double) (this.levels * 10 + 10);
|
||||
+ // Paper - custom beacon ranges
|
||||
+ double d0 = this.getEffectRange();
|
||||
|
||||
AABB axisalignedbb = (new AABB(this.worldPosition)).inflate(d0).expandTowards(0.0D, (double) this.level.getMaxBuildHeight(), 0.0D);
|
||||
List<net.minecraft.world.entity.player.Player> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.player.Player.class, axisalignedbb);
|
||||
@@ -361,6 +382,9 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
this.secondaryPower = MobEffect.byId(tag.getInt("Secondary"));
|
||||
this.levels = tag.getInt("Levels"); // SPIGOT-5053, use where available
|
||||
// CraftBukkit end
|
||||
+ // Paper
|
||||
+ this.effectRange = tag.contains(PAPER_RANGE_TAG, 6) ? tag.getDouble(PAPER_RANGE_TAG) : -1;
|
||||
+
|
||||
if (tag.contains("CustomName", 8)) {
|
||||
this.name = Component.Serializer.fromJson(tag.getString("CustomName"));
|
||||
}
|
||||
@@ -377,6 +401,8 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
if (this.name != null) {
|
||||
tag.putString("CustomName", Component.Serializer.toJson(this.name));
|
||||
}
|
||||
+ // Paper
|
||||
+ tag.putDouble(PAPER_RANGE_TAG, this.effectRange);
|
||||
|
||||
this.lockKey.addToTag(tag);
|
||||
return tag;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
index 940fef58f14e06213c7f305f67dcb8918976c03d..2a10a9352fdb52f5cb27eae2b6d3baa9ff95e486 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
@@ -108,4 +108,19 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
||||
public void setLock(String key) {
|
||||
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public double getEffectRange() {
|
||||
+ return this.getSnapshot().getEffectRange();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setEffectRange(double range) {
|
||||
+ this.getSnapshot().setEffectRange(range);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void resetEffectRange() {
|
||||
+ this.getSnapshot().resetEffectRange();
|
||||
+ }
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <mail@moep.tv>
|
||||
Date: Mon, 13 Jan 2020 15:40:32 +0100
|
||||
Subject: [PATCH] Seed based feature search
|
||||
|
||||
This tries to work around the issue where the server will load
|
||||
surrounding chunks up to a radius of 100 chunks in order to search for
|
||||
features e.g. when running the /locate command or for treasure maps
|
||||
(issue #2312).
|
||||
This is done by backporting Mojang's change in 1.17 which makes it so
|
||||
that the biome (generated by the seed) is checked first if the feature
|
||||
can be generated before actually to load the chunk.
|
||||
|
||||
Additionally to that the center location of the target chunk is simply
|
||||
returned if the chunk is not loaded to avoid the sync chunk load.
|
||||
As this can lead to less precise locations a toggle is provided to
|
||||
enable the sync loading of the target chunk again.
|
||||
|
||||
The main downside of this is that it breaks once the seed or generator
|
||||
changes but this should usually not happen. A config option to disable
|
||||
this completely is added though in case that should ever be necessary.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 424754a0183b071d20c86f0420cec784a8992e2b..97870622e41cca36d9c7493bfad796f35f3831f4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -337,6 +337,14 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean seedBasedFeatureSearch = true;
|
||||
+ public boolean seedBasedFeatureSearchLoadsChunks = false;
|
||||
+ private void seedBasedFeatureSearch() {
|
||||
+ seedBasedFeatureSearch = getBoolean("seed-based-feature-search", seedBasedFeatureSearch);
|
||||
+ seedBasedFeatureSearchLoadsChunks = getBoolean("seed-based-feature-search-loads-chunks", seedBasedFeatureSearchLoadsChunks);
|
||||
+ log("Feature search is based on seed: " + seedBasedFeatureSearch + ", loads chunks:" + seedBasedFeatureSearchLoadsChunks);
|
||||
+ }
|
||||
+
|
||||
public int maxCollisionsPerEntity;
|
||||
private void maxEntityCollision() {
|
||||
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
index 4a5f318adf5bc2ca1c3fab5d173a99cddd77ab85..f61a3eda40328922b95f166be4dc604500e000be 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
@@ -68,10 +68,12 @@ public class ChunkPos {
|
||||
}
|
||||
}
|
||||
|
||||
+ public int getBlockX() { return getMinBlockX(); } // Paper - OBFHELPER
|
||||
public int getMinBlockX() {
|
||||
return this.x << 4;
|
||||
}
|
||||
|
||||
+ public int getBlockZ() { return getMinBlockZ(); } // Paper - OBFHELPER
|
||||
public int getMinBlockZ() {
|
||||
return this.z << 4;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 2ad8a4558aa812885adebee8c05dab45f2bf5f90..066d5f7ee93351bff67c0d39ee9d940ac51515d8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1511,8 +1511,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.profiler;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public BiomeManager getBiomeManager() {
|
||||
+ public BiomeManager getBiomeManager() { return getBiomeManager(); } // Paper - OBFHELPER
|
||||
+ @Override public BiomeManager getBiomeManager() {
|
||||
return this.biomeManager;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
index d22ac114440d807a6cf5f286961bc63935fa7823..3a1909c0b198d89539f4351d70a39d16cfd84987 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
@@ -23,6 +23,7 @@ public class BiomeManager {
|
||||
return new BiomeManager(source, this.biomeZoomSeed, this.zoomer);
|
||||
}
|
||||
|
||||
+ public Biome getBiome(BlockPos blockposition) { return getBiome(blockposition); } // Paper - OBFHELPER
|
||||
public Biome getBiome(BlockPos pos) {
|
||||
return this.zoomer.getBiome(this.biomeZoomSeed, pos.getX(), pos.getY(), pos.getZ(), this.noiseBiomeSource);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
index 0624b8270bc28c83c5479cd51fa4633ed5c36f44..6b24590a1ac460a7fd4bbc2c70d4a4981378e79c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
@@ -176,7 +176,24 @@ public abstract class StructureFeature<C extends FeatureConfiguration> {
|
||||
int j2 = i1 + k * l1;
|
||||
ChunkPos chunkcoordintpair = this.getPotentialFeatureChunk(config, worldSeed, seededrandom, i2, j2);
|
||||
if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
||||
- ChunkAccess ichunkaccess = world.getChunk(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
|
||||
+ // Paper start - seed based feature search
|
||||
+ ChunkAccess ichunkaccess = null;
|
||||
+ if (structureAccessor.getWorld().paperConfig.seedBasedFeatureSearch) {
|
||||
+ Biome biomeBase = structureAccessor.getWorld().getBiomeManager().getBiome(new BlockPos(chunkcoordintpair.getBlockX() + 9, 0, chunkcoordintpair.getBlockZ() + 9));
|
||||
+ if (!biomeBase.getGenerationSettings().isValidStart(this)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!structureAccessor.getWorld().paperConfig.seedBasedFeatureSearchLoadsChunks) {
|
||||
+ ichunkaccess = structureAccessor.getWorld().getChunkIfLoaded(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
+ if (ichunkaccess == null) {
|
||||
+ return chunkcoordintpair.asPosition().add(8, searchStartPos.getY(), 8);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (ichunkaccess == null) {
|
||||
+ ichunkaccess = world.getChunk(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
|
||||
+ }
|
||||
+ // Paper end
|
||||
StructureStart<?> structurestart = structureAccessor.getStartForFeature(SectionPos.of(ichunkaccess.getPos(), 0), this, ichunkaccess);
|
||||
|
||||
if (structurestart != null && structurestart.e()) {
|
|
@ -1,77 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SuperCoder7979 <25208576+SuperCoder7979@users.noreply.github.com>
|
||||
Date: Tue, 3 Nov 2020 23:48:05 -0600
|
||||
Subject: [PATCH] Significantly improve performance of the end generation
|
||||
|
||||
This patch implements a noise cache for the end which significantly reduces the computation time of generation. This results in about a 3x improvement.
|
||||
|
||||
Original code by SuperCoder7979 and Gegy in Lithium, licensed under LGPL-3.0 (Source: https://github.com/jellysquid3/lithium-fabric)
|
||||
|
||||
Co-authored-by: Gegy <gegy1000@gmail.com>
|
||||
Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
|
||||
Co-authored-by: pop4959 <pop4959@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
index 063369d3a64b4afc9cc6e1d20360900595e1a05f..f01d1b01ebc31f0967a73871f278aac9e414fb67 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
@@ -3,10 +3,12 @@ package net.minecraft.world.level.biome;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
+import it.unimi.dsi.fastutil.HashCommon; // Paper
|
||||
import java.util.List;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.RegistryLookupCodec;
|
||||
import net.minecraft.util.Mth;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
|
||||
|
||||
@@ -27,6 +29,16 @@ public class TheEndBiomeSource extends BiomeSource {
|
||||
private final Biome midlands;
|
||||
private final Biome islands;
|
||||
private final Biome barrens;
|
||||
+ // Paper start
|
||||
+ private static final class NoiseCache {
|
||||
+ public long[] keys = new long[8192];
|
||||
+ public float[] values = new float[8192];
|
||||
+ public NoiseCache() {
|
||||
+ java.util.Arrays.fill(keys, Long.MIN_VALUE);
|
||||
+ }
|
||||
+ }
|
||||
+ private static final ThreadLocal<java.util.Map<SimplexNoise, NoiseCache>> noiseCache = ThreadLocal.withInitial(java.util.WeakHashMap::new);
|
||||
+ // Paper end
|
||||
|
||||
public TheEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||
this(biomeRegistry, seed, (Biome) biomeRegistry.lifecycle(Biomes.THE_END), (Biome) biomeRegistry.lifecycle(Biomes.END_HIGHLANDS), (Biome) biomeRegistry.lifecycle(Biomes.END_MIDLANDS), (Biome) biomeRegistry.lifecycle(Biomes.SMALL_END_ISLANDS), (Biome) biomeRegistry.lifecycle(Biomes.END_BARRENS));
|
||||
@@ -81,13 +93,27 @@ public class TheEndBiomeSource extends BiomeSource {
|
||||
|
||||
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||
|
||||
+ NoiseCache cache = noiseCache.get().computeIfAbsent(noisegenerator3handler, m -> new NoiseCache()); // Paper
|
||||
for (int k1 = -12; k1 <= 12; ++k1) {
|
||||
for (int l1 = -12; l1 <= 12; ++l1) {
|
||||
long i2 = (long) (k + k1);
|
||||
long j2 = (long) (l + l1);
|
||||
|
||||
- if (i2 * i2 + j2 * j2 > 4096L && noisegenerator3handler.getValue((double) i2, (double) j2) < -0.8999999761581421D) {
|
||||
- float f1 = (Mth.abs((float) i2) * 3439.0F + Mth.abs((float) j2) * 147.0F) % 13.0F + 9.0F;
|
||||
+ // Paper start - Significantly improve end generation performance by using a noise cache
|
||||
+ long key = ChunkPos.asLong((int) i2, (int) j2);
|
||||
+ int index = (int) HashCommon.mix(key) & 8191;
|
||||
+ float f1 = Float.MIN_VALUE;
|
||||
+ if (cache.keys[index] == key) {
|
||||
+ f1 = cache.values[index];
|
||||
+ } else {
|
||||
+ if (i2 * i2 + j2 * j2 > 4096L && noisegenerator3handler.getValue((double) i2, (double) j2) < -0.8999999761581421D) {
|
||||
+ f1 = (Mth.abs((float) i2) * 3439.0F + Mth.abs((float) j2) * 147.0F) % 13.0F + 9.0F;
|
||||
+ }
|
||||
+ cache.keys[index] = key;
|
||||
+ cache.values[index] = f1;
|
||||
+ }
|
||||
+ if (f1 != Float.MIN_VALUE) {
|
||||
+ // Paper end
|
||||
float f2 = (float) (i1 - k1 * 2);
|
||||
float f3 = (float) (j1 - l1 * 2);
|
||||
float f4 = 100.0F - Mth.sqrt(f2 * f2 + f3 * f3) * f1;
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Sun, 4 Oct 2020 19:55:25 -0700
|
||||
Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d1199a166dfc88722e13dbdfeb86d9c89e7e8513..d64caca72a5302392df944d4c60ed2ba79a19ee7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3413,7 +3413,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
}
|
||||
|
||||
private Stream<Entity> getIndirectPassengersStream() {
|
||||
- return this.passengers.stream().flatMap(Entity::getSelfAndPassengers);
|
||||
+ return ImmutableList.copyOf(this.passengers).stream().flatMap(Entity::getSelfAndPassengers); // Paper
|
||||
}
|
||||
|
||||
@Override
|
|
@ -11,14 +11,14 @@ This ensures the crystals/pillars are in expected state when the dragon spawns.
|
|||
See #3522
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 4b18931225ef60dbcffd7fcc20d0e9ce62348a07..590df3b93b897613cad74f9920aec62b33a2f7f7 100644
|
||||
index 711be01abe9d47bdc9bfe8b09a2719d666b986fb..9899c70b88fc371963e33caccd7125ef8c333df4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -441,6 +441,7 @@ public class EndDragonFight {
|
||||
entityenderdragon.moveTo(0.0D, 128.0D, 0.0D, this.level.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.level.addFreshEntity(entityenderdragon);
|
||||
this.dragonUUID = entityenderdragon.getUUID();
|
||||
@@ -404,6 +404,7 @@ public class EndDragonFight {
|
||||
enderDragon.moveTo(0.0D, 128.0D, 0.0D, this.level.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.level.addFreshEntity(enderDragon);
|
||||
this.dragonUUID = enderDragon.getUUID();
|
||||
+ this.resetSpikeCrystals(); // Paper
|
||||
return entityenderdragon;
|
||||
return enderDragon;
|
||||
}
|
||||
|
|
@ -6,27 +6,27 @@ Subject: [PATCH] Fix for large move vectors crashing server
|
|||
Check movement distance also based on current position.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index ab45497e8f7720c9d60626b32e9c95779af676b0..3a114bec14fcc6c1e1045e2b99178a6adb25f387 100644
|
||||
index e3725db7e19fe3235ec25beffca26a7eede24394..0e0d6d298caa1bbb6fb0dd42fd00460f7609c431 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -516,19 +516,24 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -507,19 +507,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
|
||||
ServerLevel worldserver = this.player.getLevel();
|
||||
- double d0 = entity.getX();
|
||||
- double d1 = entity.getY();
|
||||
- double d2 = entity.getZ();
|
||||
- double d3 = packet.getX();
|
||||
- double d4 = packet.getY();
|
||||
- double d5 = packet.getZ();
|
||||
+ double d0 = entity.getX();double fromX = d0; // Paper - OBFHELPER
|
||||
+ double d1 = entity.getY();double fromY = d1; // Paper - OBFHELPER
|
||||
+ double d2 = entity.getZ();double fromZ = d2; // Paper - OBFHELPER
|
||||
+ double d3 = packet.getX();double toX = d3; // Paper - OBFHELPER
|
||||
+ double d4 = packet.getY();double toY = d4; // Paper - OBFHELPER
|
||||
+ double d5 = packet.getZ();double toZ = d5; // Paper - OBFHELPER
|
||||
float f = packet.getYRot();
|
||||
float f1 = packet.getXRot();
|
||||
- double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX());
|
||||
- double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY());
|
||||
- double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ());
|
||||
+ double d0 = entity.getX();final double fromX = d0; // Paper - OBFHELPER
|
||||
+ double d1 = entity.getY();final double fromY = d1; // Paper - OBFHELPER
|
||||
+ double d2 = entity.getZ();final double fromZ = d2; // Paper - OBFHELPER
|
||||
+ double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX());final double toX = d3; // Paper - OBFHELPER
|
||||
+ double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY());final double toY = d4; // Paper - OBFHELPER
|
||||
+ double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ());final double toZ = d5; // Paper - OBFHELPER
|
||||
float f = Mth.wrapDegrees(packet.getYRot());
|
||||
float f1 = Mth.wrapDegrees(packet.getXRot());
|
||||
double d6 = d3 - this.vehicleFirstGoodX;
|
||||
double d7 = d4 - this.vehicleFirstGoodY;
|
||||
double d8 = d5 - this.vehicleFirstGoodZ;
|
||||
|
@ -41,18 +41,17 @@ index ab45497e8f7720c9d60626b32e9c95779af676b0..3a114bec14fcc6c1e1045e2b99178a6a
|
|||
|
||||
|
||||
// CraftBukkit start - handle custom speeds and skipped ticks
|
||||
@@ -1230,7 +1235,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
double d2 = this.player.getZ();
|
||||
double d3 = this.player.getY();
|
||||
double d4 = packet.getX(this.player.getX());double toX = d4; // Paper - OBFHELPER
|
||||
- double d5 = packet.getY(this.player.getY());
|
||||
+ double d5 = packet.getY(this.player.getY());double toY = d5; // Paper - OBFHELPER
|
||||
double d6 = packet.getZ(this.player.getZ());double toZ = d6; // Paper - OBFHELPER
|
||||
float f = packet.getYRot(this.player.yRot);
|
||||
float f1 = packet.getXRot(this.player.xRot);
|
||||
@@ -1238,7 +1243,12 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
double d8 = d5 - this.firstGoodY;
|
||||
double d9 = d6 - this.firstGoodZ;
|
||||
@@ -1252,14 +1257,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
float prevPitch = this.player.getXRot();
|
||||
// CraftBukkit end
|
||||
double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER
|
||||
- double d4 = this.player.getY();
|
||||
+ double d4 = this.player.getY(); final double toY = d4; // Paper - OBFHELPER
|
||||
double d5 = this.player.getZ(); final double toZ = d5; // Paper - OBFHELPER
|
||||
double d6 = this.player.getY();
|
||||
double d7 = d0 - this.firstGoodX;
|
||||
double d8 = d1 - this.firstGoodY;
|
||||
double d9 = d2 - this.firstGoodZ;
|
||||
double d10 = this.player.getDeltaMovement().lengthSqr();
|
||||
- double d11 = d7 * d7 + d8 * d8 + d9 * d9;
|
||||
+ // Paper start - fix large move vectors killing the server
|
|
@ -6,14 +6,13 @@ Subject: [PATCH] Optimise getType calls
|
|||
Remove the map lookup for converting from Block->Bukkit Material
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockState.java b/src/main/java/net/minecraft/world/level/block/state/BlockState.java
|
||||
index 9958cdf55cef2177fafd0cdae48da9db064af9f1..4263ac345d57e36e010e3dd009130c02799b249c 100644
|
||||
index 3581aa7dcba934017896dc947adeb9d548d5f333..6158ef624ddbf02179afcc4aebc8284ae326ffb1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockState.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockState.java
|
||||
@@ -11,6 +11,19 @@ public class BlockState extends BlockBehaviour.BlockStateBase {
|
||||
@@ -10,6 +10,17 @@ import net.minecraft.world.level.block.state.properties.Property;
|
||||
public class BlockState extends BlockBehaviour.BlockStateBase {
|
||||
public static final Codec<BlockState> CODEC = codec(Registry.BLOCK, Block::defaultBlockState).stable();
|
||||
|
||||
public static final Codec<BlockState> CODEC = codec((Codec) Registry.BLOCK, Block::defaultBlockState).stable();
|
||||
|
||||
+
|
||||
+ // Paper start - optimise getType calls
|
||||
+ org.bukkit.Material cachedMaterial;
|
||||
+
|
||||
|
@ -25,72 +24,71 @@ index 9958cdf55cef2177fafd0cdae48da9db064af9f1..4263ac345d57e36e010e3dd009130c02
|
|||
+ return this.cachedMaterial;
|
||||
+ }
|
||||
+ // Paper end - optimise getType calls
|
||||
+
|
||||
public BlockState(Block block, ImmutableMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> mapcodec) {
|
||||
super(block, propertyMap, mapcodec);
|
||||
public BlockState(Block block, ImmutableMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> codec) {
|
||||
super(block, propertyMap, codec);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
index fe00c8fdacc28a68c732aac0b887ea107d87e979..227974a85a81c623311301e28e83e85424b05f3d 100644
|
||||
index e2e6652fc227173b69580dba74855c3ed8884a3b..2c23712aadfe32439ae014c62aa16f1b2a677439 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java
|
||||
@@ -78,7 +78,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
@@ -81,7 +81,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
public Material getBlockType(int x, int y, int z) {
|
||||
CraftChunk.validateChunkCoordinates(x, y, z);
|
||||
this.validateChunkCoordinates(x, y, z);
|
||||
|
||||
- return CraftMagicNumbers.getMaterial(blockids[y >> 4].get(x, y & 0xF, z).getBlock());
|
||||
+ return blockids[y >> 4].get(x, y & 0xF, z).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
- return CraftMagicNumbers.getMaterial(this.blockids[this.getSectionIndex(y)].get(x, y & 0xF, z).getBlock());
|
||||
+ return this.blockids[this.getSectionIndex(y)].get(x, y & 0xF, z).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index e09f65f0b06c8fb9a965b921c2c8e68ae2ac1e55..37eceaef1212e2ee13aa763a5ede24ec170e5391 100644
|
||||
index b31eaa1459690d7f54989ba7a01f96a3f0d8d3b9..aa81c0a4c02fd6f2ab900983fd8c9668fada802e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -211,7 +211,7 @@ public class CraftBlock implements Block {
|
||||
@@ -214,7 +214,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Material getType() {
|
||||
- return CraftMagicNumbers.getMaterial(world.getBlockState(position).getBlock());
|
||||
+ return world.getBlockState(position).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
- return CraftMagicNumbers.getMaterial(this.world.getBlockState(position).getBlock());
|
||||
+ return this.world.getBlockState(this.position).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
index 754559c9e47032845fdc94eedad0cece0e0ae4c7..7e4c522605cf04a38a7a0f54e7ac6ea0e372c98d 100644
|
||||
index efc6cbe905b982ab39a12bd137f1dc0515a7c46a..3c41d80b0ffca929abfcb45cd1dedbc0bf3f5954 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -134,7 +134,7 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
@Override
|
||||
public Material getType() {
|
||||
- return CraftMagicNumbers.getMaterial(data.getBlock());
|
||||
+ return data.getBukkitMaterial(); // Paper - optimise getType calls
|
||||
- return CraftMagicNumbers.getMaterial(this.data.getBlock());
|
||||
+ return this.data.getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
index 03e065bf92cafd376ad0f878584cdac6fd196245..d93f2373f3127462aa2f9b69f7cc808b58d47b61 100644
|
||||
index 6dc8f9f269db6971b8b46819e017357899ccd118..7f49c7c7048b5778f20ddce1d844d4b389e6597f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
@@ -45,7 +45,7 @@ public class CraftBlockData implements BlockData {
|
||||
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
- return CraftMagicNumbers.getMaterial(state.getBlock());
|
||||
+ return state.getBukkitMaterial(); // Paper - optimise getType calls
|
||||
- return CraftMagicNumbers.getMaterial(this.state.getBlock());
|
||||
+ return this.state.getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
public BlockState getState() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
|
||||
index fd2cb2a584fea360fcf8180338708f35c4e3dc1f..a463b89888460e5a894098c20eb4c4a78c04642c 100644
|
||||
index 2f0849dd05605e693dcc12c3d0842e8dfa53a869..612241ad511cb515fe28c69452c66efcfe62bd7e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
|
||||
@@ -73,7 +73,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
||||
@@ -75,7 +75,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
||||
|
||||
@Override
|
||||
public Material getType(int x, int y, int z) {
|
||||
- return CraftMagicNumbers.getMaterial(getTypeId(x, y, z).getBlock());
|
||||
+ return getTypeId(x, y, z).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
- return CraftMagicNumbers.getMaterial(this.getTypeId(x, y, z).getBlock());
|
||||
+ return this.getTypeId(x, y, z).getBukkitMaterial(); // Paper - optimise getType calls
|
||||
}
|
||||
|
||||
@Override
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Villager#resetOffers
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index 9eee68a5a84e121698d26bd54212a72c75e16251..407a68edf6408400f1a6c5bb1a6cbbfae08ac2cd 100644
|
||||
index ab701d86b1181e30d74e0e03eef79c43f7fb2513..2610d9cd849aa38cc7a67aef21223707e85682ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -111,6 +111,13 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||||
@@ -115,6 +115,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
return this.tradingPlayer != null;
|
||||
}
|
||||
|
||||
|
@ -22,21 +22,13 @@ index 9eee68a5a84e121698d26bd54212a72c75e16251..407a68edf6408400f1a6c5bb1a6cbbfa
|
|||
@Override
|
||||
public MerchantOffers getOffers() {
|
||||
if (this.offers == null) {
|
||||
@@ -232,6 +239,7 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||||
return this.level;
|
||||
}
|
||||
|
||||
+ protected final void updateTrades() { updateTrades(); } // Paper - OBFHELPER
|
||||
protected abstract void updateTrades();
|
||||
|
||||
protected void addOffersFromItemListings(MerchantOffers recipeList, VillagerTrades.ItemListing[] pool, int count) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
||||
index 8ffdfe3e8229b556838eab18dcb6bfb0c05a6063..7f887e883a87f2df7ae428ffddb072724d602d62 100644
|
||||
index 1467232779541a9e38420caabf273662f380794c..762354681315e4c74e414bf7d677b5422385161e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
||||
@@ -70,4 +70,11 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla
|
||||
public HumanEntity getTrader() {
|
||||
return getMerchant().getTrader();
|
||||
return this.getMerchant().getTrader();
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Improve inlinig for some hot IBlockData methods
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index f2fefdad26057c722085e60ba837fe2c117f55f7..17baae6b11f191f4738a107c7e62ea5bdac17a3c 100644
|
||||
index 597bb3b9b638c59c6ddc21095e4fe4503ef36cb1..933448659367b5f0b323bd91992fc9b59314b8a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -390,7 +390,14 @@ public abstract class BlockBehaviour {
|
||||
@@ -653,7 +653,14 @@ public abstract class BlockBehaviour {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -23,7 +23,7 @@ index f2fefdad26057c722085e60ba837fe2c117f55f7..17baae6b11f191f4738a107c7e62ea5b
|
|||
if (!this.getBlock().hasDynamicShape()) {
|
||||
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
|
||||
}
|
||||
@@ -429,19 +436,19 @@ public abstract class BlockBehaviour {
|
||||
@@ -692,19 +699,19 @@ public abstract class BlockBehaviour {
|
||||
return this.getBlock().getOcclusionShape(this.asState(), world, pos);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ index f2fefdad26057c722085e60ba837fe2c117f55f7..17baae6b11f191f4738a107c7e62ea5b
|
|||
return this.isAir;
|
||||
}
|
||||
|
||||
@@ -507,7 +514,7 @@ public abstract class BlockBehaviour {
|
||||
@@ -778,7 +785,7 @@ public abstract class BlockBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ index f2fefdad26057c722085e60ba837fe2c117f55f7..17baae6b11f191f4738a107c7e62ea5b
|
|||
return this.canOcclude;
|
||||
}
|
||||
|
||||
@@ -679,12 +686,12 @@ public abstract class BlockBehaviour {
|
||||
return this.getBlock().is(block);
|
||||
@@ -971,12 +978,12 @@ public abstract class BlockBehaviour {
|
||||
return this.getBlock() == block;
|
||||
}
|
||||
|
||||
- public FluidState getFluidState() {
|
||||
|
@ -72,25 +72,25 @@ index f2fefdad26057c722085e60ba837fe2c117f55f7..17baae6b11f191f4738a107c7e62ea5b
|
|||
+ return this.isTicking; // Paper - moved into init
|
||||
}
|
||||
|
||||
public SoundType getSoundType() {
|
||||
public long getSeed(BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||
index c077e4a7ce6a484956206eaab9dfde057b7e429a..69cf9e149c207336c537a00f08251a2252752df6 100644
|
||||
index 65911334082f9d53fc930d7c6b0313e8acef0c5e..0ae876f0bbfac74a9d5f06fb73f9cfcf5991b02e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FluidState.java
|
||||
@@ -20,8 +20,12 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
||||
|
||||
public static final Codec<FluidState> CODEC = codec((Codec) Registry.FLUID, Fluid::defaultFluidState).stable();
|
||||
@@ -23,8 +23,12 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
||||
public static final int AMOUNT_MAX = 9;
|
||||
public static final int AMOUNT_FULL = 8;
|
||||
|
||||
+ // Paper start
|
||||
+ protected final boolean isEmpty;
|
||||
+ // Paper end
|
||||
public FluidState(Fluid fluid, ImmutableMap<Property<?>, Comparable<?>> propertiesMap, MapCodec<FluidState> mapcodec) {
|
||||
super(fluid, propertiesMap, mapcodec);
|
||||
public FluidState(Fluid fluid, ImmutableMap<Property<?>, Comparable<?>> propertiesMap, MapCodec<FluidState> codec) {
|
||||
super(fluid, propertiesMap, codec);
|
||||
+ this.isEmpty = fluid.isEmpty(); // Paper - moved from isEmpty()
|
||||
}
|
||||
|
||||
public Fluid getType() {
|
||||
@@ -33,7 +37,7 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
||||
@@ -40,7 +44,7 @@ public final class FluidState extends StateHolder<Fluid, FluidState> {
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
|
@ -10,10 +10,10 @@ In general, look at making this logic more robust (i.e properly handling
|
|||
cases where a captured entry is overriden) - but for now this will do.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index ebb92f88e0402681c47834bcf45e6b236748289a..2ad8a4558aa812885adebee8c05dab45f2bf5f90 100644
|
||||
index b969e7f2087aed5b1f97ce8593a25ada737daec9..31aa0c682fddb0555c2ac47f563484cfa51f2669 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -135,7 +135,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -147,7 +147,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public boolean captureBlockStates = false;
|
||||
public boolean captureTreeGeneration = false;
|
||||
public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper
|
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
Date: Sat, 25 Apr 2020 17:10:55 -0700
|
||||
Subject: [PATCH] Reduce blockpos allocation from pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index b37acb6e6e253529a38f44a518a02c7747d3145e..2ad5ff9a1d7de54e75436e99da8a73db9dc91bde 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -471,7 +471,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
return BlockPathTypes.DANGER_FIRE;
|
||||
}
|
||||
|
||||
- if (world.getFluidState(pos).is(FluidTags.WATER)) {
|
||||
+ if (blockState.getFluidState().is(FluidTags.WATER)) {
|
||||
return BlockPathTypes.WATER_BORDER;
|
||||
}
|
||||
} // Paper
|
||||
@@ -502,7 +502,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
} else if (blockState.is(Blocks.COCOA)) {
|
||||
return BlockPathTypes.COCOA;
|
||||
} else {
|
||||
- FluidState fluidState = world.getFluidState(pos);
|
||||
+ FluidState fluidState = blockState.getFluidState(); // Paper - remove another get type call
|
||||
if (fluidState.is(FluidTags.LAVA)) {
|
||||
return BlockPathTypes.LAVA;
|
||||
} else if (isBurningBlock(blockState)) {
|
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 3 Oct 2020 20:32:25 -0500
|
||||
Subject: [PATCH] Fix item locations dropped from campfires
|
||||
|
||||
Fixes #4259 by not flooring the blockposition among other weirdness
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
index 7a5f748f974429ce4faa8f64fae905994b5e59a9..ad35d82f03f7643507dde6adbb38c911d12ec6c1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
||||
@@ -71,7 +71,11 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
||||
result = blockCookEvent.getResult();
|
||||
itemstack1 = CraftItemStack.asNMSCopy(result);
|
||||
// CraftBukkit end
|
||||
- Containers.dropItemStack(world, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), itemstack1);
|
||||
+ // Paper start
|
||||
+ net.minecraft.world.entity.item.ItemEntity droppedItem = new net.minecraft.world.entity.item.ItemEntity(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, itemstack1.split(world.random.nextInt(21) + 10));
|
||||
+ droppedItem.setDeltaMovement(world.random.nextGaussian() * 0.05D, world.random.nextGaussian() * 0.05D + 0.2D, world.random.nextGaussian() * 0.05D);
|
||||
+ world.addFreshEntity(droppedItem);
|
||||
+ // Paper end
|
||||
campfire.items.set(i, ItemStack.EMPTY);
|
||||
world.sendBlockUpdated(pos, state, state, 3);
|
||||
}
|
|
@ -5,18 +5,10 @@ Subject: [PATCH] Player elytra boost API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7aae63d22167dc1b3ec7e8bc8672855c2038007e..94240b70e245bdc3dda60420f5787f8d5dcc1958 100644
|
||||
index b277c87c0834ddcefcfaebd85c9e69d8d389b59e..41bb480e61ff98dd35b8e059356bf867406e9e5e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -67,6 +67,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
+import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
@@ -2281,6 +2282,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -534,6 +534,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
throw new RuntimeException("Unknown settings type");
|
||||
}
|
||||
|
@ -29,11 +21,11 @@ index 7aae63d22167dc1b3ec7e8bc8672855c2038007e..94240b70e245bdc3dda60420f5787f8d
|
|||
+
|
||||
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework);
|
||||
+ net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle();
|
||||
+ FireworkRocketEntity entity = new FireworkRocketEntity(world, item, getHandle());
|
||||
+ net.minecraft.world.entity.projectile.FireworkRocketEntity entity = new net.minecraft.world.entity.projectile.FireworkRocketEntity(world, item, getHandle());
|
||||
+ return world.addFreshEntity(entity)
|
||||
+ ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
|
||||
+ : null;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
||||
@Override
|
39
patches/server/0530-Fixed-TileEntityBell-memory-leak.patch
Normal file
39
patches/server/0530-Fixed-TileEntityBell-memory-leak.patch
Normal file
|
@ -0,0 +1,39 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: giacomo <32515303+giacomozama@users.noreply.github.com>
|
||||
Date: Sat, 10 Oct 2020 12:15:33 +0200
|
||||
Subject: [PATCH] Fixed TileEntityBell memory leak
|
||||
|
||||
TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
index 58ee348d0934a8d8743005b4b8e9114cfe1bc028..a71bf0802d04217dd11086901b7148957d32ca89 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
@@ -61,6 +61,11 @@ public class BellBlockEntity extends BlockEntity {
|
||||
|
||||
if (blockEntity.ticks >= 50) {
|
||||
blockEntity.shaking = false;
|
||||
+ // Paper start
|
||||
+ if (!blockEntity.resonating) {
|
||||
+ blockEntity.nearbyEntities.clear();
|
||||
+ }
|
||||
+ // Paper end
|
||||
blockEntity.ticks = 0;
|
||||
}
|
||||
|
||||
@@ -74,6 +79,7 @@ public class BellBlockEntity extends BlockEntity {
|
||||
++blockEntity.resonationTicks;
|
||||
} else {
|
||||
bellEffect.run(world, pos, blockEntity.nearbyEntities);
|
||||
+ blockEntity.nearbyEntities.clear(); // Paper
|
||||
blockEntity.resonating = false;
|
||||
}
|
||||
}
|
||||
@@ -116,6 +122,7 @@ public class BellBlockEntity extends BlockEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper
|
||||
}
|
||||
|
||||
private static boolean areRaidersNearby(BlockPos pos, List<LivingEntity> hearingEntities) {
|
|
@ -8,10 +8,10 @@ This can realistically only happen if there's custom loot active on fishing
|
|||
which can return 0 items. This would disconnect the player who's fishing.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 7bff012f3cd4458673ee02e5f5f830fc0ef983a3..ef71cca9922ed134ec82fb2982d375bf16f47b17 100644
|
||||
index 0258d0699afe7ceec19154c669b10298e6e1bf95..852a4edde291bf368b2396e3c94ab402e3c66622 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -481,9 +481,15 @@ public class FishingHook extends Projectile {
|
||||
@@ -497,9 +497,15 @@ public class FishingHook extends Projectile {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
|
@ -29,7 +29,7 @@ index 7bff012f3cd4458673ee02e5f5f830fc0ef983a3..ef71cca9922ed134ec82fb2982d375bf
|
|||
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||
this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
@@ -496,8 +502,12 @@ public class FishingHook extends Projectile {
|
||||
@@ -512,8 +518,12 @@ public class FishingHook extends Projectile {
|
||||
double d2 = entityhuman.getZ() - this.getZ();
|
||||
double d3 = 0.1D;
|
||||
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e599be15af17e5e45d2b694c30140cc4a787a7f5..046fbc646d2818bb2c7e08ff22093523e8246523 100644
|
||||
index 7795735e5acc3b7b6b71b4e61bdc4bdcb722a7b3..ecae20bb39848cc0223df3c4804a68f4e0731e3b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1612,6 +1612,28 @@ public final class CraftServer implements Server {
|
||||
@@ -1613,6 +1613,28 @@ public final class CraftServer implements Server {
|
||||
return result;
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add ignore discounts API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index e9912551e6a19d6ad3b20fad1b716577b9d28f99..415fa3591add1f1ab22dd5866e110dbfccd0ec93 100644
|
||||
index 94e742856244b99236ba458fa38801abb5acf286..f534d3afaa20abacfd9e6e15d31d592855667c57 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -459,6 +459,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -474,6 +474,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
|
||||
|
@ -16,7 +16,7 @@ index e9912551e6a19d6ad3b20fad1b716577b9d28f99..415fa3591add1f1ab22dd5866e110dbf
|
|||
|
||||
// CraftBukkit start
|
||||
int bonus = -Mth.floor((float) i * merchantrecipe.getPriceMultiplier());
|
||||
@@ -478,6 +479,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -493,6 +494,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next();
|
||||
|
@ -25,7 +25,7 @@ index e9912551e6a19d6ad3b20fad1b716577b9d28f99..415fa3591add1f1ab22dd5866e110dbf
|
|||
int k = (int) Math.floor(d0 * (double) merchantrecipe1.getBaseCostA().getCount());
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
index fa74813e0fe76612023830b2fc41d41aa0b4f10e..25a0f180967911d5916eb71334a94baec84eafbf 100644
|
||||
index 75827fcad36a551d832f4be094167936092b6caf..70b703b920752e7301e4f19cdc07a1a4ceac5e0e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -19,6 +19,7 @@ public class MerchantOffer {
|
||||
|
@ -45,40 +45,40 @@ index fa74813e0fe76612023830b2fc41d41aa0b4f10e..25a0f180967911d5916eb71334a94bae
|
|||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, false, bukkit);
|
||||
+ }
|
||||
+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, boolean ignoreDiscounts, CraftMerchantRecipe bukkit) {
|
||||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, ignoreDiscounts);
|
||||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, 0, ignoreDiscounts);
|
||||
+ // Paper end
|
||||
this.bukkitHandle = bukkit;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -59,6 +65,7 @@ public class MerchantOffer {
|
||||
|
||||
this.specialPriceDiff = nbttagcompound.getInt("specialPrice");
|
||||
this.demand = nbttagcompound.getInt("demand");
|
||||
+ this.ignoreDiscounts = nbttagcompound.getBoolean("Paper.IgnoreDiscounts"); // Paper
|
||||
this.specialPriceDiff = nbt.getInt("specialPrice");
|
||||
this.demand = nbt.getInt("demand");
|
||||
+ this.ignoreDiscounts = nbt.getBoolean("Paper.IgnoreDiscounts"); // Paper
|
||||
}
|
||||
|
||||
public MerchantOffer(ItemStack buyItem, ItemStack sellItem, int maxUses, int rewardedExp, float priceMultiplier) {
|
||||
public MerchantOffer(ItemStack buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) {
|
||||
@@ -70,10 +77,19 @@ public class MerchantOffer {
|
||||
}
|
||||
|
||||
public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int rewardedExp, float priceMultiplier) {
|
||||
- this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, rewardedExp, priceMultiplier, 0);
|
||||
public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) {
|
||||
- this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, 0);
|
||||
+ // Paper start - add ignoreDiscounts param
|
||||
+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, rewardedExp, priceMultiplier, false);
|
||||
+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, false);
|
||||
+ }
|
||||
+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int i, int j, int k, float f, boolean ignoreDiscounts) {
|
||||
+ this(itemstack, itemstack1, itemstack2, i, j, k, f, 0, ignoreDiscounts);
|
||||
+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, boolean ignoreDiscounts) {
|
||||
+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, 0, ignoreDiscounts);
|
||||
}
|
||||
|
||||
public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int i, int j, int k, float f, int l) {
|
||||
+ this(itemstack, itemstack1, itemstack2, i, j, k, f, l, false);
|
||||
public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) {
|
||||
+ this(firstBuyItem, secondBuyItem, sellItem, uses, maxUses, merchantExperience, priceMultiplier, demandBonus, false);
|
||||
+ }
|
||||
+ public MerchantOffer(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int i, int j, int k, float f, int l, boolean ignoreDiscounts) {
|
||||
+ public MerchantOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus, boolean ignoreDiscounts) {
|
||||
+ this.ignoreDiscounts = ignoreDiscounts;
|
||||
+ // Paper end
|
||||
this.rewardExp = true;
|
||||
this.xp = 1;
|
||||
this.baseCostA = itemstack;
|
||||
this.baseCostA = firstBuyItem;
|
||||
@@ -189,6 +205,7 @@ public class MerchantOffer {
|
||||
nbttagcompound.putFloat("priceMultiplier", this.priceMultiplier);
|
||||
nbttagcompound.putInt("specialPrice", this.specialPriceDiff);
|
||||
|
@ -88,7 +88,7 @@ index fa74813e0fe76612023830b2fc41d41aa0b4f10e..25a0f180967911d5916eb71334a94bae
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java
|
||||
index 212f9c7f3e73ffedf27b94abeac957b7d866a086..a6c8588f10c4c109833aea6a8b02c9048b6d9ea4 100644
|
||||
index 8dfbac01a7c88797bb7adfee6278d090da2bedc9..fc69347b03ce197584b310f99e14799046ed5b70 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java
|
||||
@@ -17,7 +17,12 @@ public class CraftMerchantRecipe extends MerchantRecipe {
|
|
@ -5,14 +5,13 @@ Subject: [PATCH] Toggle for removing existing dragon
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 02bb85364560784adea47c877c13291c3d016b86..424754a0183b071d20c86f0420cec784a8992e2b 100644
|
||||
index a88ef43adcf4ba36964f02e3fd363d3e018147cd..1a2f62fae9ccf31764d8e10642ef38bdb955dc41 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -683,4 +683,12 @@ public class PaperWorldConfig {
|
||||
log("Using vanilla redstone algorithm.");
|
||||
@@ -56,6 +56,14 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean shouldRemoveDragon = false;
|
||||
+ private void shouldRemoveDragon() {
|
||||
+ shouldRemoveDragon = getBoolean("should-remove-dragon", shouldRemoveDragon);
|
||||
|
@ -20,17 +19,20 @@ index 02bb85364560784adea47c877c13291c3d016b86..424754a0183b071d20c86f0420cec784
|
|||
+ log("The Ender Dragon will be removed if she already exists without a portal.");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public short keepLoadedRange;
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 590df3b93b897613cad74f9920aec62b33a2f7f7..84447e9845edad2d228b94184b35b4afb453a14b 100644
|
||||
index 9899c70b88fc371963e33caccd7125ef8c333df4..e1d689aa65b8d993c7223d306363366f3adff62f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -210,7 +210,7 @@ public class EndDragonFight {
|
||||
this.dragonUUID = entityenderdragon.getUUID();
|
||||
EndDragonFight.LOGGER.info("Found that there's a dragon still alive ({})", entityenderdragon);
|
||||
@@ -212,7 +212,7 @@ public class EndDragonFight {
|
||||
this.dragonUUID = enderDragon.getUUID();
|
||||
LOGGER.info("Found that there's a dragon still alive ({})", (Object)enderDragon);
|
||||
this.dragonKilled = false;
|
||||
- if (!flag) {
|
||||
+ if (!flag && this.level.paperConfig.shouldRemoveDragon) { // Paper
|
||||
EndDragonFight.LOGGER.info("But we didn't have a portal, let's remove it.");
|
||||
entityenderdragon.remove();
|
||||
- if (!bl) {
|
||||
+ if (!bl && this.level.paperConfig.shouldRemoveDragon) {
|
||||
LOGGER.info("But we didn't have a portal, let's remove it.");
|
||||
enderDragon.discard();
|
||||
this.dragonUUID = null;
|
|
@ -15,18 +15,10 @@ manually reload the advancement data for all players, which
|
|||
normally takes place as a part of the datapack reloading.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index acb41cc3965154c5b515cd8e808bf2cf5dc850e4..b8d3f2c59199e245e2035d6205dd1a042aa93f77 100644
|
||||
index e05e5710c81b7dbb648afbfe16f843e7ae310752..77e262f2236318e053da136037332fbe6d8bf380 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -97,6 +97,7 @@ public class PlayerAdvancements {
|
||||
|
||||
}
|
||||
|
||||
+ public final void reload(ServerAdvancementManager advancementDataWorld) { this.reload(advancementDataWorld); } // Paper - OBFHELPER
|
||||
public void reload(ServerAdvancementManager advancementLoader) {
|
||||
this.stopListening();
|
||||
this.advancements.clear();
|
||||
@@ -393,6 +394,7 @@ public class PlayerAdvancements {
|
||||
@@ -371,6 +371,7 @@ public class PlayerAdvancements {
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,7 +27,7 @@ index acb41cc3965154c5b515cd8e808bf2cf5dc850e4..b8d3f2c59199e245e2035d6205dd1a04
|
|||
if (this.isFirstPacket || !this.visibilityChanged.isEmpty() || !this.progressChanged.isEmpty()) {
|
||||
Map<ResourceLocation, AdvancementProgress> map = Maps.newHashMap();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 9a16882deee21faf78ea46e08b2f2ad3fbb6021b..ac94fd569bd4c79e30adef148e09e395ba8c1812 100644
|
||||
index 2984f5fa036019bb35a603690c568fc5c7b855d6..3d5f9ac267943fe2487a5cc4f9f059b169b438a8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -307,7 +307,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Item no age & no player pickup
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
index 9a410f557988d737c3b930a79ef2ccb2b5c8b406..aff17bb3bd22de492b9736d27b7f3e4bdb37134c 100644
|
||||
index 0d262c99c7e9ef06e297612b1802c493700f64ae..342345eb04d00efb58392ccf209e3c51c1064173 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -10,6 +10,12 @@ import org.bukkit.entity.Item;
|
||||
|
@ -21,7 +21,7 @@ index 9a410f557988d737c3b930a79ef2ccb2b5c8b406..aff17bb3bd22de492b9736d27b7f3e4b
|
|||
private final ItemEntity item;
|
||||
|
||||
public CraftItem(CraftServer server, Entity entity, ItemEntity item) {
|
||||
@@ -57,6 +63,26 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
@@ -59,6 +65,26 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
public void setCanMobPickup(boolean canMobPickup) {
|
||||
item.canMobPickup = canMobPickup;
|
||||
}
|
94
patches/server/0537-Beacon-API-custom-effect-ranges.patch
Normal file
94
patches/server/0537-Beacon-API-custom-effect-ranges.patch
Normal file
|
@ -0,0 +1,94 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 24 Jun 2020 12:39:08 -0600
|
||||
Subject: [PATCH] Beacon API - custom effect ranges
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf3481facd94 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -79,6 +79,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
return (BeaconBlockEntity.hasSecondaryEffect(this.levels, this.primaryPower, this.secondaryPower)) ? CraftPotionUtil.toBukkit(new MobEffectInstance(this.secondaryPower, BeaconBlockEntity.getLevel(this.levels), BeaconBlockEntity.getAmplification(this.levels, this.primaryPower, this.secondaryPower), true, true)) : null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - add field/methods for custom range
|
||||
+ private final String PAPER_RANGE_TAG = "Paper.Range";
|
||||
+ private double effectRange = -1;
|
||||
+
|
||||
+ public double getEffectRange() {
|
||||
+ if (this.effectRange < 0) {
|
||||
+ return this.levels * 10 + 10;
|
||||
+ } else {
|
||||
+ return effectRange;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void setEffectRange(double range) {
|
||||
+ this.effectRange = range;
|
||||
+ }
|
||||
+
|
||||
+ public void resetEffectRange() {
|
||||
+ this.effectRange = -1;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public BeaconBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.BEACON, pos, state);
|
||||
@@ -268,8 +288,13 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
}
|
||||
|
||||
public static List getHumansInRange(Level world, BlockPos blockposition, int i) {
|
||||
+ // Paper start
|
||||
+ return BeaconBlockEntity.getHumansInRange(world, blockposition, i, null);
|
||||
+ }
|
||||
+ public static List getHumansInRange(Level world, BlockPos blockposition, int i, @Nullable BeaconBlockEntity blockEntity) {
|
||||
+ // Paper end
|
||||
{
|
||||
- double d0 = (double) (i * 10 + 10);
|
||||
+ double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - custom beacon ranges
|
||||
|
||||
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
|
||||
List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);
|
||||
@@ -366,6 +391,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
}
|
||||
|
||||
this.lockKey = LockCode.fromTag(nbt);
|
||||
+ this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -379,6 +405,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
}
|
||||
|
||||
this.lockKey.addToTag(nbt);
|
||||
+ nbt.putDouble(PAPER_RANGE_TAG, this.effectRange); // Paper
|
||||
return nbt;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
index 5abf219e86c6b4cf0c6b2e8ea72d7ed7b4f612e3..e2b2625565a4ac39899de01a7fe660188f04c109 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||
@@ -108,4 +108,21 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
||||
public void setLock(String key) {
|
||||
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public double getEffectRange() {
|
||||
+ return this.getSnapshot().getEffectRange();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setEffectRange(double range) {
|
||||
+ this.getSnapshot().setEffectRange(range);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void resetEffectRange() {
|
||||
+ this.getSnapshot().resetEffectRange();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -5,14 +5,14 @@ Subject: [PATCH] Add API for quit reason
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 6f7cbce5a049d87d4a0ed7cc4517cb4e8694efb5..3ba9c38fc44a8edba9b504112a383249052a0035 100644
|
||||
index d32b96a5f51d745869cfc40c01c54de58e1eb843..759e563d1ed13249fada8a8eab6b6a10e5ef0d37 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -137,12 +137,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -142,12 +142,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
this.handlingFault = true;
|
||||
if (this.channel.isOpen()) {
|
||||
+ ServerPlayer player = this.getPlayer(); // Paper
|
||||
+ net.minecraft.server.level.ServerPlayer player = this.getPlayer(); // Paper
|
||||
if (throwable instanceof TimeoutException) {
|
||||
Connection.LOGGER.debug("Timeout", throwable);
|
||||
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper
|
||||
|
@ -23,24 +23,24 @@ index 6f7cbce5a049d87d4a0ed7cc4517cb4e8694efb5..3ba9c38fc44a8edba9b504112a383249
|
|||
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper
|
||||
if (flag) {
|
||||
Connection.LOGGER.debug("Failed to sent packet", throwable);
|
||||
this.send(new ClientboundDisconnectPacket(chatmessage), (future) -> {
|
||||
ConnectionProtocol enumprotocol = this.getCurrentProtocol();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index bd4d4ace35e966e819aa461d3962fe06ff402be7..1b5f24920c46cd238a79f5a2857d26fa1c12b983 100644
|
||||
index b49fa995973f860a95d937c98e2821435262ce25..41e6164fc9f3aa54028e5db1331df743126e55e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -258,6 +258,7 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||
|
||||
@@ -248,6 +248,7 @@ public class ServerPlayer extends Player {
|
||||
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
boolean needsChunkCenterUpdate; // Paper - no-tick view distance
|
||||
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ServerPlayerGameMode interactionManager) {
|
||||
super(world, world.getSpawn(), world.getSharedSpawnAngle(), profile);
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 3a114bec14fcc6c1e1045e2b99178a6adb25f387..ccfe5a1ec1e9895f7462b7c676fee80903502a88 100644
|
||||
index 0e0d6d298caa1bbb6fb0dd42fd00460f7609c431..fa57095f0ddd5685f848ade5c0ec2e90e2a07e91 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -447,6 +447,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -444,6 +444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -49,15 +49,15 @@ index 3a114bec14fcc6c1e1045e2b99178a6adb25f387..ccfe5a1ec1e9895f7462b7c676fee809
|
|||
this.connection.disconnect(ichatbasecomponent);
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7e44c911f4abc5c7d0e89513bf2cfc3516f13492..cda21726f4929b03191e912550d4e4b1232b3b0b 100644
|
||||
index 2f73f1f770e5e1fa422bec9c27e5bd10e86b7538..fe548b8625a123798f8d966cb3bffd899971cb34 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -586,7 +586,7 @@ public abstract class PlayerList {
|
||||
@@ -588,7 +588,7 @@ public abstract class PlayerList {
|
||||
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
|
||||
}
|
||||
|
||||
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
|
||||
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason
|
||||
if (entityplayer.didPlayerJoinEvent) cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit
|
||||
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
|
||||
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason
|
||||
if (entityplayer.didPlayerJoinEvent) this.cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit
|
||||
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||
|
71
patches/server/0539-Seed-based-feature-search.patch
Normal file
71
patches/server/0539-Seed-based-feature-search.patch
Normal file
|
@ -0,0 +1,71 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <mail@moep.tv>
|
||||
Date: Mon, 13 Jan 2020 15:40:32 +0100
|
||||
Subject: [PATCH] Seed based feature search
|
||||
|
||||
This tries to work around the issue where the server will load
|
||||
surrounding chunks up to a radius of 100 chunks in order to search for
|
||||
features e.g. when running the /locate command or for treasure maps
|
||||
(issue #2312).
|
||||
This is done by backporting Mojang's change in 1.17 which makes it so
|
||||
that the biome (generated by the seed) is checked first if the feature
|
||||
can be generated before actually to load the chunk.
|
||||
|
||||
Additionally to that the center location of the target chunk is simply
|
||||
returned if the chunk is not loaded to avoid the sync chunk load.
|
||||
As this can lead to less precise locations a toggle is provided to
|
||||
enable the sync loading of the target chunk again.
|
||||
|
||||
The main downside of this is that it breaks once the seed or generator
|
||||
changes but this should usually not happen. A config option to disable
|
||||
this completely is added though in case that should ever be necessary.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 1a2f62fae9ccf31764d8e10642ef38bdb955dc41..2097c579bda12c2d1d19d67a023ca94051509b51 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -379,6 +379,14 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean seedBasedFeatureSearch = true;
|
||||
+ public boolean seedBasedFeatureSearchLoadsChunks = false;
|
||||
+ private void seedBasedFeatureSearch() {
|
||||
+ seedBasedFeatureSearch = getBoolean("seed-based-feature-search", seedBasedFeatureSearch);
|
||||
+ seedBasedFeatureSearchLoadsChunks = getBoolean("seed-based-feature-search-loads-chunks", seedBasedFeatureSearchLoadsChunks);
|
||||
+ log("Feature search is based on seed: " + seedBasedFeatureSearch + ", loads chunks:" + seedBasedFeatureSearchLoadsChunks);
|
||||
+ }
|
||||
+
|
||||
public int maxCollisionsPerEntity;
|
||||
private void maxEntityCollision() {
|
||||
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
index 3878a7f6402a1dff1e019e16dd8772ec7303ebe7..ef77b7e54c9ce3379b3bd6991aebcb4889029907 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
|
||||
@@ -171,7 +171,24 @@ public abstract class StructureFeature<C extends FeatureConfiguration> {
|
||||
if (!world.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper
|
||||
boolean bl3 = world.getBiomeManager().getPrimaryBiomeAtChunk(chunkPos).getGenerationSettings().isValidStart(this);
|
||||
if (bl3) {
|
||||
- ChunkAccess chunkAccess = world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.STRUCTURE_STARTS);
|
||||
+ // Paper start - seed based feature search
|
||||
+ ChunkAccess chunkAccess = null;
|
||||
+ if (structureAccessor.getWorld().paperConfig.seedBasedFeatureSearch) {
|
||||
+ Biome biomeBase = structureAccessor.getWorld().getBiomeManager().getBiome(new BlockPos(chunkPos.getMinBlockX() + 9, 0, chunkPos.getMinBlockZ() + 9));
|
||||
+ if (!biomeBase.getGenerationSettings().isValidStart(this)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!structureAccessor.getWorld().paperConfig.seedBasedFeatureSearchLoadsChunks) {
|
||||
+ chunkAccess = structureAccessor.getWorld().getChunkIfLoaded(chunkPos.x, chunkPos.z);
|
||||
+ if (chunkAccess == null) {
|
||||
+ return chunkPos.getWorldPosition().offset(8, searchStartPos.getY(), 8);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (chunkAccess == null) {
|
||||
+ chunkAccess = world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.STRUCTURE_STARTS);
|
||||
+ }
|
||||
+ // Paper end
|
||||
StructureStart<?> structureStart = structureAccessor.getStartForFeature(SectionPos.bottomOf(chunkAccess), this, chunkAccess);
|
||||
if (structureStart != null && structureStart.isValid()) {
|
||||
if (skipExistingChunks && structureStart.canBeReferenced()) {
|
|
@ -11,14 +11,13 @@ in IWorldServerData are removed as they were only used in certain places, with h
|
|||
values used in other places.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 97870622e41cca36d9c7493bfad796f35f3831f4..5a451cc855de57f79a57670ba38e3af2343cb510 100644
|
||||
index 2097c579bda12c2d1d19d67a023ca94051509b51..afc637476380da272e61c10663dc77b30901c03a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -699,4 +699,17 @@ public class PaperWorldConfig {
|
||||
log("The Ender Dragon will be removed if she already exists without a portal.");
|
||||
@@ -64,6 +64,19 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ public int wanderingTraderSpawnMinuteTicks = 1200;
|
||||
+ public int wanderingTraderSpawnDayTicks = 24000;
|
||||
+ public int wanderingTraderSpawnChanceFailureIncrement = 25;
|
||||
|
@ -31,21 +30,15 @@ index 97870622e41cca36d9c7493bfad796f35f3831f4..5a451cc855de57f79a57670ba38e3af2
|
|||
+ wanderingTraderSpawnChanceMin = getInt("wandering-trader.spawn-chance-min", wanderingTraderSpawnChanceMin);
|
||||
+ wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public short keepLoadedRange;
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
index c297051bc48ff20a6764496cbf11eef601761d13..9074d57e1576db2da3e4c76add4f7e07e5567879 100644
|
||||
index 12aa0fd5b6bada9820c3a08eee47c870f9c183cb..60f08ecd0034e8ef2965b54b3abccce582d0ca54 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
@@ -30,49 +30,59 @@ public class WanderingTraderSpawner implements CustomSpawner {
|
||||
|
||||
private final Random random = new Random();
|
||||
private final ServerLevelData serverLevelData;
|
||||
- private int tickDelay;
|
||||
- private int spawnDelay;
|
||||
- private int spawnChance;
|
||||
+ private int tickDelay; public final int getMinuteTimer() { return this.tickDelay; } public final void setMinuteTimer(int x) { this.tickDelay = x; } // Paper - OBFHELPER
|
||||
+ private int spawnDelay; public final int getDayTimer() { return this.spawnDelay; } public final void setDayTimer(int x) { this.spawnDelay = x; } // Paper - OBFHELPER
|
||||
+ private int spawnChance; public final int getSpawnChance() { return this.spawnChance; } public final void setSpawnChance(int x) { this.spawnChance = x; } // Paper - OBFHELPER
|
||||
@@ -43,43 +43,53 @@ public class WanderingTraderSpawner implements CustomSpawner {
|
||||
|
||||
public WanderingTraderSpawner(ServerLevelData properties) {
|
||||
this.serverLevelData = properties;
|
||||
|
@ -59,14 +52,14 @@ index c297051bc48ff20a6764496cbf11eef601761d13..9074d57e1576db2da3e4c76add4f7e07
|
|||
- properties.setWanderingTraderSpawnChance(this.spawnChance);
|
||||
- }
|
||||
+ // Paper start
|
||||
+ this.setMinuteTimer(Integer.MIN_VALUE);
|
||||
+ //this.d = iworlddataserver.v(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
|
||||
+ //this.e = iworlddataserver.w(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
|
||||
+ //if (this.d == 0 && this.e == 0) {
|
||||
+ // this.d = 24000;
|
||||
+ // iworlddataserver.g(this.d);
|
||||
+ // this.e = 25;
|
||||
+ // iworlddataserver.h(this.e);
|
||||
+ this.tickDelay = Integer.MIN_VALUE;
|
||||
+ //this.spawnDelay = properties.getWanderingTraderSpawnDelay(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
|
||||
+ //this.spawnChance = properties.getWanderingTraderSpawnChance(); // Paper - This value is read from the world file only for the first spawn, after which vanilla uses a hardcoded value
|
||||
+ //if (this.spawnDelay == 0 && this.spawnChance == 0) {
|
||||
+ // this.spawnDelay = 24000;
|
||||
+ // properties.setWanderingTraderSpawnDelay(this.spawnDelay);
|
||||
+ // this.spawnChance = 25;
|
||||
+ // properties.setWanderingTraderSpawnChance(this.spawnChance);
|
||||
+ //}
|
||||
+ // Paper end
|
||||
|
||||
|
@ -75,45 +68,43 @@ index c297051bc48ff20a6764496cbf11eef601761d13..9074d57e1576db2da3e4c76add4f7e07
|
|||
@Override
|
||||
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
|
||||
+ // Paper start
|
||||
+ if (this.getMinuteTimer() == Integer.MIN_VALUE) {
|
||||
+ this.setMinuteTimer(world.paperConfig.wanderingTraderSpawnMinuteTicks);
|
||||
+ this.setDayTimer(world.paperConfig.wanderingTraderSpawnDayTicks);
|
||||
+ this.setSpawnChance(world.paperConfig.wanderingTraderSpawnChanceMin);
|
||||
+ if (this.tickDelay == Integer.MIN_VALUE) {
|
||||
+ this.tickDelay = world.paperConfig.wanderingTraderSpawnMinuteTicks;
|
||||
+ this.spawnDelay = world.paperConfig.wanderingTraderSpawnDayTicks;
|
||||
+ this.spawnChance = world.paperConfig.wanderingTraderSpawnChanceMin;
|
||||
+ }
|
||||
if (!world.getGameRules().getBoolean(GameRules.RULE_DO_TRADER_SPAWNING)) {
|
||||
return 0;
|
||||
- } else if (--this.tickDelay > 0) {
|
||||
+ } else if (this.getMinuteTimer() - 1 > 0) {
|
||||
+ this.setMinuteTimer(this.getMinuteTimer() - 1);
|
||||
+ } else if (this.tickDelay - 1 > 0) {
|
||||
+ this.tickDelay = this.tickDelay - 1;
|
||||
return 0;
|
||||
} else {
|
||||
- this.tickDelay = 1200;
|
||||
- this.spawnDelay -= 1200;
|
||||
- this.serverLevelData.setWanderingTraderSpawnDelay(this.spawnDelay);
|
||||
- if (this.spawnDelay > 0) {
|
||||
+ this.setMinuteTimer(world.paperConfig.wanderingTraderSpawnMinuteTicks);
|
||||
+ this.setDayTimer(getDayTimer() - world.paperConfig.wanderingTraderSpawnMinuteTicks);
|
||||
+ //this.b.g(this.d); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways
|
||||
+ if (this.getDayTimer() > 0) {
|
||||
+ this.tickDelay = world.paperConfig.wanderingTraderSpawnMinuteTicks;
|
||||
+ this.spawnDelay = this.spawnDelay - world.paperConfig.wanderingTraderSpawnMinuteTicks;
|
||||
+ //this.serverLevelData.setWanderingTraderSpawnDelay(this.spawnDelay); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways
|
||||
if (this.spawnDelay > 0) {
|
||||
return 0;
|
||||
} else {
|
||||
- this.spawnDelay = 24000;
|
||||
+ this.setDayTimer(world.paperConfig.wanderingTraderSpawnDayTicks);
|
||||
+ this.spawnDelay = world.paperConfig.wanderingTraderSpawnDayTicks;
|
||||
if (!world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
return 0;
|
||||
} else {
|
||||
- int i = this.spawnChance;
|
||||
+ int i = this.getSpawnChance();
|
||||
int i = this.spawnChance;
|
||||
|
||||
- this.spawnChance = Mth.clamp(this.spawnChance + 25, 25, 75);
|
||||
- this.serverLevelData.setWanderingTraderSpawnChance(this.spawnChance);
|
||||
+ this.setSpawnChance(Mth.clamp(i + world.paperConfig.wanderingTraderSpawnChanceFailureIncrement, world.paperConfig.wanderingTraderSpawnChanceMin, world.paperConfig.wanderingTraderSpawnChanceMax));
|
||||
+ //this.b.h(this.e); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways
|
||||
+ this.spawnChance = Mth.clamp(i + world.paperConfig.wanderingTraderSpawnChanceFailureIncrement, world.paperConfig.wanderingTraderSpawnChanceMin, world.paperConfig.wanderingTraderSpawnChanceMax);
|
||||
+ //this.serverLevelData.setWanderingTraderSpawnChance(this.spawnChance); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways
|
||||
if (this.random.nextInt(100) > i) {
|
||||
return 0;
|
||||
} else if (this.spawn(world)) {
|
||||
- this.spawnChance = 25;
|
||||
+ this.setSpawnChance(world.paperConfig.wanderingTraderSpawnChanceMin);
|
||||
+ this.spawnChance = world.paperConfig.wanderingTraderSpawnChanceMin;
|
||||
+ // Paper end
|
||||
return 1;
|
||||
} else {
|
|
@ -0,0 +1,63 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SuperCoder7979 <25208576+SuperCoder7979@users.noreply.github.com>
|
||||
Date: Tue, 3 Nov 2020 23:48:05 -0600
|
||||
Subject: [PATCH] Significantly improve performance of the end generation
|
||||
|
||||
This patch implements a noise cache for the end which significantly reduces the computation time of generation. This results in about a 3x improvement.
|
||||
|
||||
Original code by SuperCoder7979 and Gegy in Lithium, licensed under LGPL-3.0 (Source: https://github.com/jellysquid3/lithium-fabric)
|
||||
|
||||
Co-authored-by: Gegy <gegy1000@gmail.com>
|
||||
Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
|
||||
Co-authored-by: pop4959 <pop4959@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
index 9a64ab092ac8616ed8b9ea5c1e8677dda5c4333c..b4bc60b9251a141e9a276877a9be76a381ff351b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java
|
||||
@@ -28,6 +28,16 @@ public class TheEndBiomeSource extends BiomeSource {
|
||||
private final Biome midlands;
|
||||
private final Biome islands;
|
||||
private final Biome barrens;
|
||||
+ // Paper start
|
||||
+ private static final class NoiseCache {
|
||||
+ public long[] keys = new long[8192];
|
||||
+ public float[] values = new float[8192];
|
||||
+ public NoiseCache() {
|
||||
+ java.util.Arrays.fill(keys, Long.MIN_VALUE);
|
||||
+ }
|
||||
+ }
|
||||
+ private static final ThreadLocal<java.util.Map<SimplexNoise, NoiseCache>> noiseCache = ThreadLocal.withInitial(java.util.WeakHashMap::new);
|
||||
+ // Paper end
|
||||
|
||||
public TheEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||
this(biomeRegistry, seed, biomeRegistry.getOrThrow(Biomes.THE_END), biomeRegistry.getOrThrow(Biomes.END_HIGHLANDS), biomeRegistry.getOrThrow(Biomes.END_MIDLANDS), biomeRegistry.getOrThrow(Biomes.SMALL_END_ISLANDS), biomeRegistry.getOrThrow(Biomes.END_BARRENS));
|
||||
@@ -87,12 +97,26 @@ public class TheEndBiomeSource extends BiomeSource {
|
||||
float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow
|
||||
f = Mth.clamp(f, -100.0F, 80.0F);
|
||||
|
||||
+ NoiseCache cache = noiseCache.get().computeIfAbsent(simplexNoise, noiseKey -> new NoiseCache()); // Paper
|
||||
for(int o = -12; o <= 12; ++o) {
|
||||
for(int p = -12; p <= 12; ++p) {
|
||||
long q = (long)(k + o);
|
||||
long r = (long)(l + p);
|
||||
- if (q * q + r * r > 4096L && simplexNoise.getValue((double)q, (double)r) < (double)-0.9F) {
|
||||
- float g = (Mth.abs((float)q) * 3439.0F + Mth.abs((float)r) * 147.0F) % 13.0F + 9.0F;
|
||||
+ // Paper start - Significantly improve end generation performance by using a noise cache
|
||||
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) q, (int) q);
|
||||
+ int index = (int) it.unimi.dsi.fastutil.HashCommon.mix(key) & 8191;
|
||||
+ float g = Float.MIN_VALUE;
|
||||
+ if (cache.keys[index] == key) {
|
||||
+ g = cache.values[index];
|
||||
+ } else {
|
||||
+ if (q * q + r * r > 4096L && simplexNoise.getValue((double)q, (double)r) < (double)-0.9F) {
|
||||
+ g = (Mth.abs((float) q) * 3439.0F + Mth.abs((float) r) * 147.0F) % 13.0F + 9.0F;
|
||||
+ }
|
||||
+ cache.keys[index] = key;
|
||||
+ cache.values[index] = g;
|
||||
+ }
|
||||
+ if (g != Float.MIN_VALUE) {
|
||||
+ // Paper end
|
||||
float h = (float)(m - o * 2);
|
||||
float s = (float)(n - p * 2);
|
||||
float t = 100.0F - Mth.sqrt(h * h + s * s) * g;
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose world spawn angle
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index cda21726f4929b03191e912550d4e4b1232b3b0b..7e07fd0c8dec9f9cdeda65dfa0ccf42b4dde010e 100644
|
||||
index fe548b8625a123798f8d966cb3bffd899971cb34..ce6d9b460f0f55fc6d5544d5c8d2b78e5fcc3937 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -890,7 +890,7 @@ public abstract class PlayerList {
|
||||
@@ -865,7 +865,7 @@ public abstract class PlayerList {
|
||||
if (location == null) {
|
||||
worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
|
@ -16,27 +16,15 @@ index cda21726f4929b03191e912550d4e4b1232b3b0b..7e07fd0c8dec9f9cdeda65dfa0ccf42b
|
|||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
|
||||
}
|
||||
|
||||
Player respawnPlayer = cserver.getPlayer(entityplayer1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelData.java b/src/main/java/net/minecraft/world/level/storage/LevelData.java
|
||||
index 12a2371b15588ae84824d7a2d36a6d4c37e77013..078cee770a77b77d9b4a777754599d7b0b31f54b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/LevelData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/LevelData.java
|
||||
@@ -12,6 +12,7 @@ public interface LevelData {
|
||||
|
||||
int getZSpawn();
|
||||
|
||||
+ default float getSpawnAngle() { return getSpawnAngle(); } // Paper - OBFHELPER
|
||||
float getSpawnAngle();
|
||||
|
||||
long getGameTime();
|
||||
Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 28bf53bc9fca21f57cd4851adf508d833ecdd33b..aaf97c13babce3b0ffc639ef950d59d1eba1398a 100644
|
||||
index d0b2de0f0a37554eb812aa8c7c20f1067807dc40..ed8c8b7ff07a58dfaf7bbb1e630a1e68cc0c29f3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -362,7 +362,7 @@ public class CraftWorld implements World {
|
||||
@@ -377,7 +377,7 @@ public class CraftWorld implements World {
|
||||
@Override
|
||||
public Location getSpawnLocation() {
|
||||
BlockPos spawn = world.getSpawn();
|
||||
BlockPos spawn = this.world.getSharedSpawnPos();
|
||||
- return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ());
|
||||
+ return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ(), world.levelData.getSpawnAngle(), 0.0F); // Paper - expose world spawn angle
|
||||
}
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
|
|||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 37eceaef1212e2ee13aa763a5ede24ec170e5391..9defb202761296a825d035e27ddc51e17a311647 100644
|
||||
index aa81c0a4c02fd6f2ab900983fd8c9668fada802e..597ac36c6f6748ecfbf64920da172758814b8061 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -766,5 +766,23 @@ public class CraftBlock implements Block {
|
||||
@@ -782,5 +782,23 @@ public class CraftBlock implements Block {
|
||||
public String getTranslationKey() {
|
||||
return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
|
@ -5,15 +5,15 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 94240b70e245bdc3dda60420f5787f8d5dcc1958..40380fff222cc1f3340cf6a6c4afbe60aaa5d3a6 100644
|
||||
index 41bb480e61ff98dd35b8e059356bf867406e9e5e..9236027beb13ae4f2e35c46f6c176fd5d7d20b4f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2008,7 +2008,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2047,7 +2047,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (data != null && !particle.getDataType().isInstance(data)) {
|
||||
throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
|
||||
}
|
||||
- ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(CraftParticle.toNMS(particle, data), true, (float) x, (float) y, (float) z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) extra, count);
|
||||
+ ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(CraftParticle.toNMS(particle, data), true, x, y, z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) extra, count); // Paper - Fix x/y/z coordinate precision loss
|
||||
getHandle().connection.send(packetplayoutworldparticles);
|
||||
this.getHandle().connection.send(packetplayoutworldparticles);
|
||||
|
||||
}
|
|
@ -5,11 +5,11 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index eb136af0f99f5d7520ceabb98cefd5a01122872c..170bb1124ee396a85dd64baed8110e39823ad849 100644
|
||||
index c01eae70fe12970e9f617bf14e542b33572bcf4c..18635227a39c96e350fbb8ee9918c41c7a645aa6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -773,6 +773,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
return getHandle().useItem.asBukkitMirror();
|
||||
return getHandle().getUseItem().asBukkitMirror();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -21,4 +21,4 @@ index eb136af0f99f5d7520ceabb98cefd5a01122872c..170bb1124ee396a85dd64baed8110e39
|
|||
+
|
||||
@Override
|
||||
public int getItemUseRemainingTime() {
|
||||
return getHandle().getItemUseRemainingTime();
|
||||
return getHandle().getUseItemRemainingTicks();
|
|
@ -5,29 +5,17 @@ Subject: [PATCH] Add PlayerItemCooldownEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
|
||||
index 93161583c215e1832570b39e72f7e7cfb94a700c..1983cdcefed60795e8c88737ae3459d5821cdcfa 100644
|
||||
index 47283d2a49209839002212e663a503a82ea86587..ce026600b3b5c846d991a0dfe599708caf2a2962 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
|
||||
@@ -1,16 +1,27 @@
|
||||
package net.minecraft.world.item;
|
||||
|
||||
+import io.papermc.paper.event.player.PlayerItemCooldownEvent; // Paper
|
||||
import net.minecraft.network.protocol.game.ClientboundCooldownPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class ServerItemCooldowns extends ItemCooldowns {
|
||||
|
||||
- private final ServerPlayer player;
|
||||
+ private final ServerPlayer player; public ServerPlayer getEntityPlayer() { return player; } // Paper - OBFHELPER
|
||||
|
||||
public ServerItemCooldowns(ServerPlayer player) {
|
||||
@@ -10,6 +10,16 @@ public class ServerItemCooldowns extends ItemCooldowns {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void addCooldown(Item item, int duration) {
|
||||
+ PlayerItemCooldownEvent event = new PlayerItemCooldownEvent(getEntityPlayer().getBukkitEntity(), org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), duration);
|
||||
+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), duration);
|
||||
+ if (event.callEvent()) {
|
||||
+ super.addCooldown(item, event.getCooldown());
|
||||
+ }
|
|
@ -5,64 +5,50 @@ Subject: [PATCH] More lightning API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
index 4b0dbeded2b8a475d32f518957909d3495a4b6fc..3fdef4511e21e453b89e42a8f41e587fe300ba6b 100644
|
||||
index e476bc8013ac199713e3aaae787bb61fab736aeb..fff23f1cd9da385781547664f26b59255487e2b1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
@@ -28,7 +28,7 @@ public class LightningBolt extends Entity {
|
||||
|
||||
private int life;
|
||||
@@ -39,9 +39,9 @@ public class LightningBolt extends Entity {
|
||||
private static final int START_LIFE = 2;
|
||||
private static final double DAMAGE_RADIUS = 3.0D;
|
||||
private static final double DETECTION_RADIUS = 15.0D;
|
||||
- private int life;
|
||||
+ public int life; // Paper - private -> public
|
||||
public long seed;
|
||||
- private int flashes;
|
||||
+ private int flashes; public int getFlashCount() { return flashes; } public void setFlashCount(int flashes) { this.flashes = flashes; } // Paper - OBFHELPER
|
||||
+ public int flashes; // Paper - private -> public
|
||||
public boolean visualOnly;
|
||||
@Nullable
|
||||
private ServerPlayer cause;
|
||||
@@ -46,6 +46,16 @@ public class LightningBolt extends Entity {
|
||||
this.visualOnly = cosmetic;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public int getLifeTicks() {
|
||||
+ return life;
|
||||
+ }
|
||||
+
|
||||
+ public void setLifeTicks(int lifeTicks) {
|
||||
+ this.life = lifeTicks;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public SoundSource getSoundSource() {
|
||||
return SoundSource.WEATHER;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
||||
index 26506c22592b58b208487fb244985361d70988a8..c1593bb345b38deb4d8b28a73d8dc6246c17b873 100644
|
||||
index f7991ff14ef9cda0327b8621bf615b49cffd7ac5..db6b158f18ad7b9171a8c041802e3495d733bc16 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
||||
@@ -45,4 +45,27 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
||||
return spigot;
|
||||
return this.spigot;
|
||||
}
|
||||
// Spigot end
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int getFlashCount() {
|
||||
+ return getHandle().getFlashCount();
|
||||
+ return getHandle().flashes;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFlashCount(int flashes) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(flashes >= 0, "Flashes has to be a positive number!");
|
||||
+ getHandle().setFlashCount(flashes);
|
||||
+ getHandle().flashes = flashes;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getLifeTicks() {
|
||||
+ return getHandle().getLifeTicks();
|
||||
+ return getHandle().life;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setLifeTicks(int lifeTicks) {
|
||||
+ getHandle().setLifeTicks(lifeTicks);
|
||||
+ getHandle().life = lifeTicks;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -5,24 +5,26 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 5a451cc855de57f79a57670ba38e3af2343cb510..7d3207a9af8360ddad228281d6aa65e1a0d24157 100644
|
||||
index afc637476380da272e61c10663dc77b30901c03a..247b30b2b2edbb1043b6385039ba830dea877c55 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -712,4 +712,9 @@ public class PaperWorldConfig {
|
||||
wanderingTraderSpawnChanceMin = getInt("wandering-trader.spawn-chance-min", wanderingTraderSpawnChanceMin);
|
||||
@@ -77,6 +77,11 @@ public class PaperWorldConfig {
|
||||
wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax);
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean fixClimbingBypassingCrammingRule = false;
|
||||
+ private void fixClimbingBypassingCrammingRule() {
|
||||
+ fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public short keepLoadedRange;
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 90e9797cc1f3a4aa0a2bee28dca364e6f6dd0c0b..ec98f5f59ca2b4cb58eb00ed8cdfa364f8bacd88 100644
|
||||
index d64caca72a5302392df944d4c60ed2ba79a19ee7..785970057ceb7a58049f9d36ac0eaa122637430f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1573,6 +1573,12 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
@@ -1704,6 +1704,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
}
|
||||
|
||||
public boolean isPushable() {
|
||||
|
@ -36,10 +38,10 @@ index 90e9797cc1f3a4aa0a2bee28dca364e6f6dd0c0b..ec98f5f59ca2b4cb58eb00ed8cdfa364
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
index 8ce62148ebaeac9988e7c9d4b2f7ee57f58d883e..8d1e24c2fa844971908ae7ac918a8950026b40a6 100644
|
||||
index 8fb89326395a7e70982c0d757b506565e98b12a4..a060cca08631fb42041e3a79a9abc422fe7757af 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
@@ -51,11 +51,17 @@ public final class EntitySelector {
|
||||
@@ -44,11 +44,17 @@ public final class EntitySelector {
|
||||
}
|
||||
|
||||
public static Predicate<Entity> pushableBy(Entity entity) {
|
||||
|
@ -53,34 +55,26 @@ index 8ce62148ebaeac9988e7c9d4b2f7ee57f58d883e..8d1e24c2fa844971908ae7ac918a8950
|
|||
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteambase == null ? Team.CollisionRule.ALWAYS : scoreboardteambase.getCollisionRule();
|
||||
|
||||
return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> {
|
||||
- if (!entity1.canCollideWithCb(entity) || !entity.canCollideWithCb(entity1)) { // CraftBukkit - collidable API
|
||||
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithCb(entity) || !entity.canCollideWithCb(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
|
||||
- if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
|
||||
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
|
||||
return false;
|
||||
} else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9724d4222311345a44aa101ec47523a1909fbe8f..57b933afdbb2136ed48170da6945eb2b92edb4db 100644
|
||||
index 8781b3ac40f214974ebb3e06c789f1717735d3a6..19ef1b2814270b9385ea15a89dac8c2613a672ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -134,7 +134,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
||||
public abstract class LivingEntity extends Entity {
|
||||
|
||||
@@ -2956,7 +2955,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3271,7 +3271,7 @@ public abstract class LivingEntity extends Entity {
|
||||
return;
|
||||
}
|
||||
// Paper - end don't run getEntities if we're not going to use its result
|
||||
// Paper end - don't run getEntities if we're not going to use its result
|
||||
- List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
||||
+ List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
// Paper - move up
|
||||
@@ -3094,9 +3093,16 @@ public abstract class LivingEntity extends Entity {
|
||||
return !this.removed && this.collides; // CraftBukkit
|
||||
@@ -3438,9 +3438,16 @@ public abstract class LivingEntity extends Entity {
|
||||
return !this.isRemoved() && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
|
@ -98,10 +92,10 @@ index 9724d4222311345a44aa101ec47523a1909fbe8f..57b933afdbb2136ed48170da6945eb2b
|
|||
|
||||
// CraftBukkit start - collidable API
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
index e56c575d744e1efe9a7512f337b781dc3715f6be..8e02e3a4464ab4096637fc69c03d083988bb426e 100644
|
||||
index 7a7b566d781560a85e184a0e67977ba75e6262c5..4716ece9bd1db50c87ccadc44d9ea3c43e741338 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -75,7 +75,7 @@ public class Bat extends AmbientCreature {
|
||||
@@ -83,7 +83,7 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,10 +105,10 @@ index e56c575d744e1efe9a7512f337b781dc3715f6be..8e02e3a4464ab4096637fc69c03d0839
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
index 918628c0ed8fb32d44c034fddf045f08659c10f8..d6a9d0e94d80f1924cedef913829d15762456537 100644
|
||||
index 23f87848b42d180c94b5659b184a768a756deed8..345fe87d5d6c3883c28d2c1b34d1020e18864d97 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -368,8 +368,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
@@ -380,8 +380,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,10 +120,10 @@ index 918628c0ed8fb32d44c034fddf045f08659c10f8..d6a9d0e94d80f1924cedef913829d157
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index d9bfc754d7544a54ff214b41b4f6c0a6bc66df28..b298bcfb665b1036cd21445cec1518069eb08f06 100644
|
||||
index c9e0d66443387f3f3e3999ee84d523550f48f573..d9699a422164c30a8386a8042202e1a8bc0ab2b0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -226,7 +226,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@@ -240,7 +240,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,10 +133,10 @@ index d9bfc754d7544a54ff214b41b4f6c0a6bc66df28..b298bcfb665b1036cd21445cec151806
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 5714aa450ac09788bcf1c2790d4f1581c9a7c28b..a89573670f7dccfd8f0c81fcd95673b6faf3fc10 100644
|
||||
index 5bfec185e15a54ee5fe6eab1aa59d1963d046262..d098d9f9280d2e08596491264a46a8978aaeaca7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -358,7 +358,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -345,7 +345,7 @@ public class ArmorStand extends LivingEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,10 +146,10 @@ index 5714aa450ac09788bcf1c2790d4f1581c9a7c28b..a89573670f7dccfd8f0c81fcd95673b6
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
index 1257a740a4ab79870fe89057782e8ffc6c658c14..9cbde70787d8044f0edeb3d459231dd7fbb79584 100644
|
||||
index fa889f93a5c6782957bdbf803915cb5e80e05f3e..9653b142c199c068e4d6175bcd3cbecb6465853f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -144,7 +144,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||
@@ -149,7 +149,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,10 +159,10 @@ index 1257a740a4ab79870fe89057782e8ffc6c658c14..9cbde70787d8044f0edeb3d459231dd7
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index bddc51c656f04f25744ec29cabab31d465cf8bce..4f82c6797fe9bbb1a29420ea15277be50e44808c 100644
|
||||
index 3f1059569da23bd02c00279050bf7bce7a160462..a1b93f2878e22fa1d0cad639416d2dc5b8339c73 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -149,7 +149,7 @@ public class Boat extends Entity {
|
||||
@@ -158,7 +158,7 @@ public class Boat extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in a new issue