3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Dieser Commit ist enthalten in:
Jason Penilla 2024-04-25 21:27:19 -07:00
Ursprung 867eb9054b
Commit 62b96c520f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8
13 geänderte Dateien mit 142 neuen und 42 gelöschten Zeilen

Datei anzeigen

@ -5248,7 +5248,7 @@ index ec8ef47ed7cc627fef2c71b2b281119245e88b97..53cbc743b1e722d029021f9d63ffbf7d
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
index 11d23b3a9a0c99ede04f2cd64d8022b2b0b737df..02f9a9e5240222548bec643b817734f702ba8e98 100644
index 11d23b3a9a0c99ede04f2cd64d8022b2b0b737df..7bc082d08a3d577481046818f0d58133413fc723 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
@@ -31,6 +31,18 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@ -5260,7 +5260,7 @@ index 11d23b3a9a0c99ede04f2cd64d8022b2b0b737df..02f9a9e5240222548bec643b817734f7
+ public Inventory createInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) {
+ Container te = getTileEntity();
+ if (te instanceof RandomizableContainerBlockEntity) {
+ ((RandomizableContainerBlockEntity) te).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
+ ((RandomizableContainerBlockEntity) te).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
+ }
+
+ return getInventory(te);
@ -5296,7 +5296,7 @@ index 11d23b3a9a0c99ede04f2cd64d8022b2b0b737df..02f9a9e5240222548bec643b817734f7
+ // BrewingStand does not extend TileEntityLootable
+ Container tileEntity = getTileEntity();
+ if (tileEntity instanceof BrewingStandBlockEntity) {
+ ((BrewingStandBlockEntity) tileEntity).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
+ ((BrewingStandBlockEntity) tileEntity).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
+ }
+ return getInventory(tileEntity);
+ }

Datei anzeigen

@ -253,7 +253,7 @@ index fc0e1212022d1aa3506699b60ef338196eb54eba..da1c1fe0faf6819b15a81d6ad5337094
static class MinecraftInventory implements Container {
private final NonNullList<ItemStack> items;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
index 02f9a9e5240222548bec643b817734f702ba8e98..4a4996f8653edaf3182887821a8762caceab58ee 100644
index 7bc082d08a3d577481046818f0d58133413fc723..a6c758c5c5da2fb3f2d251bc109f72a5d8b0eb14 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
@@ -28,7 +28,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@ -266,7 +266,7 @@ index 02f9a9e5240222548bec643b817734f702ba8e98..4a4996f8653edaf3182887821a8762ca
// Paper start
@@ -39,7 +39,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
((RandomizableContainerBlockEntity) te).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
((RandomizableContainerBlockEntity) te).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
}
- return getInventory(te);
@ -294,11 +294,13 @@ index 02f9a9e5240222548bec643b817734f702ba8e98..4a4996f8653edaf3182887821a8762ca
return new CraftInventory(tileEntity);
}
@@ -70,7 +78,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@@ -69,8 +77,8 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@Override
public Inventory createInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) {
Container tileEntity = getTileEntity();
((AbstractFurnaceBlockEntity) tileEntity).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
- ((AbstractFurnaceBlockEntity) tileEntity).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
- return getInventory(tileEntity);
+ ((AbstractFurnaceBlockEntity) tileEntity).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
+ return this.getInventory(owner, type, tileEntity); // Paper
}
// Paper end
@ -326,7 +328,7 @@ index 02f9a9e5240222548bec643b817734f702ba8e98..4a4996f8653edaf3182887821a8762ca
}
@@ -102,7 +118,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
if (tileEntity instanceof BrewingStandBlockEntity) {
((BrewingStandBlockEntity) tileEntity).setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(title));
((BrewingStandBlockEntity) tileEntity).name = io.papermc.paper.adventure.PaperAdventure.asVanilla(title);
}
- return getInventory(tileEntity);
+ return this.getInventory(owner, type, tileEntity); // Paper

Datei anzeigen

