mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@ffcb7b22 Update Parchment (#13177) PaperMC/Paper@c33a9ce1 Fix incorrect variable use in Entity#startRiding PaperMC/Paper@c710b667 Add MapPalette.getNearestColor (#13104) PaperMC/Paper@b57d6410 Expose isReplaceable on BlockData (#13180) PaperMC/Paper@af1823d4 Reduce impact of tick time calculations (#13188) PaperMC/Paper@89ca94ab [ci/skip] Rebuild patches PaperMC/Paper@e5cc2560 [ci/skip] Update CONTRIBUTING.md for Gradle and Windows Docs (#13190) PaperMC/Paper@ab99393c Fix charged creeper explosions not dropping mob skulls (#13167) PaperMC/Paper@81b7a578 Fixed Ender Dragon using wrong tracking range (#13046)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/gametest/framework/TestCommand.java
|
||||
+++ b/net/minecraft/gametest/framework/TestCommand.java
|
||||
@@ -452,7 +_,7 @@
|
||||
@@ -443,7 +_,7 @@
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -580,11 +_,20 @@
|
||||
@@ -578,11 +_,20 @@
|
||||
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
|
||||
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
|
||||
private static int currTick; // Paper - Buffer joins to world
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
// Paper start - improve tick loop
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
|
||||
@@ -353,6 +_,7 @@
|
||||
final long now = System.nanoTime();
|
||||
@@ -370,6 +_,7 @@
|
||||
public double[] computeTPS() {
|
||||
final long interval = this.tickRateManager().nanosecondsPerTick();
|
||||
return new double[] {
|
||||
+ getTPS(this.tickTimes5s, now, interval), // Purpur - Add 5 second tps average in /tps
|
||||
getTPS(this.tickTimes1m, now, interval),
|
||||
getTPS(this.tickTimes5m, now, interval),
|
||||
getTPS(this.tickTimes15m, now, interval)
|
||||
@@ -993,6 +_,15 @@
|
||||
+ getTPS(this.tickTimes5s, interval), // Purpur - Add 5 second tps average in /tps
|
||||
getTPS(this.tickTimes1m, interval),
|
||||
getTPS(this.tickTimes5m, interval),
|
||||
getTPS(this.tickTimes15m, interval)
|
||||
@@ -1012,6 +_,15 @@
|
||||
|
||||
LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
@@ -41,7 +41,7 @@
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
@@ -1091,6 +_,8 @@
|
||||
@@ -1110,6 +_,8 @@
|
||||
this.safeShutdown(waitForShutdown, false);
|
||||
}
|
||||
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
|
||||
@@ -50,7 +50,7 @@
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper - Debugging
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
@@ -1274,6 +_,16 @@
|
||||
@@ -1293,6 +_,16 @@
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
while (this.running) {
|
||||
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
||||
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
|
||||
@@ -1287,8 +_,10 @@
|
||||
@@ -1306,8 +_,10 @@
|
||||
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
|
||||
final long catchup = (long)Math.max(
|
||||
1,
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
// adjust ticksBehind so that it is not greater-than catchup
|
||||
if (ticksBehind > catchup) {
|
||||
@@ -1759,7 +_,7 @@
|
||||
@@ -1778,7 +_,7 @@
|
||||
long worldTime = level.getGameTime();
|
||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||
for (Player entityhuman : level.players()) {
|
||||
@@ -88,7 +88,7 @@
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
@@ -1931,7 +_,7 @@
|
||||
@@ -1950,7 +_,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@@ -53,6 +_,18 @@
|
||||
}
|
||||
|
||||
private static int setMode(CommandContext<CommandSourceStack> source, Collection<ServerPlayer> players, GameType gameType) {
|
||||
private static int setMode(CommandContext<CommandSourceStack> context, Collection<ServerPlayer> players, GameType gameType) {
|
||||
+ // Purpur start - Gamemode extra permissions
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||
+ String gamemode = gameType.getName();
|
||||
+ CommandSourceStack sender = source.getSource();
|
||||
+ CommandSourceStack sender = context.getSource();
|
||||
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
this.server = server;
|
||||
- this.customSpawners = customSpawners;
|
||||
+ this.customSpawners = new ArrayList<>(); // Purpur - Allow toggling special MobSpawners per world
|
||||
this.serverLevelData = levelData;
|
||||
this.serverLevelData = serverLevelData;
|
||||
+ // Purpur start - Allow toggling special MobSpawners per world
|
||||
+ if (purpurConfig.phantomSpawning) {
|
||||
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
|
||||
@@ -145,14 +145,14 @@
|
||||
} else {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, heightmapPos, Blocks.SNOW.defaultBlockState(), 3, null); // CraftBukkit
|
||||
@@ -1050,7 +_,7 @@
|
||||
holder -> holder.is(PoiTypes.LIGHTNING_ROD),
|
||||
blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1,
|
||||
poiType -> poiType.is(PoiTypes.LIGHTNING_ROD),
|
||||
pos1 -> pos1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, pos1.getX(), pos1.getZ()) - 1,
|
||||
pos,
|
||||
- 128,
|
||||
+ org.purpurmc.purpur.PurpurConfig.lightningRodRange, // Purpur - Make lightning rod range configurable
|
||||
PoiManager.Occupancy.ANY
|
||||
);
|
||||
return optional.map(blockPos -> blockPos.above(1));
|
||||
return optional.map(pos1 -> pos1.above(1));
|
||||
@@ -1099,8 +_,26 @@
|
||||
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
Component component;
|
||||
@@ -196,7 +196,7 @@
|
||||
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
// CraftBukkit start
|
||||
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
@@ -2804,7 +_,7 @@
|
||||
@@ -2794,7 +_,7 @@
|
||||
// Spigot start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
// Paper start - Fix merchant inventory not closing on entity removal
|
||||
|
||||
@@ -123,8 +123,8 @@
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
@Override
|
||||
public void displayClientMessage(Component chatComponent, boolean actionBar) {
|
||||
this.sendSystemMessage(chatComponent, actionBar);
|
||||
public void displayClientMessage(Component message, boolean overlay) {
|
||||
this.sendSystemMessage(message, overlay);
|
||||
@@ -2327,6 +_,20 @@
|
||||
);
|
||||
}
|
||||
@@ -143,8 +143,8 @@
|
||||
+ }
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
public void sendSystemMessage(Component mesage) {
|
||||
this.sendSystemMessage(mesage, false);
|
||||
public void sendSystemMessage(Component message) {
|
||||
this.sendSystemMessage(message, false);
|
||||
}
|
||||
@@ -2465,7 +_,67 @@
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.stats;
|
||||
@@ -3107,4 +_,56 @@
|
||||
@@ -3109,4 +_,56 @@
|
||||
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
if (interactionResult.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack);
|
||||
@@ -573,4 +_,18 @@
|
||||
public void setLevel(ServerLevel serverLevel) {
|
||||
this.level = serverLevel;
|
||||
public void setLevel(ServerLevel level) {
|
||||
this.level = level;
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Shift right click to use exp for mending
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
|
||||
for (ServerPlayer serverPlayer : this.players) {
|
||||
if (serverPlayer.level().dimension() == dimension) {
|
||||
@@ -906,6 +_,7 @@
|
||||
@@ -904,6 +_,7 @@
|
||||
} else {
|
||||
b = (byte)(24 + permLevel);
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
player.connection.send(new ClientboundEntityEventPacket(player, b));
|
||||
}
|
||||
@@ -918,7 +_,7 @@
|
||||
@@ -916,7 +_,7 @@
|
||||
|
||||
// Paper start - whitelist verify event / login event
|
||||
public LoginResult canBypassFullServerLogin(final NameAndId nameAndId, final LoginResult currentResult) {
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
+++ b/net/minecraft/world/damagesource/CombatRules.java
|
||||
@@ -15,7 +_,7 @@
|
||||
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damage, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damageAmount, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
float f = 2.0F + armorToughness / 4.0F;
|
||||
- float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
- float f1 = Mth.clamp(armorValue - damageAmount / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damageAmount / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
float f2 = f1 / 25.0F;
|
||||
ItemStack weaponItem = damageSource.getWeaponItem();
|
||||
float f3;
|
||||
@@ -30,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static float getDamageAfterMagicAbsorb(float damage, float enchantModifiers) {
|
||||
public static float getDamageAfterMagicAbsorb(float damageAmount, float enchantModifiers) {
|
||||
- float f = Mth.clamp(enchantModifiers, 0.0F, 20.0F);
|
||||
+ float f = Mth.clamp(enchantModifiers, 0.0F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
return damage * (1.0F - f / 25.0F);
|
||||
return damageAmount * (1.0F - f / 25.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
+ }
|
||||
+ // Purpur end - Add canSaveToDisk to Entity
|
||||
+
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
public Entity(EntityType<?> type, Level level) {
|
||||
this.type = type;
|
||||
this.level = level;
|
||||
this.dimensions = entityType.getDimensions();
|
||||
this.dimensions = type.getDimensions();
|
||||
+ // Purpur start - Add toggle for RNG manipulation
|
||||
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
|
||||
+ this.uuid = Mth.createInsecureUUID(this.random);
|
||||
@@ -99,7 +99,7 @@
|
||||
} catch (Throwable var7) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var7, "Loading entity NBT");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
|
||||
@@ -3035,6 +_,7 @@
|
||||
@@ -3034,6 +_,7 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable2) {
|
||||
if (leashable2.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@@ -107,7 +107,7 @@
|
||||
// Paper start - EntityUnleashEvent
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
|
||||
leashable2, player, hand, !player.hasInfiniteMaterials(), true
|
||||
@@ -3459,15 +_,18 @@
|
||||
@@ -3458,15 +_,18 @@
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3672,7 +_,7 @@
|
||||
@@ -3671,7 +_,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -4234,7 +_,7 @@
|
||||
@@ -4233,7 +_,7 @@
|
||||
// CraftBukkit end
|
||||
|
||||
public boolean canUsePortal(boolean allowPassengers) {
|
||||
@@ -145,7 +145,7 @@
|
||||
}
|
||||
|
||||
public boolean canTeleport(Level fromLevel, Level toLevel) {
|
||||
@@ -4749,6 +_,12 @@
|
||||
@@ -4748,6 +_,12 @@
|
||||
return Mth.lerp(partialTick, this.yRotO, this.yRot);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
// Paper start - optimise collisions
|
||||
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
|
||||
if (this.touchingUnloadedChunk()) {
|
||||
@@ -5166,7 +_,7 @@
|
||||
@@ -5165,7 +_,7 @@
|
||||
}
|
||||
|
||||
public float maxUpStep() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public static ResourceLocation getKey(EntityType<?> entityType) {
|
||||
return BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
|
||||
}
|
||||
@@ -1442,6 +_,16 @@
|
||||
@@ -1444,6 +_,16 @@
|
||||
return this.category;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
public String getDescriptionId() {
|
||||
return this.descriptionId;
|
||||
}
|
||||
@@ -1501,7 +_,11 @@
|
||||
@@ -1503,7 +_,11 @@
|
||||
entity.load(input);
|
||||
},
|
||||
// Paper end - Don't fire sync event during generation
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -27,6 +_,13 @@
|
||||
super(entityType, level);
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
||||
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
|
||||
event.setCancelled(itemStack == null);
|
||||
@@ -1914,6 +_,7 @@
|
||||
@@ -1920,6 +_,7 @@
|
||||
boolean flag = this.lastHurtByPlayerMemoryTime > 0;
|
||||
this.dropEquipment(level); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot(level)) {
|
||||
@@ -145,7 +145,7 @@
|
||||
this.dropFromLootTable(level, damageSource, flag);
|
||||
// Paper start
|
||||
final boolean prev = this.clearEquipmentSlots;
|
||||
@@ -1922,6 +_,7 @@
|
||||
@@ -1928,6 +_,7 @@
|
||||
// Paper end
|
||||
this.dropCustomDeathLoot(level, damageSource, flag);
|
||||
this.clearEquipmentSlots = prev; // Paper
|
||||
@@ -153,7 +153,7 @@
|
||||
}
|
||||
|
||||
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
|
||||
@@ -3140,6 +_,7 @@
|
||||
@@ -3146,6 +_,7 @@
|
||||
float f = (float)(d * 10.0 - 3.0);
|
||||
if (f > 0.0F) {
|
||||
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
|
||||
@@ -161,7 +161,7 @@
|
||||
this.hurt(this.damageSources().flyIntoWall(), f);
|
||||
}
|
||||
}
|
||||
@@ -4539,6 +_,12 @@
|
||||
@@ -4545,6 +_,12 @@
|
||||
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
|
||||
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
public net.kyori.adventure.util.TriState despawnInPeacefulOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - allow changing despawnInPeaceful
|
||||
+ public int ticksSinceLastInteraction; // Purpur - Entity lifespan
|
||||
|
||||
protected Mob(EntityType<? extends Mob> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
protected Mob(EntityType<? extends Mob> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -295,6 +_,7 @@
|
||||
target = null;
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
+ // Purpur end - Entity lifespan
|
||||
|
||||
@Override
|
||||
protected void playHurtSound(DamageSource source) {
|
||||
protected void playHurtSound(DamageSource damageSource) {
|
||||
@@ -443,6 +_,7 @@
|
||||
output.putString("Paper.DespawnInPeacefulOverride", this.despawnInPeacefulOverride.name());
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
this.setInLove(serverPlayer, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
@@ -223,10 +_,20 @@
|
||||
public void spawnChildFromBreeding(ServerLevel level, Animal mate) {
|
||||
AgeableMob breedOffspring = this.getBreedOffspring(level, mate);
|
||||
public void spawnChildFromBreeding(ServerLevel level, Animal partner) {
|
||||
AgeableMob breedOffspring = this.getBreedOffspring(level, partner);
|
||||
if (breedOffspring != null) {
|
||||
- breedOffspring.setBaby(true);
|
||||
- breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
+ //breedOffspring.setBaby(true); // Purpur - Add adjustable breeding cooldown to config - moved down
|
||||
+ //breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); // Purpur - Add adjustable breeding cooldown to config - moved down
|
||||
// CraftBukkit start - Call EntityBreedEvent
|
||||
ServerPlayer breeder = Optional.ofNullable(this.getLoveCause()).or(() -> Optional.ofNullable(mate.getLoveCause())).orElse(null);
|
||||
ServerPlayer breeder = Optional.ofNullable(this.getLoveCause()).or(() -> Optional.ofNullable(partner.getLoveCause())).orElse(null);
|
||||
+ // Purpur start - Add adjustable breeding cooldown to config
|
||||
+ if (breeder != null && level.purpurConfig.animalBreedingCooldownSeconds > 0) {
|
||||
+ if (level.hasBreedingCooldown(breeder.getUUID(), this.getClass())) {
|
||||
@@ -30,5 +30,5 @@
|
||||
+ breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
+ // Purpur end - Add adjustable breeding cooldown to config
|
||||
int experience = this.getRandom().nextInt(7) + 1;
|
||||
org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(breedOffspring, this, mate, breeder, this.breedItem, experience);
|
||||
org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(breedOffspring, this, partner, breeder, this.breedItem, experience);
|
||||
if (entityBreedEvent.isCancelled()) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
this.setPathfindingMalus(PathType.WATER_BORDER, 16.0F);
|
||||
this.setPathfindingMalus(PathType.COCOA, -1.0F);
|
||||
this.setPathfindingMalus(PathType.FENCE, -1.0F);
|
||||
@@ -368,7 +_,7 @@
|
||||
@@ -366,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static boolean isNightOrRaining(Level level) {
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) {
|
||||
@@ -391,7 +_,7 @@
|
||||
@@ -389,7 +_,7 @@
|
||||
@Override
|
||||
protected void customServerAiStep(ServerLevel level) {
|
||||
boolean hasStung = this.hasStung();
|
||||
@@ -27,7 +27,7 @@
|
||||
this.underWaterTicks++;
|
||||
} else {
|
||||
this.underWaterTicks = 0;
|
||||
@@ -401,6 +_,7 @@
|
||||
@@ -399,6 +_,7 @@
|
||||
this.hurtServer(level, this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
if (hasStung) {
|
||||
this.timeSinceSting++;
|
||||
if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) {
|
||||
@@ -1140,6 +_,7 @@
|
||||
@@ -1138,6 +_,7 @@
|
||||
Bee.this.savedFlowerPos = optional.get();
|
||||
Bee.this.navigation
|
||||
.moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F);
|
||||
@@ -43,7 +43,7 @@
|
||||
return true;
|
||||
} else {
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60);
|
||||
@@ -1186,6 +_,7 @@
|
||||
@@ -1184,6 +_,7 @@
|
||||
this.pollinating = false;
|
||||
Bee.this.navigation.stop();
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1232,6 +_,7 @@
|
||||
@@ -1230,6 +_,7 @@
|
||||
this.setWantedPos();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
public BlockPos treasurePos;
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Dolphins naturally aggressive to players chance
|
||||
|
||||
public Dolphin(EntityType<? extends Dolphin> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public Dolphin(EntityType<? extends Dolphin> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -90,6 +_,7 @@
|
||||
this.setAirSupply(this.getMaxAirSupply());
|
||||
this.setXRot(0.0F);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
private UUID persistentAngerTarget;
|
||||
+ @Nullable private UUID summoner; // Purpur - Summoner API
|
||||
|
||||
public IronGolem(EntityType<? extends IronGolem> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public IronGolem(EntityType<? extends IronGolem> type, Level level) {
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Summoner API
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -201,6 +_,13 @@
|
||||
level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F);
|
||||
level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, source, 1.0F, 1.0F);
|
||||
this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), cow -> {
|
||||
level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0);
|
||||
+ // Purpur start - Fix cow rotation when shearing mooshroom
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
|
||||
- return null;
|
||||
+ return level.purpurConfig.parrotBreedable ? EntityType.PARROT.create(level, EntitySpawnReason.BREEDING) : null; // Purpur - Breedable parrots
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/animal/PolarBear.java
|
||||
+++ b/net/minecraft/world/entity/animal/PolarBear.java
|
||||
@@ -65,6 +_,29 @@
|
||||
super(entityType, level);
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Breedable Polar Bears
|
||||
@@ -29,7 +29,7 @@
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
|
||||
@@ -73,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
private static final boolean DEFAULT_PUMPKIN = true;
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur - Summoner API
|
||||
|
||||
public SnowGolem(EntityType<? extends SnowGolem> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public SnowGolem(EntityType<? extends SnowGolem> type, Level level) {
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Summoner API
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -46,10 +_,29 @@
|
||||
|
||||
public Squid(EntityType<? extends Squid> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
- //this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random
|
||||
public Squid(EntityType<? extends Squid> type, Level level) {
|
||||
super(type, level);
|
||||
- // this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random
|
||||
+ if (!level.purpurConfig.entitySharedRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Purpur - Add toggle for RNG manipulation
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
public static final EquipmentSlot EQUIPMENT_SLOT_ANTENNA = EquipmentSlot.SADDLE;
|
||||
+ @Nullable private UUID summoner; // Purpur - Summoner API
|
||||
|
||||
public CopperGolem(EntityType<? extends AbstractGolem> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public CopperGolem(EntityType<? extends AbstractGolem> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -97,6 +_,17 @@
|
||||
this.getBrain().setMemory(MemoryModuleType.TRANSPORT_ITEMS_COOLDOWN_TICKS, this.getRandom().nextInt(60, 100));
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -43,7 +_,7 @@
|
||||
private static final int TICK_TO_START_ON_REACHED_INTERACTION = 1;
|
||||
private static final int TICK_TO_PLAY_ON_REACHED_SOUND = 9;
|
||||
private static final Predicate<BlockState> TRANSPORT_ITEM_SOURCE_BLOCK = blockState -> blockState.is(BlockTags.COPPER_CHESTS);
|
||||
- private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = blockState -> blockState.is(Blocks.CHEST)
|
||||
+ private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = blockState -> blockState.is(Blocks.CHEST) // Purpur - copper golem can place items in barrels option - diff on change
|
||||
|| blockState.is(Blocks.TRAPPED_CHEST);
|
||||
private static final Predicate<BlockState> TRANSPORT_ITEM_SOURCE_BLOCK = state -> state.is(BlockTags.COPPER_CHESTS);
|
||||
- private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = state -> state.is(Blocks.CHEST) || state.is(Blocks.TRAPPED_CHEST);
|
||||
+ private static final Predicate<BlockState> TRANSPORT_ITEM_DESTINATION_BLOCK = state -> state.is(Blocks.CHEST) || state.is(Blocks.TRAPPED_CHEST); // Purpur - copper golem can place items in barrels option - diff on change
|
||||
private static final ImmutableList<SensorType<? extends Sensor<? super CopperGolem>>> SENSOR_TYPES = ImmutableList.of(
|
||||
SensorType.NEAREST_LIVING_ENTITIES, SensorType.HURT_BY
|
||||
);
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
@@ -78,6 +_,7 @@
|
||||
private Llama caravanHead;
|
||||
@Nullable
|
||||
public Llama caravanTail; // Paper
|
||||
public Llama caravanTail; // Paper - public
|
||||
+ public boolean shouldJoinCaravan = true; // Purpur - Llama API
|
||||
|
||||
public Llama(EntityType<? extends Llama> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -112,6 +_,7 @@
|
||||
public Llama(EntityType<? extends Llama> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -107,6 +_,7 @@
|
||||
super.addAdditionalSaveData(output);
|
||||
output.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
|
||||
output.putInt("Strength", this.getStrength());
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,6 +_,7 @@
|
||||
@@ -114,6 +_,7 @@
|
||||
this.setStrength(input.getIntOr("Strength", 0));
|
||||
super.readAdditionalSaveData(input);
|
||||
this.setVariant(input.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -400,6 +_,7 @@
|
||||
@@ -395,6 +_,7 @@
|
||||
|
||||
public void leaveCaravan() {
|
||||
if (this.caravanHead != null) {
|
||||
@@ -32,7 +32,7 @@
|
||||
this.caravanHead.caravanTail = null;
|
||||
}
|
||||
|
||||
@@ -407,6 +_,7 @@
|
||||
@@ -402,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void joinCaravan(Llama caravanHead) {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur - Summoner API
|
||||
|
||||
public WitherBoss(EntityType<? extends WitherBoss> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public WitherBoss(EntityType<? extends WitherBoss> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -87,6 +_,17 @@
|
||||
this.xpReward = 50;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Paper end - Allow ArmorStands not to tick
|
||||
+ public boolean canMovementTick = true; // Purpur - Movement options for armor stands
|
||||
|
||||
public ArmorStand(EntityType<? extends ArmorStand> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public ArmorStand(EntityType<? extends ArmorStand> type, Level level) {
|
||||
super(type, level);
|
||||
if (level != null) this.canTick = level.paperConfig().entities.armorStands.tick; // Paper - Allow ArmorStands not to tick
|
||||
+ if (level != null) this.canMovementTick = level.purpurConfig.armorstandMovement; // Purpur - Movement options for armor stands
|
||||
+ this.setShowArms(level != null && level.purpurConfig.armorstandPlaceWithArms); // Purpur - Config to show Armor Stand arms on spawn
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+ public boolean immuneToLightning = false;
|
||||
+ // Purpur end - Item entity immunities
|
||||
|
||||
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public ItemEntity(EntityType<? extends ItemEntity> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -333,7 +_,16 @@
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
+++ b/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -56,6 +_,7 @@
|
||||
public int explosionRadius = 3;
|
||||
private boolean droppedSkulls;
|
||||
public boolean droppedSkulls;
|
||||
public @Nullable Entity entityIgniter; // CraftBukkit
|
||||
+ private boolean exploding = false; // Purpur - Config to make Creepers explode on death
|
||||
|
||||
public Creeper(EntityType<? extends Creeper> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public Creeper(EntityType<? extends Creeper> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -159,6 +_,27 @@
|
||||
return false; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
public int life = 0;
|
||||
+ private boolean isPlayerSpawned; // Purpur - Add back player spawned endermite API
|
||||
|
||||
public Endermite(EntityType<? extends Endermite> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
public Endermite(EntityType<? extends Endermite> type, Level level) {
|
||||
super(type, level);
|
||||
this.xpReward = 3;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
+ if (livingEntity instanceof Player player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
||||
+ if (target instanceof Player player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
||||
+ this.setLastHurtByPlayer(player, this.tickCount);
|
||||
+ }
|
||||
+ // Purpur end - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
|
||||
return super.setTarget(livingEntity, reason); // CraftBukkit
|
||||
return super.setTarget(target, reason); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
|
||||
+ private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
|
||||
|
||||
public Villager(EntityType<? extends Villager> entityType, Level level) {
|
||||
this(entityType, level, VillagerType.PLAINS);
|
||||
public Villager(EntityType<? extends Villager> type, Level level) {
|
||||
this(type, level, VillagerType.PLAINS);
|
||||
@@ -196,6 +_,57 @@
|
||||
this.setVillagerData(this.getVillagerData().withType(villagerType).withProfession(level.registryAccess(), VillagerProfession.NONE));
|
||||
}
|
||||
@@ -121,11 +121,11 @@
|
||||
@@ -922,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void spawnGolemIfNeeded(ServerLevel serverLevel, long gameTime, int minVillagerAmount) {
|
||||
+ if (serverLevel.purpurConfig.villagerSpawnIronGolemRadius > 0 && serverLevel.getEntitiesOfClass(net.minecraft.world.entity.animal.IronGolem.class, getBoundingBox().inflate(serverLevel.purpurConfig.villagerSpawnIronGolemRadius)).size() > serverLevel.purpurConfig.villagerSpawnIronGolemLimit) return; // Purpur - Implement configurable search radius for villagers to spawn iron golems
|
||||
public void spawnGolemIfNeeded(ServerLevel level, long gameTime, int minVillagerAmount) {
|
||||
+ if (level.purpurConfig.villagerSpawnIronGolemRadius > 0 && level.getEntitiesOfClass(net.minecraft.world.entity.animal.IronGolem.class, getBoundingBox().inflate(level.purpurConfig.villagerSpawnIronGolemRadius)).size() > level.purpurConfig.villagerSpawnIronGolemLimit) return; // Purpur - Implement configurable search radius for villagers to spawn iron golems
|
||||
if (this.wantsToSpawnGolem(gameTime)) {
|
||||
AABB aabb = this.getBoundingBox().inflate(10.0, 10.0, 10.0);
|
||||
List<Villager> entitiesOfClass = serverLevel.getEntitiesOfClass(Villager.class, aabb);
|
||||
List<Villager> entitiesOfClass = level.getEntitiesOfClass(Villager.class, aabb);
|
||||
@@ -989,6 +_,12 @@
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
@@ -60,6 +_,13 @@
|
||||
super(entityType, level);
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Allow leashing villagers
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
public ItemStack firedFromWeapon = null;
|
||||
+ public net.minecraft.world.item.enchantment.ItemEnchantments actualEnchantments = net.minecraft.world.item.enchantment.ItemEnchantments.EMPTY; // Purpur - Add an option to fix MC-3304 projectile looting
|
||||
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -350,7 +_,7 @@
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -344,7 +_,7 @@
|
||||
this.setInGround(false);
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
this.setDeltaMovement(deltaMovement.multiply(this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F));
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
public boolean isInGround() {
|
||||
@@ -574,6 +_,12 @@
|
||||
@@ -568,6 +_,12 @@
|
||||
public ItemStack getWeaponItem() {
|
||||
return this.firedFromWeapon;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
@@ -66,7 +_,7 @@
|
||||
@@ -69,7 +_,7 @@
|
||||
|
||||
Entity owner = this.getOwner();
|
||||
int i = this.entityData.get(ID_LOYALTY);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
@@ -121,7 +_,13 @@
|
||||
} else if (index != 1 && index != 0) {
|
||||
} else if (slotIndex != 1 && slotIndex != 0) {
|
||||
if (this.canSmelt(item)) {
|
||||
if (!this.moveItemStackTo(item, 0, 1, false)) {
|
||||
- return ItemStack.EMPTY;
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
@Override
|
||||
public void removed(Player player) {
|
||||
super.removed(player);
|
||||
- this.access.execute((level, blockPos) -> this.clearContainer(player, this.enchantSlots));
|
||||
+ this.access.execute((level, blockPos) -> {if (level.purpurConfig.enchantmentTableLapisPersists) this.getSlot(1).set(ItemStack.EMPTY);this.clearContainer(player, this.enchantSlots);}); // Purpur - Enchantment Table Persists Lapis
|
||||
- this.access.execute((level, pos) -> this.clearContainer(player, this.enchantSlots));
|
||||
+ this.access.execute((level, pos) -> {if (level.purpurConfig.enchantmentTableLapisPersists) this.getSlot(1).set(ItemStack.EMPTY);this.clearContainer(player, this.enchantSlots);}); // Purpur - Enchantment Table Persists Lapis
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -156,7 +_,9 @@
|
||||
@@ -155,7 +_,9 @@
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/item/MapItem.java
|
||||
+++ b/net/minecraft/world/item/MapItem.java
|
||||
@@ -194,6 +_,7 @@
|
||||
public static void renderBiomePreviewMap(ServerLevel serverLevel, ItemStack stack) {
|
||||
MapItemSavedData savedData = getSavedData(stack, serverLevel);
|
||||
public static void renderBiomePreviewMap(ServerLevel level, ItemStack stack) {
|
||||
MapItemSavedData savedData = getSavedData(stack, level);
|
||||
if (savedData != null) {
|
||||
+ savedData.isExplorerMap = true; // Purpur - Explorer Map API
|
||||
if (serverLevel.dimension() == savedData.dimension) {
|
||||
if (level.dimension() == savedData.dimension) {
|
||||
int i = 1 << savedData.scale;
|
||||
int i1 = savedData.centerX;
|
||||
|
||||
@@ -24,17 +24,17 @@
|
||||
|
||||
public static void dropResources(BlockState state, LevelAccessor level, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
if (level instanceof ServerLevel) {
|
||||
- getDrops(state, (ServerLevel)level, pos, blockEntity).forEach(itemStack -> popResource((ServerLevel)level, pos, itemStack));
|
||||
+ getDrops(state, (ServerLevel)level, pos, blockEntity).forEach(itemStack -> popResource((ServerLevel)level, pos, applyLoreFromTile(itemStack, blockEntity))); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
- getDrops(state, (ServerLevel)level, pos, blockEntity).forEach(stack -> popResource((ServerLevel)level, pos, stack));
|
||||
+ getDrops(state, (ServerLevel)level, pos, blockEntity).forEach(stack -> popResource((ServerLevel)level, pos, applyLoreFromTile(stack, blockEntity))); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
state.spawnAfterBreak((ServerLevel)level, pos, ItemStack.EMPTY, true);
|
||||
}
|
||||
}
|
||||
@@ -414,11 +_,30 @@
|
||||
public static void dropResources(BlockState state, Level level, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
|
||||
// Paper end - Properly handle xp dropping
|
||||
// Paper end - Properly handle xp dropping
|
||||
if (level instanceof ServerLevel) {
|
||||
- getDrops(state, (ServerLevel)level, pos, blockEntity, entity, tool).forEach(itemStack -> popResource(level, pos, itemStack));
|
||||
+ getDrops(state, (ServerLevel)level, pos, blockEntity, entity, tool).forEach(itemStack -> popResource(level, pos, applyLoreFromTile(itemStack, blockEntity))); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
- getDrops(state, (ServerLevel)level, pos, blockEntity, entity, tool).forEach(stack -> popResource(level, pos, stack));
|
||||
+ getDrops(state, (ServerLevel)level, pos, blockEntity, entity, tool).forEach(stack -> popResource(level, pos, applyLoreFromTile(stack, blockEntity))); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
state.spawnAfterBreak((ServerLevel)level, pos, tool, dropExperience); // Paper - Properly handle xp dropping
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BubbleColumnBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BubbleColumnBlock.java
|
||||
@@ -100,9 +_,9 @@
|
||||
if (blockState.is(Blocks.BUBBLE_COLUMN)) {
|
||||
return blockState;
|
||||
} else if (blockState.is(Blocks.SOUL_SAND)) {
|
||||
@@ -99,9 +_,9 @@
|
||||
if (state.is(Blocks.BUBBLE_COLUMN)) {
|
||||
return state;
|
||||
} else if (state.is(Blocks.SOUL_SAND)) {
|
||||
- return Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, false);
|
||||
+ return Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, org.purpurmc.purpur.PurpurConfig.soulSandBlockReverseBubbleColumnFlow); // Purpur - Config to reverse bubble column flow
|
||||
} else {
|
||||
- return blockState.is(Blocks.MAGMA_BLOCK) ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, true) : Blocks.WATER.defaultBlockState();
|
||||
+ return blockState.is(Blocks.MAGMA_BLOCK) ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, !org.purpurmc.purpur.PurpurConfig.magmaBlockReverseBubbleColumnFlow) : Blocks.WATER.defaultBlockState(); // Purpur - Config to reverse bubble column flow
|
||||
- return state.is(Blocks.MAGMA_BLOCK) ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, true) : Blocks.WATER.defaultBlockState();
|
||||
+ return state.is(Blocks.MAGMA_BLOCK) ? Blocks.BUBBLE_COLUMN.defaultBlockState().setValue(DRAG_DOWN, !org.purpurmc.purpur.PurpurConfig.magmaBlockReverseBubbleColumnFlow) : Blocks.WATER.defaultBlockState(); // Purpur - Config to reverse bubble column flow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -169,7 +_,7 @@
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean flag) {
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean pastEdges) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
|
||||
+ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@@ -138,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) {
|
||||
- if (this.shouldSpreadLiquid(level, pos, state)) {
|
||||
+ if (level.purpurConfig.tickFluids && this.shouldSpreadLiquid(level, pos, state)) { // Purpur - Tick fluids config
|
||||
level.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(level, pos)); // Paper - Configurable speed for water flowing over lava
|
||||
}
|
||||
}
|
||||
@@ -173,7 +_,7 @@
|
||||
@@ -175,7 +_,7 @@
|
||||
BlockState neighborState,
|
||||
RandomSource random
|
||||
) {
|
||||
@@ -18,7 +18,7 @@
|
||||
scheduledTickAccess.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(level));
|
||||
}
|
||||
|
||||
@@ -182,7 +_,7 @@
|
||||
@@ -184,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
public void clearBees() {
|
||||
this.stored.clear();
|
||||
@@ -397,8 +_,8 @@
|
||||
registration.register(DebugSubscriptions.BEE_HIVES, () -> DebugHiveInfo.pack(this));
|
||||
registrar.register(DebugSubscriptions.BEE_HIVES, () -> DebugHiveInfo.pack(this));
|
||||
}
|
||||
|
||||
- static class BeeData {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
private Component name;
|
||||
+ private int lapis = 0; // Purpur - Enchantment Table Persists Lapis
|
||||
|
||||
public EnchantingTableBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.ENCHANTING_TABLE, pos, state);
|
||||
public EnchantingTableBlockEntity(BlockPos pos, BlockState blockState) {
|
||||
super(BlockEntityType.ENCHANTING_TABLE, pos, blockState);
|
||||
@@ -40,12 +_,14 @@
|
||||
protected void saveAdditional(ValueOutput output) {
|
||||
super.saveAdditional(output);
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
+ }
|
||||
+ // Purpur end - Implement infinite liquids
|
||||
|
||||
protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState blockState, Direction direction, FluidState fluidState) {
|
||||
if (blockState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) {
|
||||
protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState state, Direction direction, FluidState fluidState) {
|
||||
if (state.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) {
|
||||
|
||||
Reference in New Issue
Block a user