13
0
geforkt von Mirrors/Paper

even even even even even even even even even more changes

Dieser Commit ist enthalten in:
Spottedleaf 2021-06-12 00:24:28 -07:00 committet von MiniDigger | Martin
Ursprung 9da160169a
Commit b1517fe9f2
18 geänderte Dateien mit 162 neuen und 229 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1380a26f34a9d2b162e88fbea14b17118945643c..7b3a0c958b4b4bffb6c19a0e4d3bf4824f8db237 100644
index 72375883b07ede041a7ea5f7b6785f71aef702c0..55cd39f1e3787bcd34c6d528738122590ec580ec 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1759,6 +1759,15 @@ public final class Bukkit {
@ -26,7 +26,7 @@ index 1380a26f34a9d2b162e88fbea14b17118945643c..7b3a0c958b4b4bffb6c19a0e4d3bf482
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4c201097ef98f545acb604fa72d56413553e4d4f..6f4817af249e258905c97f4dac3d2f33804bdfc5 100644
index a2940eafa61814aae7f766262309495e991533d6..08f451c392682cc0147ba14759c6b7edf7ff533f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1551,4 +1551,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index e94ec567fbda93f4f5783f84b4b5136b309d0eab..fddc063798edc8084ca695578a47485204a7f3cd 100644
index 26223028f68534ee81c6452dd3b0ab7aca03f1e8..de9ddd2c40261486ee8de6693d118cffaa2dd793 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -344,4 +344,21 @@ public interface ArmorStand extends LivingEntity {

Datei anzeigen

@ -1,106 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 09d39b73e8a3987e58a502bd914a6451b807421b..46f0ebfc99352ec8b64bdff2c6bb8d17ecfeb619 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1,6 +1,5 @@
package net.minecraft.world.entity;
-import PathfinderGoalFloat;
import com.google.common.collect.Maps;
import java.util.Arrays;
import java.util.Iterator;
@@ -39,6 +38,7 @@ import net.minecraft.world.entity.ai.control.BodyRotationControl;
import net.minecraft.world.entity.ai.control.JumpControl;
import net.minecraft.world.entity.ai.control.LookControl;
import net.minecraft.world.entity.ai.control.MoveControl;
+import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.GoalSelector;
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
@@ -47,6 +47,8 @@ import net.minecraft.world.entity.ai.sensing.Sensing;
import net.minecraft.world.entity.decoration.HangingEntity;
import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.entity.item.ItemEntity;
+import net.minecraft.world.entity.monster.Blaze;
+import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.entity.monster.Enemy;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.Boat;
@@ -97,7 +99,7 @@ public abstract class Mob extends LivingEntity {
private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation;
public GoalSelector goalSelector;
- @Nullable public PathfinderGoalFloat goalFloat; // Paper
+ @Nullable public FloatGoal goalFloat; // Paper
public GoalSelector targetSelector;
private LivingEntity target;
private final Sensing sensing;
@@ -789,7 +791,7 @@ public abstract class Mob extends LivingEntity {
if (goalFloat.validConditions()) goalFloat.update();
this.getJumpControl().jumpIfSet();
}
- if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) {
+ if ((this instanceof Blaze || this instanceof EnderMan) && isInWaterOrRainOrBubble()) {
hurt(DamageSource.DROWN, 1.0F);
}
return;
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 438dd75e3adffc395960b34b8bb26cbc07a4291e..8b6ec9ddf0d47bf4369b247e764f75893ab15781 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -26,6 +26,7 @@ import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.MoverType;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.vehicle.AbstractMinecart;
@@ -75,6 +76,7 @@ public class ArmorStand extends LivingEntity {
public Rotations rightArmPose;
public Rotations leftLegPose;
public Rotations rightLegPose;
+ public boolean canMove = true; // Paper
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
super(type, world);
@@ -858,4 +860,13 @@ public class ArmorStand extends LivingEntity {
private EntityDimensions getDimensionsMarker(boolean flag) {
return flag ? ArmorStand.MARKER_DIMENSIONS : (this.isBaby() ? ArmorStand.BABY_DIMENSIONS : this.getType().getDimensions());
}
+
+ // Paper start
+ @Override
+ public void move(MoverType type, Vec3 movement) {
+ if (this.canMove) {
+ super.move(type, movement);
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 6b292162fb8c6416b1637b7b83e5113f6a35dbac..16f996d505b96da8a40c7709214ebbd2a0d0d9f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -228,4 +228,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0;
}
+ // Paper start
+ @Override
+ public boolean canMove() {
+ return getHandle().canMove;
+ }
+
+ @Override
+ public void setCanMove(boolean move) {
+ getHandle().canMove = move;
+ }
+ // Paper end
}

Datei anzeigen

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 27 Dec 2016 15:02:42 -0500
Subject: [PATCH] String based Action Bar API
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 67fa685f4b8de3eae1431c0de399c246678b542a..7b36274718b7cce24ac00530697f145648d52590 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -58,7 +58,7 @@ public class Util {
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
private static final ExecutorService IO_POOL = makeIoExecutor();
public static LongSupplier timeSource = System::nanoTime;
- public static final UUID NIL_UUID = new UUID(0L, 0L);
+ public static final UUID NIL_UUID = new UUID(0L, 0L); public static final UUID getNullUUID() {return NIL_UUID;} // Paper OBFHELPER
private static final Logger LOGGER = LogManager.getLogger();
public static <K, V> Collector<Entry<? extends K, ? extends V>, ?, Map<K, V>> toMap() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fc19b4cacd223b928fbdf922b828beaed630bf2e..d6d4e5ab7551f802dc2d3ab055d340d471ed0bc2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -242,6 +242,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper start
+ @Override
+ public void sendActionBar(BaseComponent[] message) {
+ if (getHandle().connection == null) return;
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, message, -1, -1, -1));
+ }
+
+ @Override
+ public void sendActionBar(String message) {
+ if (getHandle().connection == null || message == null || message.isEmpty()) return;
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, CraftChatMessage.fromStringOrNull(message)));
+ }
+
+ @Override
+ public void sendActionBar(char alternateChar, String message) {
+ if (message == null || message.isEmpty()) return;
+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message));
+ }
+
@Override
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
if (header != null) {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bbe0978f56d23b7defce765d381d4a7c20acd75c..9365fd2bcf74755c90c4ae9b550969e97a22c639 100644
index 91002473f54fd0ac95489b9448fe91072565881d..13993c425daf112393472f791480f9105038f104 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2281,5 +2281,24 @@ public final class CraftServer implements Server {
@@ -2280,5 +2280,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
}

Datei anzeigen

@ -5,31 +5,23 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index a4a1e836767d0b2b71c3277a28eb72418fa76210..f932fc4f8240b48f8e518af05d1521bc8ff9cbee 100644
index 7df6946dcb2a7fbc625681dfbae1e15be625875b..1953739fd2ead7680273ef63d8506e546758dc9b 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -202,7 +202,7 @@ public class ExperienceOrb extends Entity {
}
@@ -249,7 +249,7 @@ public class ExperienceOrb extends Entity {
int i = this.repairPlayerItems(player, this.value);
if (this.value > 0) {
- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
if (i > 0) {
- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
+ player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object
}
this.remove();
--this.count;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 81af3e2e0964b6e179f92a342efdae943be18b75..c85fcad33e17c8ae2e4ee5cb873dbd4166fcc7f5 100644
index cb3f1f71cc5c5a18c0af818679b72583a7edec7c..c981bb0e1e7c4c8b7603e2ac8e483ad5b4a2c742 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -109,6 +109,7 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Villager.Profession;
+import org.bukkit.entity.ExperienceOrb; // Paper
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -1045,6 +1046,17 @@ public class CraftEventFactory {
@@ -1041,6 +1041,17 @@ public class CraftEventFactory {
return event;
}
@ -45,5 +37,5 @@ index 81af3e2e0964b6e179f92a342efdae943be18b75..c85fcad33e17c8ae2e4ee5cb873dbd41
+ // Paper end
+
public static boolean handleBlockGrowEvent(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState block) {
return handleBlockGrowEvent(world, pos, block, 3);
return CraftEventFactory.handleBlockGrowEvent(world, pos, block, 3);
}

Datei anzeigen

@ -5,16 +5,16 @@ Subject: [PATCH] Don't let fishinghooks use portals
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 2f67c2065ef29f17f12190b25bd1ea53e1fb55b4..fa078167dd9e0cae80516549eef0e554c13938a3 100644
index c30b53d07bcd2575d65c323d8170573bbe85f212..d25fe9cb2cf755f3e34a79ce87ed38c1ffada53f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -237,6 +237,11 @@ public class FishingHook extends Projectile {
@@ -253,6 +253,11 @@ public class FishingHook extends Projectile {
this.setDeltaMovement(this.getDeltaMovement().scale(0.92D));
this.reapplyPosition();
+ // Paper start - These shouldn't be going through portals
+ if (this.isInsidePortal) {
+ this.remove();
+ this.discard();
+ }
+ // Paper end
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 0dc5792d542658107c9c22c1f920986decd13920..3ce431c1fdf1f5bd62b49f26cca188e939e98efa 100644
index 676e5ad3a23bfdccd8f5f7bb9e79c3fa004dc95f..71f0de893fe0243cc226fd36685f2a3fba02575f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -196,6 +196,17 @@ public abstract class AbstractArrow extends Projectile {
@@ -225,6 +225,17 @@ public abstract class AbstractArrow extends Projectile {
}
}
@ -27,10 +27,10 @@ index 0dc5792d542658107c9c22c1f920986decd13920..3ce431c1fdf1f5bd62b49f26cca188e9
this.preOnHit((HitResult) object); // CraftBukkit - projectile hit event
this.hasImpulse = true;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
index bdff1c57f64d1bf29f2050f06c8b585d395b2c5c..872ff430547276e2a41a48aa07ae63b87ab39e5d 100644
index a8b51bece92676f1964a795112a1d490b437ed0f..dd5209ab2e5b59312349e709392689f25da162c0 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
@@ -12,6 +12,7 @@ import net.minecraft.world.entity.Entity;
@@ -11,6 +11,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
@ -38,7 +38,7 @@ index bdff1c57f64d1bf29f2050f06c8b585d395b2c5c..872ff430547276e2a41a48aa07ae63b8
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -71,7 +72,16 @@ public abstract class AbstractHurtingProjectile extends Projectile {
@@ -82,7 +83,16 @@ public abstract class AbstractHurtingProjectile extends Projectile {
HitResult movingobjectposition = ProjectileUtil.getHitResult((Entity) this, this::canHitEntity);
@ -57,10 +57,10 @@ index bdff1c57f64d1bf29f2050f06c8b585d395b2c5c..872ff430547276e2a41a48aa07ae63b8
// CraftBukkit start - Fire ProjectileHitEvent
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
index 23f255bfa63cd16e2930fc932a2f4df8e522f2dc..becb07cda7388bcf2e987f06557894ae50d70dbf 100644
index f81be1c6a5efc5090fbb8832f44dbb2ae6aa2f4a..8e81b19706a14c21b5ffdc4f12818fe74adc9ddb 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
@@ -13,6 +13,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
@@ -11,6 +11,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
@ -68,7 +68,7 @@ index 23f255bfa63cd16e2930fc932a2f4df8e522f2dc..becb07cda7388bcf2e987f06557894ae
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
@@ -57,7 +58,17 @@ public abstract class ThrowableProjectile extends Projectile {
@@ -67,7 +68,17 @@ public abstract class ThrowableProjectile extends Projectile {
}
if (movingobjectposition.getType() != HitResult.Type.MISS && !flag) {
@ -87,10 +87,10 @@ index 23f255bfa63cd16e2930fc932a2f4df8e522f2dc..becb07cda7388bcf2e987f06557894ae
this.checkInsideBlocks();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index c85fcad33e17c8ae2e4ee5cb873dbd4166fcc7f5..3f082b7fd50752728917a7da28cba4cb396a9fdf 100644
index c981bb0e1e7c4c8b7603e2ac8e483ad5b4a2c742..56900b5810db623a49559ad218a5385c110bf479 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1190,6 +1190,16 @@ public class CraftEventFactory {
@@ -1185,6 +1185,16 @@ public class CraftEventFactory {
return CraftItemStack.asNMSCopy(bitem);
}

Datei anzeigen

@ -5,14 +5,21 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
TODO: This doesn't prevent the pathfinder from using blocks outside the world border as nodes. We can fix this
by adding code to all overrides in:
NodeEvaluator:
public abstract BlockPathTypes getBlockPathType(BlockGetter world, int x, int y, int z);
to return BLOCKED if it is outside the world border.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 25bc3adfad956157cef0953e6e632b7b7e352f3a..c3082f5dd64413a47421cb01538bec846bf21d2c 100644
index 6c063351c76e92a8a91142a12db846d1c1f11921..8212aab2884c2a894bc981850e483ce31814c708 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -148,7 +148,7 @@ public abstract class PathNavigation {
@@ -156,7 +156,7 @@ public abstract class PathNavigation {
// Paper start - Pathfind event
boolean copiedSet = false;
for (BlockPos possibleTarget : set) {
for (BlockPos possibleTarget : positions) {
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
+ if (!getEntity().getCommandSenderWorld().getWorldBorder().isInBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), // Paper - don't path out of world border
MCUtil.toLocation(getEntity().level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {

Datei anzeigen

@ -6,13 +6,14 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 5f3d17cb247156fc8aaa7a763e402c2bbb42a7ec..ecb6378a285dff4b34170410387ebb7a8510a6dc 100644
index e26cb05a91cf2b3ac059dcb55bc52f1e4f30b362..52d80086deff664fcfd8952b7cabbfa1f48ad131 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -305,6 +305,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -316,6 +316,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition);
}
+ @Override
+ public final boolean hasChunkAt(BlockPos pos) {
+ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper
+ }

Datei anzeigen

@ -11,10 +11,10 @@ that is outside happens to be closer, but unreachable, yet another reachable
one is in border that would of been missed.
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index 0846f649dca3422dbab3bb0a4826e27430cc8186..7a728ca96ee2eaf776c391ba8351196a526e18ec 100644
index 02b10be4878b871742efb0f65980d9672f32b388..4a61153eaf9cf4c8aa532f770c0e449325448107 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -36,6 +36,18 @@ public class WorldBorder {
@@ -37,6 +37,18 @@ public class WorldBorder {
return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ();
}
@ -34,14 +34,14 @@ index 0846f649dca3422dbab3bb0a4826e27430cc8186..7a728ca96ee2eaf776c391ba8351196a
return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ();
}
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 9f60abfe0a37e30c5528a1ca0546295b00598798..0624b8270bc28c83c5479cd51fa4633ed5c36f44 100644
index a66a02d2d1294060048c3c2b2219af87cdb13060..3878a7f6402a1dff1e019e16dd8772ec7303ebe7 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
@@ -175,6 +175,7 @@ public abstract class StructureFeature<C extends FeatureConfiguration> {
int i2 = l + k * k1;
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);
StructureStart<?> structurestart = structureAccessor.getStartForFeature(SectionPos.of(ichunkaccess.getPos(), 0), this, ichunkaccess);
@@ -168,6 +168,7 @@ public abstract class StructureFeature<C extends FeatureConfiguration> {
int o = j + i * m;
int p = k + i * n;
ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, worldgenRandom, o, p);
+ 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);

Datei anzeigen

@ -28,30 +28,30 @@ index e83216be5a00d5b927d8c2fc364551bd3077c974..2dc58b9f769ea43b737804456aafab47
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
index fd1b84baae5f333c58dbbdcbfaa9198328f0961d..7d490e1be772be22c3ab75c7e356465183a5c6b1 100644
index ae2fba922b5a8c9b4096ea8255ff20db58fcd88f..314617cb0d2df92cc394f7a80011f5b6d075419b 100644
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
@@ -124,7 +124,8 @@ public class VillagerTrades {
@@ -383,7 +383,8 @@ public class VillagerTrades {
return null;
} else {
ServerLevel worldserver = (ServerLevel) entity.level;
- BlockPos blockposition = worldserver.findNearestMapFeature(this.destination, entity.blockPosition(), 100, true);
+ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper
+ BlockPos blockposition = worldserver.findNearestMapFeature(this.destination, entity.blockPosition(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper
if (blockposition != null) {
ItemStack itemstack = MapItem.create(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true);
ServerLevel serverLevel = (ServerLevel)entity.level;
- BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, entity.blockPosition(), 100, true);
+ if (!serverLevel.paperConfig.enableTreasureMaps) return null; // Paper
+ BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig.treasureMapsAlreadyDiscovered); // Paper
if (blockPos != null) {
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true);
MapItem.renderBiomePreviewMap(serverLevel, itemStack);
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
index a3ce120b0da62f9be938c58c3414ce997f5d30ea..81a8331bfdf30da6ea69952ae42d3c77a2103bfd 100644
index ce5375dc1974042fd4e81a93a6087d7d286074af..d9452518368c6da097ee142d9b38b52188dc4a5b 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
@@ -64,7 +64,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction {
if (vec3d != null) {
ServerLevel worldserver = context.getLevel();
- BlockPos blockposition = worldserver.findNearestMapFeature(this.destination, new BlockPos(vec3d), this.searchRadius, this.skipKnownStructures);
@@ -65,7 +65,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction {
Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN);
if (vec3 != null) {
ServerLevel serverLevel = context.getLevel();
- BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, new BlockPos(vec3), this.searchRadius, this.skipKnownStructures);
+ // Paper start
+ if (!worldserver.paperConfig.enableTreasureMaps) {
+ if (!serverLevel.paperConfig.enableTreasureMaps) {
+ /*
+ * NOTE: I fear users will just get a plain map as their "treasure"
+ * This is preferable to disrespecting the config.
@ -59,7 +59,7 @@ index a3ce120b0da62f9be938c58c3414ce997f5d30ea..81a8331bfdf30da6ea69952ae42d3c77
+ return stack;
+ }
+ // Paper end
+ BlockPos blockposition = worldserver.findNearestMapFeature(this.destination, new BlockPos(vec3d), this.searchRadius, !worldserver.paperConfig.treasureMapsAlreadyDiscovered && this.skipKnownStructures); // Paper
if (blockposition != null) {
ItemStack itemstack1 = MapItem.create(worldserver, blockposition.getX(), blockposition.getZ(), this.zoom, true, true);
+ BlockPos blockPos = serverLevel.findNearestMapFeature(this.destination, new BlockPos(vec3), this.searchRadius, !serverLevel.paperConfig.treasureMapsAlreadyDiscovered && this.skipKnownStructures); // Paper
if (blockPos != null) {
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true);
MapItem.renderBiomePreviewMap(serverLevel, itemStack);

Datei anzeigen

@ -6,15 +6,15 @@ Subject: [PATCH] Optimize ItemStack.isEmpty()
Remove hashMap lookup every check, simplify code to remove ternary
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 123025c6dc9a2eea56c7db5cb508cdfd7c6cc97b..a0815c0d7f68f345dc48c73b8253de637c7a3e0f 100644
index d3267cdef523b62f9985e49b768e6ad22fbe874d..4d4b471bbfb2d9174391c8adc6075ec11295408b 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -206,7 +206,7 @@ public final class ItemStack {
@@ -241,7 +241,7 @@ public final class ItemStack {
}
public boolean isEmpty() {
- return this == ItemStack.EMPTY ? true : (this.getItem() != null && this.getItem() != Items.AIR ? this.count <= 0 : true);
+ return this == ItemStack.NULL_ITEM || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper
- return this == ItemStack.EMPTY ? true : (this.getItem() != null && !this.is(Items.AIR) ? this.count <= 0 : true);
+ return this == ItemStack.EMPTY || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper
}
public ItemStack split(int amount) {

Datei anzeigen

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
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 fd2d0eaa190068646250956c4d5e5e9aeee7b1e4..ef382aaeb86ca41356a076ff4adfe5fb652b43c5 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -92,6 +92,7 @@ public class ArmorStand extends LivingEntity {
public Rotations rightArmPose;
public Rotations leftLegPose;
public Rotations rightLegPose;
+ public boolean canMove = true; // Paper
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
super(type, world);
@@ -927,4 +928,13 @@ public class ArmorStand extends LivingEntity {
public boolean canBeSeenByAnyone() {
return !this.isInvisible() && !this.isMarker();
}
+
+ // Paper start
+ @Override
+ public void move(net.minecraft.world.entity.MoverType type, Vec3 movement) {
+ if (this.canMove) {
+ super.move(type, movement);
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 47ca72e264950dd950f037a21bb0ad6cc1700751..06cedeea447f53d100e32a6eba6f83b4719cb231 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -228,4 +228,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
return (this.getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0;
}
+ // Paper start
+ @Override
+ public boolean canMove() {
+ return getHandle().canMove;
+ }
+
+ @Override
+ public void setCanMove(boolean move) {
+ getHandle().canMove = move;
+ }
+ // Paper end
}

Datei anzeigen

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 27 Dec 2016 15:02:42 -0500
Subject: [PATCH] String based Action Bar API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d50ce7fc675fcc57f591e90eb0bbb99a4ab21b02..1da034d28732a5f5b9bd9b31966da21830efdc9f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -247,6 +247,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper start
+ @Override
+ public void sendActionBar(BaseComponent[] message) {
+ if (getHandle().connection == null) return;
+ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(Component.Serializer.fromJson(net.md_5.bungee.chat.ComponentSerializer.toString(message))));
+ }
+
+ @Override
+ public void sendActionBar(String message) {
+ if (getHandle().connection == null || message == null || message.isEmpty()) return;
+ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(message)));
+ }
+
+ @Override
+ public void sendActionBar(char alternateChar, String message) {
+ if (message == null || message.isEmpty()) return;
+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message));
+ }
+
@Override
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
if (header != null) {