even even even even even even even even even more changes

This commit is contained in:
Spottedleaf 2021-06-12 00:24:28 -07:00
parent 4257a725ae
commit 0891c7ab48
17 changed files with 94 additions and 161 deletions

View file

@ -1,106 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@
package net.minecraft.world.entity;
-import PathfinderGoalFloat;
import com.google.common.collect.Maps;
import java.util.Arrays;
import java.util.Iterator;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -0,0 +0,0 @@ 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
}

View file

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -0,0 +0,0 @@ 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
}

View file

@ -9,26 +9,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public class CraftEventFactory {
return event;
}
@ -45,5 +37,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // 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);
}

View file

@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
@@ -0,0 +0,0 @@ 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);
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);

View file

@ -34,24 +34,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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);
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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);

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.reapplyPosition();
+ // Paper start - These shouldn't be going through portals
+ if (this.isInsidePortal) {
+ this.remove();
+ this.discard();
+ }
+ // Paper end
}

View file

@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
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) {

View file

@ -13,6 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return chunk == null ? null : chunk.getFluidState(blockposition);
}
+ @Override
+ public final boolean hasChunkAt(BlockPos pos) {
+ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper
+ }

View file

@ -5,6 +5,13 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@ -12,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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()) {

View file

@ -4,19 +4,6 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@ -28,13 +15,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public void sendActionBar(BaseComponent[] message) {
+ if (getHandle().connection == null) return;
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, message, -1, -1, -1));
+ 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 ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, CraftChatMessage.fromStringOrNull(message)));
+ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(message)));
+ }
+
+ @Override