Moar 1.19 fixes (#7884)

This commit is contained in:
Noah van der Aa 2022-06-08 15:38:56 +02:00
parent dcb23664a3
commit 88ca48c121
8 changed files with 10 additions and 52 deletions

View File

@ -21,7 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.minecraft.commands.CommandSource;
+import net.minecraft.commands.CommandSourceStack;
+import net.minecraft.network.chat.TextComponent;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.phys.Vec2;
+import net.minecraft.world.phys.Vec3;
@ -89,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ overworld,
+ 4,
+ this.getName(),
+ new TextComponent(this.getName()),
+ net.minecraft.network.chat.Component.literal(this.getName()),
+ this.server.getServer(),
+ null
+ );
@ -97,8 +96,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private record Source(FeedbackForwardingSender sender) implements CommandSource {
+ @Override
+ public void sendMessage(final net.minecraft.network.chat.Component message, final UUID sender) {
+ this.sender.sendMessage(Identity.identity(sender), PaperAdventure.asAdventure(message));
+ public void sendSystemMessage(final net.minecraft.network.chat.Component message) {
+ this.sender.sendMessage(Identity.nil(), PaperAdventure.asAdventure(message));
+ }
+
+ @Override

View File

@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> {
+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class, "Game Event namespace must have GameEvent type");
+ TagKey<GameEvent> gameEventTagKey = TagKey.create(Registry.GAME_EVENT_REGISTRY, key);
+ TagKey<net.minecraft.world.level.gameevent.GameEvent> gameEventTagKey = TagKey.create(Registry.GAME_EVENT_REGISTRY, key);
+ if (Registry.GAME_EVENT.isKnownTagName(gameEventTagKey)) {
+ return (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(Registry.GAME_EVENT, gameEventTagKey);
+ }

View File

@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Replace rules for Height in Swamp Biome
+ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSwamp;
+ final double minHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMinSpawnHeightInSwamp;
+ if (world.getBiome(pos).is(Biomes.SWAMP) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
+ if (world.getBiome(pos).is(net.minecraft.world.level.biome.Biomes.SWAMP) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
+ // Paper end
return checkMobSpawnRules(type, world, spawnReason, pos, random);
}

View File

@ -21,15 +21,6 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -0,0 +0,0 @@ import java.text.DecimalFormatSymbols;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.Optional;
@@ -0,0 +0,0 @@ public final class ItemStack {
return this.getItem().getTooltipImage(this);
}
@ -46,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ try {
+ //noinspection unchecked
+ list.sort((Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
+ list.sort((java.util.Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
+ } catch (Exception ignored) {}
+ }
+ // Paper end

View File

@ -28,29 +28,13 @@ diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -0,0 +0,0 @@ import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.ItemCooldowns;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
+import net.minecraft.world.item.MapItem; // Paper
import net.minecraft.world.item.ProjectileWeaponItem;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.crafting.Recipe;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.entity.StructureBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
+import net.minecraft.world.level.saveddata.maps.MapItemSavedData; // Paper
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
return null;
}
// CraftBukkit end
+ // Paper start - remove player from map on drop
+ if (itemstack.getItem() == Items.FILLED_MAP) {
+ MapItemSavedData worldmap = MapItem.getSavedData(itemstack, this.level);
+ net.minecraft.world.level.saveddata.maps.MapItemSavedData worldmap = net.minecraft.world.item.MapItem.getSavedData(itemstack, this.level);
+ if (worldmap != null) {
+ worldmap.tickCarriedBy(this, itemstack);
+ }

View File

@ -59,20 +59,12 @@ diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@@ -0,0 +0,0 @@ public class DoublePlantBlock extends BushBlock {
protected static void preventCreativeDropFromBottomPart(Level world, BlockPos pos, BlockState state, Player player) {
// CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) {
+ if (((ServerLevel)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { // Paper
+ if (((net.minecraft.server.level.ServerLevel)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { // Paper
return;
}
// CraftBukkit end

View File

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
list.sort((Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
list.sort((java.util.Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
} catch (Exception ignored) {}
}
+

View File

@ -9,14 +9,6 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.entity.EntityInLevelCallback;
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.levelgen.Heightmap;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.PushReaction;
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@ -42,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ public net.minecraft.world.level.levelgen.PositionalRandomFactory forkPositional() {
+ return new net.minecraft.world.level.levelgen.LegacyRandomSource.LegacyPositionalRandomFactory(this.nextLong());
+ }
+