mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Things, and Starlight (maybe)
This commit is contained in:
parent
7feebbe413
commit
d9a947b54c
29 changed files with 94 additions and 80 deletions
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
|
- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
|
||||||
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
|
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
|
||||||
}
|
}
|
||||||
net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error");
|
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
|
||||||
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
|
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
@ -61,9 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
- ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception);
|
- ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception);
|
||||||
+ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>", exception); // Paper
|
+ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>", exception); // Paper
|
||||||
TextComponent chatcomponenttext = new TextComponent("Internal server error");
|
MutableComponent ichatmutablecomponent = Component.literal("Internal server error");
|
||||||
|
|
||||||
networkmanager.send(new ClientboundDisconnectPacket(chatcomponenttext), (future) -> {
|
networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), (future) -> {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
|
@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Nullable
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@ -82,7 +82,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator {
|
||||||
int j = list.size();
|
int j = list.size();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
int k = Math.max(GenerationStep.Decoration.values().length, j);
|
int k = Math.max(GenerationStep.Decoration.values().length, j);
|
||||||
|
|
||||||
for (int l = 0; l < k; ++l) {
|
for (int l = 0; l < k; ++l) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator {
|
||||||
return (String) optional.orElseGet(placedfeature::toString);
|
return (String) optional.orElseGet(placedfeature::toString);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,16 +4,16 @@ Date: Sun, 24 Oct 2021 15:49:35 +0200
|
||||||
Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans
|
Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
@@ -0,0 +0,0 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent
|
@@ -0,0 +0,0 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.loot.LootTable getLootTable() {
|
public org.bukkit.loot.LootTable getLootTable() {
|
||||||
- return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null;
|
- return entity.getLootTable() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
||||||
+ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null;
|
+ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class CocoaDecorator extends TreeDecorator {
|
@@ -0,0 +0,0 @@ public class CocoaDecorator extends TreeDecorator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void place(LevelSimulatedReader world, BiConsumer<BlockPos, BlockState> replacer, Random random, List<BlockPos> logPositions, List<BlockPos> leavesPositions) {
|
public void place(TreeDecorator.Context generator) {
|
||||||
+ if (logPositions.isEmpty()) return; // Paper
|
+ if (generator.logs().isEmpty()) return; // Paper
|
||||||
if (!(random.nextFloat() >= this.probability)) {
|
RandomSource randomSource = generator.random();
|
||||||
int i = logPositions.get(0).getY();
|
if (!(randomSource.nextFloat() >= this.probability)) {
|
||||||
logPositions.stream().filter((pos) -> {
|
List<BlockPos> list = generator.logs();
|
|
@ -81,6 +81,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- Material.DARK_OAK_WALL_SIGN,
|
- Material.DARK_OAK_WALL_SIGN,
|
||||||
- Material.JUNGLE_SIGN,
|
- Material.JUNGLE_SIGN,
|
||||||
- Material.JUNGLE_WALL_SIGN,
|
- Material.JUNGLE_WALL_SIGN,
|
||||||
|
- Material.MANGROVE_SIGN,
|
||||||
|
- Material.MANGROVE_WALL_SIGN,
|
||||||
- Material.OAK_SIGN,
|
- Material.OAK_SIGN,
|
||||||
- Material.OAK_WALL_SIGN,
|
- Material.OAK_WALL_SIGN,
|
||||||
- Material.SPRUCE_SIGN,
|
- Material.SPRUCE_SIGN,
|
||||||
|
@ -209,18 +211,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new
|
- ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new
|
||||||
- );
|
- );
|
||||||
-
|
-
|
||||||
- register(
|
|
||||||
- Arrays.asList(
|
|
||||||
- Material.CHEST,
|
|
||||||
- Material.TRAPPED_CHEST
|
|
||||||
- ), CraftChest.class, CraftChest::new, ChestBlockEntity::new
|
|
||||||
- );
|
|
||||||
-
|
|
||||||
- register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new);
|
- register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new);
|
||||||
- register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new);
|
- register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new);
|
||||||
- register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new);
|
- register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new);
|
||||||
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
|
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
|
||||||
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
|
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
|
||||||
|
- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new);
|
||||||
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
|
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
|
||||||
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
|
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
|
||||||
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
|
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
|
||||||
|
@ -236,10 +232,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new);
|
- register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new);
|
||||||
- register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new);
|
- register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new);
|
||||||
- register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new);
|
- register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new);
|
||||||
|
- register(Material.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new, SculkCatalystBlockEntity::new);
|
||||||
- register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new);
|
- register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new);
|
||||||
|
- register(Material.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new, SculkShriekerBlockEntity::new);
|
||||||
- register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new);
|
- register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new);
|
||||||
- register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new);
|
- register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new);
|
||||||
- register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new);
|
- register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new);
|
||||||
|
- register(Material.TRAPPED_CHEST, CraftChest.class, CraftChest::new, TrappedChestBlockEntity::new);
|
||||||
+ // Paper start - simplify
|
+ // Paper start - simplify
|
||||||
+ register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new);
|
+ register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new);
|
||||||
+ register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new);
|
+ register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new);
|
||||||
|
@ -249,13 +248,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ register(BlockEntityType.BED, CraftBed.class, CraftBed::new);
|
+ register(BlockEntityType.BED, CraftBed.class, CraftBed::new);
|
||||||
+ register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new);
|
+ register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new);
|
||||||
+ register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new);
|
+ register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new);
|
||||||
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types
|
|
||||||
+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types
|
|
||||||
+ register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new);
|
+ register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new);
|
||||||
+ register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new);
|
+ register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new);
|
||||||
+ register(BlockEntityType.BELL, CraftBell.class, CraftBell::new);
|
+ register(BlockEntityType.BELL, CraftBell.class, CraftBell::new);
|
||||||
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
|
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
|
||||||
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
|
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
|
||||||
|
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
|
||||||
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
|
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
|
||||||
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
|
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
|
||||||
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
|
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
|
||||||
|
@ -271,10 +269,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new);
|
+ register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new);
|
||||||
+ register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new);
|
+ register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new);
|
||||||
+ register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new);
|
+ register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new);
|
||||||
|
+ register(BlockEntityType.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new);
|
||||||
+ register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new);
|
+ register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new);
|
||||||
|
+ register(BlockEntityType.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new);
|
||||||
+ register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new);
|
+ register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new);
|
||||||
+ register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new);
|
+ register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new);
|
||||||
+ register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new);
|
+ register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new);
|
||||||
|
+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,21 +285,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
|
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
|
||||||
- Material blockType,
|
- Material blockType,
|
||||||
|
- Class<B> blockStateType,
|
||||||
|
- BiFunction<World, T, B> blockStateConstructor,
|
||||||
|
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
|
||||||
|
- ) {
|
||||||
|
- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
|
||||||
|
- List<Material> blockTypes,
|
||||||
+ net.minecraft.world.level.block.entity.BlockEntityType<? extends T> blockEntityType, // Paper
|
+ net.minecraft.world.level.block.entity.BlockEntityType<? extends T> blockEntityType, // Paper
|
||||||
Class<B> blockStateType,
|
Class<B> blockStateType,
|
||||||
- BiFunction<World, T, B> blockStateConstructor,
|
- BiFunction<World, T, B> blockStateConstructor,
|
||||||
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
|
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
|
||||||
+ BiFunction<World, T, B> blockStateConstructor // Paper
|
+ BiFunction<World, T, B> blockStateConstructor // Paper
|
||||||
) {
|
) {
|
||||||
- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
|
|
||||||
- List<Material> blockTypes,
|
|
||||||
- Class<B> blockStateType,
|
|
||||||
- BiFunction<World, T, B> blockStateConstructor,
|
|
||||||
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
|
|
||||||
- ) {
|
|
||||||
- BlockStateFactory<B> factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor);
|
- BlockStateFactory<B> factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor);
|
||||||
- for (Material blockType : blockTypes) {
|
- for (Material blockType : blockTypes) {
|
||||||
- CraftBlockStates.register(blockType, factory);
|
- CraftBlockStates.register(blockType, factory);
|
||||||
|
@ -328,6 +329,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
|
public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
|
||||||
Preconditions.checkNotNull(material, "material is null");
|
Preconditions.checkNotNull(material, "material is null");
|
||||||
return CraftBlockStates.getFactory(material).blockStateType;
|
return CraftBlockStates.getFactory(material).blockStateType;
|
||||||
|
@@ -0,0 +0,0 @@ public final class CraftBlockStates {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
|
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items
|
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getRandomItems(LootContext context) {
|
public ObjectArrayList<ItemStack> getRandomItems(LootContext context) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
|
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
|
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
|
|
@ -17,6 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
|
+ this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation);
|
endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,13 +515,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ final byte[] src = other.storageUpdating;
|
+ final byte[] src = other.storageUpdating;
|
||||||
+ final byte[] into;
|
+ final byte[] into;
|
||||||
+
|
+
|
||||||
+ if (this.storageUpdating != null) {
|
+ if (!this.updatingDirty) {
|
||||||
+ into = this.storageUpdating;
|
+ if (this.storageUpdating != null) {
|
||||||
|
+ into = this.storageUpdating = allocateBytes();
|
||||||
|
+ } else {
|
||||||
|
+ this.storageUpdating = into = allocateBytes();
|
||||||
|
+ this.stateUpdating = INIT_STATE_INIT;
|
||||||
|
+ }
|
||||||
|
+ this.updatingDirty = true;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.storageUpdating = into = allocateBytes();
|
+ into = this.storageUpdating;
|
||||||
+ this.stateUpdating = INIT_STATE_INIT;
|
|
||||||
+ }
|
+ }
|
||||||
+ this.updatingDirty = true;
|
|
||||||
+
|
+
|
||||||
+ final int start = 0;
|
+ final int start = 0;
|
||||||
+ final int end = (15 | (15 << 4)) >>> 1;
|
+ final int end = (15 | (15 << 4)) >>> 1;
|
||||||
|
@ -4126,7 +4130,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ private static final Logger LOGGER = LogUtils.getLogger();
|
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
+
|
+
|
||||||
+ private static final int STARLIGHT_LIGHT_VERSION = 6;
|
+ private static final int STARLIGHT_LIGHT_VERSION = 8;
|
||||||
|
+
|
||||||
|
+ public static int getLightVersion() {
|
||||||
|
+ return STARLIGHT_LIGHT_VERSION;
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state";
|
+ private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state";
|
||||||
+ private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state";
|
+ private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state";
|
||||||
|
@ -4249,7 +4257,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world);
|
+ SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world);
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+ // start copy from from the original method
|
+ // start copy from the original method
|
||||||
+ boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION;
|
+ boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION;
|
||||||
+ boolean canReadSky = world.dimensionType().hasSkyLight();
|
+ boolean canReadSky = world.dimensionType().hasSkyLight();
|
||||||
+ ChunkStatus status = ChunkStatus.byName(tag.getString("Status"));
|
+ ChunkStatus status = ChunkStatus.byName(tag.getString("Status"));
|
||||||
|
@ -4443,7 +4451,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public final BlockableEventLoop<Runnable> mainThreadExecutor; // Paper - public
|
+ public final BlockableEventLoop<Runnable> mainThreadExecutor; // Paper - public
|
||||||
final java.util.concurrent.Executor mainInvokingExecutor; // Paper
|
final java.util.concurrent.Executor mainInvokingExecutor; // Paper
|
||||||
public ChunkGenerator generator;
|
public ChunkGenerator generator;
|
||||||
public final Supplier<DimensionDataStorage> overworldDataStorage;
|
private RandomState randomState;
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||||
|
@ -4791,9 +4799,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour {
|
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour {
|
||||||
this.isViewBlocking = blockbase_info.isViewBlocking;
|
|
||||||
this.hasPostProcess = blockbase_info.hasPostProcess;
|
this.hasPostProcess = blockbase_info.hasPostProcess;
|
||||||
this.emissiveRendering = blockbase_info.emissiveRendering;
|
this.emissiveRendering = blockbase_info.emissiveRendering;
|
||||||
|
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState());
|
||||||
+ this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
|
+ this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
|
||||||
}
|
}
|
||||||
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
||||||
|
@ -5005,7 +5013,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.jav
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||||
return this.get(this.strategy.getIndex(x, y, z));
|
return this.get(this.strategy.getIndex(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5036,8 +5044,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
private static final String BLOCK_TICKS_TAG = "block_ticks";
|
public static final String BLOCK_LIGHT_TAG = "BlockLight";
|
||||||
private static final String FLUID_TICKS_TAG = "fluid_ticks";
|
public static final String SKY_LIGHT_TAG = "SkyLight";
|
||||||
|
|
||||||
+ // Paper start - replace light engine impl
|
+ // Paper start - replace light engine impl
|
||||||
+ private static final int STARLIGHT_LIGHT_VERSION = 7;
|
+ private static final int STARLIGHT_LIGHT_VERSION = 7;
|
||||||
|
@ -5069,9 +5077,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world);
|
+ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world);
|
||||||
+ boolean canReadSky = world.dimensionType().hasSkyLight();
|
+ boolean canReadSky = world.dimensionType().hasSkyLight();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
Registry<Biome> iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||||
if (flag) {
|
Codec<PalettedContainer<Holder<Biome>>> codec = ChunkSerializer.makeBiomeCodecRW(iregistry); // CraftBukkit - read/write
|
||||||
tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main
|
boolean flag2 = false;
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
DataResult dataresult;
|
DataResult dataresult;
|
||||||
|
|
||||||
|
@ -5082,44 +5090,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
int k = world.getSectionIndexFromSectionY(b0);
|
int k = world.getSectionIndexFromSectionY(b0);
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
}
|
boolean flag3 = nbttagcompound1.contains("BlockLight", 7);
|
||||||
|
boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7);
|
||||||
|
|
||||||
if (flag) {
|
- if (flag3 || flag4) {
|
||||||
- if (nbttagcompound1.contains("BlockLight", 7)) {
|
- if (!flag2) {
|
||||||
|
+ // Paper start - rewrite the light engine
|
||||||
|
+ if (true || flag3 || flag4) {
|
||||||
|
+ if ((flag3 || flag4) && !flag2) {
|
||||||
|
tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main
|
||||||
|
lightengine.retainData(chunkPos, true);
|
||||||
|
}); // Paper - delay this task since we're executing off-main
|
||||||
|
flag2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ int y = sectionData.getByte("Y");
|
||||||
|
if (flag3) {
|
||||||
- // Paper start - delay this task since we're executing off-main
|
- // Paper start - delay this task since we're executing off-main
|
||||||
- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight"));
|
- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight").clone());
|
||||||
- tasksToExecuteOnMain.add(() -> {
|
- tasksToExecuteOnMain.add(() -> {
|
||||||
- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkcoordintpair1, b0), blockLight, true);
|
- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), blockLight, true);
|
||||||
- });
|
- });
|
||||||
- // Paper end - delay this task since we're executing off-main
|
- // Paper end - delay this task since we're executing off-main
|
||||||
+ // Paper start - rewrite light engine
|
|
||||||
+ int y = sectionData.getByte("Y");
|
|
||||||
+
|
|
||||||
+ if (sectionData.contains("BlockLight", 7)) {
|
|
||||||
+ // this is where our diff is
|
+ // this is where our diff is
|
||||||
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety
|
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety
|
||||||
+ } else {
|
+ } else {
|
||||||
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG));
|
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (flag1 && nbttagcompound1.contains("SkyLight", 7)) {
|
if (flag4) {
|
||||||
- // Paper start - delay this task since we're executing off-main
|
- // Paper start - delay this task since we're executing off-main
|
||||||
- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight"));
|
- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight").clone());
|
||||||
- tasksToExecuteOnMain.add(() -> {
|
- tasksToExecuteOnMain.add(() -> {
|
||||||
- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkcoordintpair1, b0), skyLight, true);
|
- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), skyLight, true);
|
||||||
- });
|
- });
|
||||||
- // Paper end - delay this task since we're executing off-mai
|
- // Paper end - delay this task since we're executing off-mai
|
||||||
+ if (canReadSky) {
|
+ // we store under the same key so mod programs editing nbt
|
||||||
+ if (sectionData.contains("SkyLight", 7)) {
|
+ // can still read the data, hopefully.
|
||||||
+ // we store under the same key so mod programs editing nbt
|
+ // however, for compatibility we store chunks as unlit so vanilla
|
||||||
+ // can still read the data, hopefully.
|
+ // is forced to re-light them if it encounters our data. It's too much of a burden
|
||||||
+ // however, for compatibility we store chunks as unlit so vanilla
|
+ // to try and maintain compatibility with a broken and inferior skylight management system.
|
||||||
+ // is forced to re-light them if it encounters our data. It's too much of a burden
|
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
|
||||||
+ // to try and maintain compatibility with a broken and inferior skylight management system.
|
|
||||||
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
|
|
||||||
+ } else {
|
|
||||||
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(SKYLIGHT_STATE_TAG));
|
|
||||||
+ }
|
|
||||||
}
|
}
|
||||||
+ // Paper end - rewrite light engine
|
+ // Paper end - rewrite light engine
|
||||||
}
|
}
|
||||||
|
@ -5128,9 +5139,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
}, chunkPos);
|
}, chunkPos);
|
||||||
|
|
||||||
object = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
|
object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
|
||||||
+ ((LevelChunk)object).setBlockNibbles(blockNibbles); // Paper - replace light impl
|
+ ((LevelChunk)object1).setBlockNibbles(blockNibbles); // Paper - replace light impl
|
||||||
+ ((LevelChunk)object).setSkyNibbles(skyNibbles); // Paper - replace light impl
|
+ ((LevelChunk)object1).setSkyNibbles(skyNibbles); // Paper - replace light impl
|
||||||
} else {
|
} else {
|
||||||
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
|
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
|
||||||
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
|
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
|
||||||
|
@ -5141,7 +5152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl
|
+ protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl
|
||||||
+ protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl
|
+ protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl
|
||||||
|
|
||||||
object = protochunk;
|
object1 = protochunk;
|
||||||
protochunk.setInhabitedTime(l);
|
protochunk.setInhabitedTime(l);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ dependencies {
|
||||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2")
|
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||||
|
|
||||||
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
||||||
+ // Paper start - Use Velocity cipher
|
+ // Paper start - Use Velocity cipher
|
Loading…
Reference in a new issue