fix a bunch of compile issues

This commit is contained in:
Jake Potrebic 2024-12-14 20:15:49 -08:00
parent 7ac9b00916
commit 0262d9a165
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
19 changed files with 29 additions and 37 deletions

View file

@ -30,8 +30,6 @@ public net.minecraft.network.chat.numbers.StyledFormat style
public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket <init>(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/nbt/CompoundTag;)V
public net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket blockState
public net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket pos
public net.minecraft.network.protocol.game.ClientboundTabListPacket footer
public net.minecraft.network.protocol.game.ClientboundTabListPacket header
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket hasPos
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket hasRot
public net.minecraft.network.protocol.game.ServerboundMovePlayerPacket x
@ -488,7 +486,6 @@ public net.minecraft.world.item.context.UseOnContext <init>(Lnet/minecraft/world
public net.minecraft.world.item.crafting.RecipeManager recipes
public net.minecraft.world.item.crafting.RecipeMap byKey
public net.minecraft.world.item.crafting.RecipeMap byType
public net.minecraft.world.item.enchantment.Enchantment definition
public net.minecraft.world.item.enchantment.ItemEnchantments showInTooltip
public net.minecraft.world.item.trading.MerchantOffer demand
public net.minecraft.world.item.trading.MerchantOffer result

View file

@ -331,7 +331,7 @@
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ if (this.options.has("forceUpgrade")) {
+ net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.options.has("eraseCache"), () -> {
+ net.minecraft.server.Main.forceUpgrade(worldSession, net.minecraft.util.datafix.DataFixers.getDataFixer(), this.options.has("eraseCache"), () -> {
+ return true;
+ }, iregistrycustom_dimension, this.options.has("recreateRegionFiles"));
+ }
@ -1061,7 +1061,7 @@
- this.getPlayerList().getPlayers().forEach(this::sendDifficultyUpdate);
+ // Paper start - per level difficulty
+ public void setDifficulty(ServerLevel level, Difficulty difficulty, boolean forceUpdate) {
+ net.minecraft.world.level.storage.PrimaryLevelData worldData = level.serverLevelData;
+ net.minecraft.world.level.storage.PrimaryLevelData worldData = (net.minecraft.world.level.storage.PrimaryLevelData) level.serverLevelData;
+ if (forceUpdate || !worldData.isDifficultyLocked()) {
+ worldData.setDifficulty(worldData.isHardcore() ? Difficulty.HARD : difficulty);
+ level.setSpawnSettings(worldData.getDifficulty() != Difficulty.PEACEFUL && ((net.minecraft.server.dedicated.DedicatedServer) this).settings.getProperties().spawnMonsters);

View file

@ -29,7 +29,7 @@
- ) {
- super(serverThread, storageSource, packRepository, worldStem, Proxy.NO_PROXY, fixerUpper, services, progressListenerFactory);
+ // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings settings, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
+ public DedicatedServer(joptsimple.OptionSet options, net.minecraft.server.WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings settings, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
+ super(options, worldLoader, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
+ // CraftBukkit end
this.settings = settings;
@ -432,7 +432,7 @@
+ }
+
+ @Override
+ public CommandSender getBukkitSender(CommandSourceStack wrapper) {
+ public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) {
+ return this.console;
+ }
+ // CraftBukkit end

View file

@ -1,13 +1,5 @@
--- a/net/minecraft/world/entity/animal/Sheep.java
+++ b/net/minecraft/world/entity/animal/Sheep.java
@@ -40,7 +_,6 @@
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
@@ -158,7 +_,19 @@
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.SHEARS)) {

View file

@ -35,7 +35,7 @@
RandomSource random = this.animal.getRandom();
if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), random.nextInt(7) + 1));
+ if (event.getExperience() > 0) this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), , event.getExperience(), org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause)); // Paper - Add EntityFertilizeEggEvent event
+ if (event.getExperience() > 0) this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), event.getExperience(), org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause)); // Paper - Add EntityFertilizeEggEvent event
}
}
}

View file

@ -49,13 +49,13 @@
+
+ // CraftBukkit start
+ @Override
+ public CraftInventoryView getBukkitView() {
+ public org.bukkit.craftbukkit.inventory.CraftInventoryView getBukkitView() {
+ if (this.bukkitEntity != null) {
+ return this.bukkitEntity;
+ }
+
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftSlots, this.resultSlots);
+ this.bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ org.bukkit.craftbukkit.inventory.CraftInventoryCrafting inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryCrafting(this.craftSlots, this.resultSlots);
+ this.bukkitEntity = new org.bukkit.craftbukkit.inventory.CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return this.bukkitEntity;
+ }
+ // CraftBukkit end

View file

@ -47,10 +47,10 @@
+ // copied the last function parameter (listed below)
+ Vec3 vec3d = traverseContext.getFrom().subtract(traverseContext.getTo());
+
+ return BlockHitResult.miss(traverseContext.getTo(), Direction.getApproximateNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo()));
+ return BlockHitResult.miss(traverseContext.getTo(), Direction.getApproximateNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(traverseContext.getTo()));
+ }
+ // Paper end - Prevent raytrace from loading chunks
+ if (blockState.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, blockposition)))) return null; // Paper - Perf: optimise air cases & check canCollide predicate
+ if (blockState.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, traversePos)))) return null; // Paper - Perf: optimise air cases & check canCollide predicate
+ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: don't need to go to world state again
Vec3 from = traverseContext.getFrom();
Vec3 to = traverseContext.getTo();

View file

@ -130,7 +130,7 @@
+ java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config
+ io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator // Paper - create paper world config
) {
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
+ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.generator = gen;
+ this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
@ -587,7 +587,7 @@
+ // Paper start - Prevent block entity and entity crashes
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ MinecraftServer.LOGGER.error(msg, var6);
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ // Paper end - Prevent block entity and entity crashes
}

View file

@ -86,10 +86,10 @@
+ popExperience(level, pos, amount, null);
+ }
+ public void popExperience(ServerLevel level, BlockPos pos, int amount, net.minecraft.world.entity.Entity entity) {
+ // Paper end - add entity paramete
+ // Paper end - add entity parameter
if (level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
- ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount);
+ ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount, entity); // Paper
+ ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, entity); // Paper
}
}

View file

@ -24,7 +24,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -56,7 +56,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -24,7 +24,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -25,7 +25,7 @@
+ }
+
+ @Override
+ public java.util.List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public java.util.List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -26,7 +26,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View file

@ -1,10 +1,13 @@
--- a/net/minecraft/world/level/block/entity/LecternBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/LecternBlockEntity.java
@@ -33,6 +_,51 @@
@@ -32,7 +_,53 @@
public static final int NUM_DATA = 1;
public static final int SLOT_BOOK = 0;
public static final int NUM_SLOTS = 1;
public final Container bookAccess = new Container() {
+ // CraftBukkit start - add fields and methods
- public final Container bookAccess = new Container() {
+ // CraftBukkit start - add fields and methods
+ public final Container bookAccess = new LecternInventory();
+ public class LecternInventory implements Container {
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = 1;
+

View file

@ -137,7 +137,7 @@
if (structureStart.isValid()) {
+ // CraftBukkit start
+ BoundingBox box = structureStart.getBoundingBox();
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structureStart.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkPos.x, chunkPos.z);
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structureManager.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkPos.x, chunkPos.z);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return true;