@ -25,7 +25,7 @@ index 4d7f95d2bd415bacccee145bfc47f2b480530c11..4d3a04e1d7910c4e71ac9a1cebb58e48
int k = (int) Math.floor(d0 * (double) merchantrecipe1.getBaseCostA().getCount());
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index 89982d25f60c8b60ba91e559ef88278f338fe215..bffa088b13312d525efaab3d7988a08953c4d9c3 100644
index 89982d25f60c8b60ba91e559ef88278f338fe215..0efc8d997b34302c3e0a5d7ec73a11a940dbeefe 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -33,6 +33,10 @@ public class MerchantOffer {
@ -47,24 +47,32 @@ index 89982d25f60c8b60ba91e559ef88278f338fe215..bffa088b13312d525efaab3d7988a089
// CraftBukkit start
private CraftMerchantRecipe bukkitHandle;
@@ -59,7 +64,7 @@ public class MerchantOffer {
@@ -53,13 +58,14 @@ public class MerchantOffer {
return (this.bukkitHandle == null) ? this.bukkitHandle = new CraftMerchantRecipe(this) : this.bukkitHandle;
}
- public MerchantOffer(ItemCost baseCostA, Optional<ItemCost> costB, ItemStack result, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) {
+ public MerchantOffer(ItemCost baseCostA, Optional<ItemCost> costB, ItemStack result, int uses, int maxUses, int experience, float priceMultiplier, int demand, final boolean ignoreDiscounts, CraftMerchantRecipe bukkit) { // Paper
this(baseCostA, costB, result, uses, maxUses, experience, priceMultiplier, demand);
+ this.ignoreDiscounts = ignoreDiscounts; // Paper
this.bukkitHandle = bukkit;
}
// CraftBukkit end
- private MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) {
+ private MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience, boolean ignoreDiscounts) { // Paper
+ private MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience, final boolean ignoreDiscounts) { // Paper
this.baseCostA = firstBuyItem;
this.costB = secondBuyItem;
this.result = sellItem;
@@ -70,6 +75,7 @@ public class MerchantOffer {
@@ -70,6 +76,7 @@ public class MerchantOffer {
this.demand = demandBonus;
this.priceMultiplier = priceMultiplier;
this.xp = merchantExperience;
+ this.ignoreDiscounts = ignoreDiscounts;
+ this.ignoreDiscounts = ignoreDiscounts; // Paper
}
public MerchantOffer(ItemCost buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) {
@@ -85,11 +91,11 @@ public class MerchantOffer {
@@ -85,11 +92,11 @@ public class MerchantOffer {
}
public MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] living entity allow attribute registration
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index f03f40e2624d0e8e27a6fb7ae33d82cb614252f4..b02c8514aac174db1c04a6c8240851eff474906f 100644
index f03f40e2624d0e8e27a6fb7ae33d82cb614252f4..9ef8f014af332da129bfcd3370da983ec035ecc6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -106,4 +106,12 @@ public class AttributeMap {
@ -14,7 +14,7 @@ index f03f40e2624d0e8e27a6fb7ae33d82cb614252f4..b02c8514aac174db1c04a6c8240851ef
}
+
+ // Paper - start - living entity allow attribute registration
+ public void registerAttribute(Attribute attributeBase) {
+ public void registerAttribute(Holder<Attribute> attributeBase) {
+ AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute);
+ attributes.put(attributeBase, attributeModifiable);
+ }
@ -22,7 +22,7 @@ index f03f40e2624d0e8e27a6fb7ae33d82cb614252f4..b02c8514aac174db1c04a6c8240851ef
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
index a0a34f680e21007ebf2c2497d2e6505eedae6481..5314905063e62f0f5ed56e476718ba7610bb711f 100644
index a0a34f680e21007ebf2c2497d2e6505eedae6481..485b4d5a0ae9d8ac528749e87b4b2833732120a8 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@@ -35,4 +35,11 @@ public class CraftAttributeMap implements Attributable {
@ -33,7 +33,7 @@ index a0a34f680e21007ebf2c2497d2e6505eedae6481..5314905063e62f0f5ed56e476718ba76
+ @Override
+ public void registerAttribute(Attribute attribute) {
+ Preconditions.checkArgument(attribute != null, "attribute");
+ handle.registerAttribute(CraftAttribute.bukkitToMinecraft(attribute));
+ handle.registerAttribute(CraftAttribute.bukkitToMinecraftHolder(attribute));
+ }
+ // Paper end - living entity allow attribute registration
}

Datei anzeigen

@ -4,7 +4,7 @@ Date: Fri, 20 Aug 2021 13:03:21 -0700
Subject: [PATCH] Get entity default attributes
== AT ==
public net.minecraft.world.entity.ai.attributes.AttributeSupplier getAttributeInstance(Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeInstance;
public net.minecraft.world.entity.ai.attributes.AttributeSupplier getAttributeInstance(Lnet/minecraft/core/Holder;)Lnet/minecraft/world/entity/ai/attributes/AttributeInstance;
diff --git a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java
new file mode 100644
@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..12135ffeacd648f6bc4d7d327059ea1a
+}
diff --git a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java
new file mode 100644
index 0000000000000000000000000000000000000000..68044b8439c302114240d0ae4da93ab3e0789cd2
index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b066d7e43
--- /dev/null
+++ b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeMap.java
@@ -0,0 +1,32 @@
@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..68044b8439c302114240d0ae4da93ab3
+
+ @Override
+ public @Nullable AttributeInstance getAttribute(@NotNull Attribute attribute) {
+ net.minecraft.world.entity.ai.attributes.Attribute nmsAttribute = CraftAttribute.bukkitToMinecraft(attribute);
+ net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> nmsAttribute = CraftAttribute.bukkitToMinecraftHolder(attribute);
+ if (!this.handle.hasAttribute(nmsAttribute)) {
+ return null;
+ }

Datei anzeigen

@ -5,14 +5,21 @@ Subject: [PATCH] prevent unintended light block manipulation
diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java
index 01722473a4861533dba0ab6edf3982c0278c41e1..a57dd6a6815a83c6a9e7d9eb75e4fccc014e6fac 100644
index 01722473a4861533dba0ab6edf3982c0278c41e1..2b3c395529a15c9f07a4c0cff7f82199298bcb6d 100644
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
@@ -52,6 +52,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
@@ -49,6 +49,14 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
builder.add(LEVEL, WATERLOGGED);
}
+ // Paper start - prevent unintended light block manipulation
+ @Override
+ protected net.minecraft.world.ItemInteractionResult useItemOn(final ItemStack stack, final BlockState state, final Level world, final BlockPos pos, final Player player, final net.minecraft.world.InteractionHand hand, final BlockHitResult hit) {
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return net.minecraft.world.ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; } // Paper - Prevent unintended light block manipulation
+ return super.useItemOn(stack, state, world, pos, player, hand, hit);
+ }
+ // Paper end - prevent unintended light block manipulation
+
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (!world.isClientSide && player.canUseGameMasterBlocks()) {
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper - Prevent unintended light block manipulation
world.setBlock(pos, state.cycle(LEVEL), 2);
return InteractionResult.SUCCESS;
} else {

Datei anzeigen

@ -3,9 +3,12 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 27 May 2021 21:58:24 -0700
Subject: [PATCH] More PotionEffectType API
== AT ==
public net.minecraft.world.effect.MobEffect attributeModifiers
public net.minecraft.world.effect.MobEffect$AttributeTemplate
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
index 8dffef71c8b193c0fc84b65a592c93827e341bf7..97b31ffb86fa5c8b567a6b3793389571b6bf846f 100644
index 8dffef71c8b193c0fc84b65a592c93827e341bf7..335b86e6357cf49eb170a415766f5e9160a7661c 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
@@ -123,6 +123,48 @@ public class CraftPotionEffectType extends PotionEffectType implements Handleabl
@ -32,7 +35,7 @@ index 8dffef71c8b193c0fc84b65a592c93827e341bf7..97b31ffb86fa5c8b567a6b3793389571
+ com.google.common.base.Preconditions.checkArgument(effectAmplifier >= 0, "effectAmplifier must be greater than or equal to 0");
+ Holder<net.minecraft.world.entity.ai.attributes.Attribute> nmsAttribute = org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraftHolder(attribute);
+ com.google.common.base.Preconditions.checkArgument(this.handle.attributeModifiers.containsKey(nmsAttribute), attribute + " is not present on " + this.getKey());
+ return this.handle.attributeModifiers.get(nmsAttribute).create(effectAmplifier).getAmount();
+ return this.handle.attributeModifiers.get(nmsAttribute).create(this.handle.getDescriptionId(), effectAmplifier).amount();
+ }
+
+ @Override

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix FurnaceInventory for smokers and blast furnaces
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
index 4a4996f8653edaf3182887821a8762caceab58ee..acb80ea99df024a30d2b8a8567d90379842b9dd3 100644
index a6c758c5c5da2fb3f2d251bc109f72a5d8b0eb14..ad2cb9a1352abd855bf11a390c9788835857380a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
@@ -65,7 +65,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat

Datei anzeigen

@ -4,8 +4,21 @@ Date: Thu, 7 Apr 2022 17:49:25 -0400
Subject: [PATCH] Nameable Banner API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index 2656e06ab2269141a13011eaa906f601887ca3e2..26d2f63d2add276a2f51c399f494a7219413d3e3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -29,7 +29,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
public static final int MAX_PATTERNS = 6;
private static final String TAG_PATTERNS = "patterns";
@Nullable
- private Component name;
+ public Component name; // Paper - public
public DyeColor baseColor;
private BannerPatternLayers patterns;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
index 26ae3fe910964193c7fb22b8b644d5c0476f8d3d..0f8de5b87deeaf2aca043c017576f7c54c4a2f8e 100644
index 26ae3fe910964193c7fb22b8b644d5c0476f8d3d..65a9213ce8197d50a58f94edfd60c25c2be848be 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java
@@ -110,4 +110,26 @@ public class CraftBanner extends CraftBlockEntityState<BannerBlockEntity> implem
@ -21,7 +34,7 @@ index 26ae3fe910964193c7fb22b8b644d5c0476f8d3d..0f8de5b87deeaf2aca043c017576f7c5
+
+ @Override
+ public void customName(net.kyori.adventure.text.Component customName) {
+ this.getSnapshot().setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(customName));
+ this.getSnapshot().name = io.papermc.paper.adventure.PaperAdventure.asVanilla(customName);
+ }
+
+ @Override

Datei anzeigen

@ -20275,10 +20275,64 @@ index bac191f92ea3735df19c68d5568c2c7962c8680f..5d94aee1303d9eca5f1fa9a2e033ad0d
public void setFullStatus(Supplier<FullChunkStatus> levelTypeProvider) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..68e1e3d525ee6cec23971eea431f22a535207b2b 100644
index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0ad60235c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
@@ -128,6 +128,29 @@ public class ChunkStatus {
@@ -21,13 +21,14 @@ import net.minecraft.world.level.chunk.ProtoChunk;
import net.minecraft.world.level.levelgen.Heightmap;
public class ChunkStatus {
+ static final ChunkStatus.LoadingTask PASSTHROUGH_LOAD_TASK = (WorldGenContext context, ChunkStatus status, ToFullChunk fullChunkConverter, ChunkAccess chunk) -> CompletableFuture.completedFuture(chunk); // Paper - rewrite chunk system
public static final int MAX_STRUCTURE_DISTANCE = 8;
private static final EnumSet<Heightmap.Types> PRE_FEATURES = EnumSet.of(Heightmap.Types.OCEAN_FLOOR_WG, Heightmap.Types.WORLD_SURFACE_WG);
public static final EnumSet<Heightmap.Types> POST_FEATURES = EnumSet.of(
Heightmap.Types.OCEAN_FLOOR, Heightmap.Types.WORLD_SURFACE, Heightmap.Types.MOTION_BLOCKING, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES
);
public static final ChunkStatus EMPTY = register(
- "empty", null, -1, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateEmpty, ChunkStatusTasks::loadPassThrough
+ "empty", null, -1, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateEmpty, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus STRUCTURE_STARTS = register(
"structure_starts",
@@ -47,22 +48,22 @@ public class ChunkStatus {
PRE_FEATURES,
ChunkType.PROTOCHUNK,
ChunkStatusTasks::generateStructureReferences,
- ChunkStatusTasks::loadPassThrough
+ PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus BIOMES = register(
- "biomes", STRUCTURE_REFERENCES, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateBiomes, ChunkStatusTasks::loadPassThrough
+ "biomes", STRUCTURE_REFERENCES, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateBiomes, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus NOISE = register(
- "noise", BIOMES, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateNoise, ChunkStatusTasks::loadPassThrough
+ "noise", BIOMES, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateNoise, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus SURFACE = register(
- "surface", NOISE, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateSurface, ChunkStatusTasks::loadPassThrough
+ "surface", NOISE, 8, false, PRE_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateSurface, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus CARVERS = register(
- "carvers", SURFACE, 8, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateCarvers, ChunkStatusTasks::loadPassThrough
+ "carvers", SURFACE, 8, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateCarvers, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus FEATURES = register(
- "features", CARVERS, 8, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateFeatures, ChunkStatusTasks::loadPassThrough
+ "features", CARVERS, 8, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateFeatures, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus INITIALIZE_LIGHT = register(
"initialize_light",
@@ -78,7 +79,7 @@ public class ChunkStatus {
"light", INITIALIZE_LIGHT, 1, true, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateLight, ChunkStatusTasks::loadLight
);
public static final ChunkStatus SPAWN = register(
- "spawn", LIGHT, 1, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateSpawn, ChunkStatusTasks::loadPassThrough
+ "spawn", LIGHT, 1, false, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateSpawn, PASSTHROUGH_LOAD_TASK // Paper - rewrite chunk system
);
public static final ChunkStatus FULL = register(
"full", SPAWN, 0, false, POST_FEATURES, ChunkType.LEVELCHUNK, ChunkStatusTasks::generateFull, ChunkStatusTasks::loadFull
@@ -128,6 +129,29 @@ public class ChunkStatus {
}
}
// Paper end - starlight
@ -20296,7 +20350,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..68e1e3d525ee6cec23971eea431f22a5
+ }
+
+ public final boolean isEmptyLoadStatus() {
+ return this.loadingTask == PASSTHROUGH_LOAD_TASK; // TODO fix this
+ return this.loadingTask == PASSTHROUGH_LOAD_TASK;
+ }
+
+ public final boolean isEmptyGenStatus() {
@ -20308,7 +20362,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..68e1e3d525ee6cec23971eea431f22a5
private static ChunkStatus register(
String id,
@@ -190,6 +213,13 @@ public class ChunkStatus {
@@ -190,6 +214,13 @@ public class ChunkStatus {
this.chunkType = chunkType;
this.heightmapsAfter = heightMapTypes;
this.index = previous == null ? 0 : previous.getIndex() + 1;
@ -20323,10 +20377,22 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..68e1e3d525ee6cec23971eea431f22a5
public int getIndex() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
index ce7f154b9dad4e78ee0189405cf57dcb3d5301b8..f095704157653f30615c92a8d6f2900fe1721360 100644
index ce7f154b9dad4e78ee0189405cf57dcb3d5301b8..b66c0c4a9e9b9e5dbcb51b23319f0d4b23837139 100644
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -113,11 +113,11 @@ public class ChunkStatusTasks {
@@ -26,8 +26,9 @@ public class ChunkStatusTasks {
return CompletableFuture.completedFuture(chunk);
}
- static CompletableFuture<ChunkAccess> loadPassThrough(WorldGenContext context, ChunkStatus status, ToFullChunk fullChunkConverter, ChunkAccess chunk) {
- return CompletableFuture.completedFuture(chunk);
+ @io.papermc.paper.annotation.DoNotUse @Deprecated(forRemoval = true) // Paper - rewrite chunk system - use ChunkStatus.PASSTHROUGH_LOAD_TASK instead
+ static CompletableFuture<ChunkAccess> loadPassThrough(WorldGenContext context, ChunkStatus status, ToFullChunk fullChunkConverter, ChunkAccess chunk) { // Paper - rewrite chunk system - diff on change
+ return CompletableFuture.completedFuture(chunk); // Paper - rewrite chunk system - diff on change
}
static CompletableFuture<ChunkAccess> generateStructureStarts(WorldGenContext context, ChunkStatus status, Executor executor, ToFullChunk fullChunkConverter, List<ChunkAccess> chunks, ChunkAccess chunk) {
@@ -113,11 +114,11 @@ public class ChunkStatusTasks {
}
static CompletableFuture<ChunkAccess> generateInitializeLight(WorldGenContext context, ChunkStatus status, Executor executor, ToFullChunk fullChunkConverter, List<ChunkAccess> chunks, ChunkAccess chunk) {

Datei anzeigen

@ -19,6 +19,7 @@ Just added Bukkit's event system and took a few liberties with dead code and com
== AT ==
public net.minecraft.world.level.block.RedStoneWireBlock shouldSignal
public net.minecraft.world.level.block.RedStoneWireBlock canSurvive(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;)Z
Co-authored-by: egg82 <phantom_zero@ymail.com>
@ -987,7 +988,7 @@ index 0000000000000000000000000000000000000000..9f17170179cc99d84ad25a1e838aff3d
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 9936fd34ab51693559638709f3eccac59ba1832d..7ec3b0f9488b732c51cd1b02fb0dfe3c45aec2a4 100644
index c73bf0b36252796ca93c500affa2be568e3f6c9e..18ed178223cca85dbba65b1e07741622e266d318 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -258,6 +258,116 @@ public class RedStoneWireBlock extends Block {

Datei anzeigen

@ -2054,7 +2054,7 @@ index 07281d73fcbca2ea5f8bce25f6bf961d258bf8a0..0a8eeebb2d702ebcefd9f26cc0f41d1e
+ // Paper end - optimize redstone (Alternate Current)
}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 7ec3b0f9488b732c51cd1b02fb0dfe3c45aec2a4..f6c1e40001af507b4eed8f46a9ed4e4704b48d72 100644
index 18ed178223cca85dbba65b1e07741622e266d318..c131734cad123a35456d18f8a161f77a4ac9ac99 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -258,7 +258,7 @@ public class RedStoneWireBlock extends Block {

Datei anzeigen

@ -20,7 +20,7 @@ After this patch, the full iteration over all recipes checking for a match shoul
initial recipe match. Then that recipe will be checked first for all future recipe match checks.
diff --git a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
index 7a0c1a55a211035bbca7b97293e94b04ae308bae..c3800bdd5096cb06e085e28f6bf0f65586ecf11e 100644
index 7a0c1a55a211035bbca7b97293e94b04ae308bae..59220eb9e74877e18b3e015dc0d25c892f45f746 100644
--- a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
@@ -76,7 +76,8 @@ public class CraftingMenu extends RecipeBookMenu<CraftingContainer> {
@ -29,7 +29,7 @@ index 7a0c1a55a211035bbca7b97293e94b04ae308bae..c3800bdd5096cb06e085e28f6bf0f655
ItemStack itemstack = ItemStack.EMPTY;
- Optional<RecipeHolder<CraftingRecipe>> optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world);
+ final RecipeHolder<?> currentRecipe = craftingInventory.getCurrentRecipe(); // Paper - Perf: Improve mass crafting; check last recipe used first
+ Optional<RecipeHolder<CraftingRecipe>> optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.id()).map(com.mojang.datafixers.util.Pair::getSecond); // Paper - Perf: Improve mass crafting; check last recipe used first
+ Optional<RecipeHolder<CraftingRecipe>> optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.id()); // Paper - Perf: Improve mass crafting; check last recipe used first
if (optional.isPresent()) {
RecipeHolder<CraftingRecipe> recipeholder = (RecipeHolder) optional.get();