geforkt von Mirrors/Paper
bag o' patches
Dieser Commit ist enthalten in:
Ursprung
2bfe9eca4d
Commit
88d7a4ed1d
@ -393,6 +393,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public static final Reference<ConfiguredStructure> RUINED_PORTAL_MOUNTAIN = create("ruined_portal_mountain");
|
||||
+ public static final Reference<ConfiguredStructure> RUINED_PORTAL_OCEAN = create("ruined_portal_ocean");
|
||||
+ public static final Reference<ConfiguredStructure> RUINED_PORTAL_NETHER = create("ruined_portal_nether");
|
||||
+ public static final Reference<ConfiguredStructure> ANCIENT_CITY = create("ancient_city");
|
||||
+
|
||||
+ private final NamespacedKey key;
|
||||
+ private final StructureType structureType;
|
||||
|
@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.packRepository.setSelected(dataPacks);
|
||||
this.worldData.setDataPackConfig(MinecraftServer.getSelectedPacks(this.packRepository));
|
||||
this.resources.managers.updateRegistryTags(this.registryAccess());
|
||||
+ io.papermc.paper.PaperRegistry.clearCaches(); // Paper
|
||||
+ io.papermc.paper.registry.PaperRegistry.clearCaches(); // Paper
|
||||
new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
|
||||
if (Thread.currentThread() != this.serverThread) return; // Paper
|
||||
//this.getPlayerList().saveAll(); // Paper - we don't need to do this
|
@ -15,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import io.papermc.paper.world.structure.ConfiguredStructure;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
+import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
import org.bukkit.Keyed;
|
||||
|
||||
public record RegistryKey<API extends Keyed, MINECRAFT>(Class<API> apiClass, ResourceKey<? extends Registry<MINECRAFT>> resourceKey) {
|
||||
+
|
||||
+ public static final RegistryKey<ConfiguredStructure, ConfiguredStructureFeature<?, ?>> CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY);
|
||||
+ public static final RegistryKey<ConfiguredStructure, Structure> CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registry.STRUCTURE_REGISTRY);
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java
|
||||
@ -35,8 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import io.papermc.paper.registry.RegistryKey;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
+import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
+import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.StructureType;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -55,52 +54,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ new ConfiguredStructureRegistry().register();
|
||||
+ }
|
||||
+
|
||||
+ static final class ConfiguredStructureRegistry extends PaperRegistry<ConfiguredStructure, ConfiguredStructureFeature<?, ?>> {
|
||||
+ static final class ConfiguredStructureRegistry extends PaperRegistry<ConfiguredStructure, Structure> {
|
||||
+
|
||||
+ private static final Supplier<Registry<StructureFeature<?>>> STRUCTURE_FEATURE_REGISTRY = registryFor(Registry.STRUCTURE_FEATURE_REGISTRY);
|
||||
+ private static final Supplier<Registry<Structure>> STRUCTURE_FEATURE_REGISTRY = registryFor(Registry.STRUCTURE_REGISTRY);
|
||||
+
|
||||
+ public ConfiguredStructureRegistry() {
|
||||
+ super(RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ConfiguredStructure convertToApi(NamespacedKey key, ConfiguredStructureFeature<?, ?> nms) {
|
||||
+ final ResourceLocation structureFeatureLoc = Objects.requireNonNull(STRUCTURE_FEATURE_REGISTRY.get().getKey(nms.feature));
|
||||
+ final StructureType structureType = Objects.requireNonNull(StructureType.getStructureTypes().get(structureFeatureLoc.getPath()), structureFeatureLoc + " could not be converted to an API type");
|
||||
+ public ConfiguredStructure convertToApi(NamespacedKey key, Structure nms) {
|
||||
+ final ResourceLocation structureTypeLoc = Objects.requireNonNull(Registry.STRUCTURE_TYPES.getKey(nms.type()), "unexpected structure type " + nms.type());
|
||||
+ final StructureType structureType = Objects.requireNonNull(StructureType.getStructureTypes().get(structureTypeLoc.getPath()), structureTypeLoc + " could not be converted to an API type"); // TODO this is just not gonna work until upstream fixes their StructureType pseudo-enum
|
||||
+ return new ConfiguredStructure(key, structureType);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.packRepository.setSelected(dataPacks);
|
||||
this.worldData.setDataPackConfig(MinecraftServer.getSelectedPacks(this.packRepository));
|
||||
this.resources.managers.updateRegistryTags(this.registryAccess());
|
||||
- io.papermc.paper.PaperRegistry.clearCaches(); // Paper
|
||||
+ io.papermc.paper.registry.PaperRegistry.clearCaches(); // Paper
|
||||
new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
|
||||
if (Thread.currentThread() != this.serverThread) return; // Paper
|
||||
//this.getPlayerList().saveAll(); // Paper - we don't need to do this
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/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 {
|
||||
|
||||
@Nullable
|
||||
public Pair<BlockPos, Holder<ConfiguredStructureFeature<?, ?>>> findNearestMapFeature(ServerLevel worldserver, HolderSet<ConfiguredStructureFeature<?, ?>> holderset, BlockPos center, int radius, boolean skipExistingChunks) {
|
||||
public Pair<BlockPos, Holder<Structure>> findNearestMapStructure(ServerLevel world, HolderSet<Structure> structures, BlockPos center, int radius, boolean skipReferencedStructures) {
|
||||
+ // Paper start - StructureLocateEvent
|
||||
+ final org.bukkit.World world = worldserver.getWorld();
|
||||
+ final org.bukkit.Location origin = net.minecraft.server.MCUtil.toLocation(worldserver, center);
|
||||
+ final org.bukkit.World bukkitWorld = world.getWorld();
|
||||
+ final org.bukkit.Location origin = net.minecraft.server.MCUtil.toLocation(world, center);
|
||||
+ final var paperRegistry = io.papermc.paper.registry.PaperRegistry.getRegistry(io.papermc.paper.registry.RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
|
||||
+ final List<io.papermc.paper.world.structure.ConfiguredStructure> configuredStructures = new ArrayList<>();
|
||||
+ for (Holder<net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature<?, ?>> holder : holderset) {
|
||||
+ for (Holder<Structure> holder : structures) {
|
||||
+ configuredStructures.add(paperRegistry.convertToApi(holder));
|
||||
+ }
|
||||
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(world, origin, configuredStructures, radius, skipExistingChunks);
|
||||
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, configuredStructures, radius, skipReferencedStructures);
|
||||
+ if (!event.callEvent()) {
|
||||
+ return null;
|
||||
+ }
|
||||
@ -109,24 +95,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ center = net.minecraft.server.MCUtil.toBlockPosition(event.getOrigin());
|
||||
+ radius = event.getRadius();
|
||||
+ skipExistingChunks = event.shouldFindUnexplored();
|
||||
+ holderset = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
|
||||
+ skipReferencedStructures = event.shouldFindUnexplored();
|
||||
+ structures = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
|
||||
+ // Paper end
|
||||
Set<Holder<Biome>> set = (Set) holderset.stream().flatMap((holder) -> {
|
||||
return ((ConfiguredStructureFeature) holder.value()).biomes().stream();
|
||||
}).collect(Collectors.toSet());
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java
|
||||
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
|
||||
Iterator iterator = structures.iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java
|
||||
@@ -0,0 +0,0 @@ public class ConfiguredStructureFeature<FC extends FeatureConfiguration, F exten
|
||||
public final HolderSet<Biome> biomes;
|
||||
public final Map<MobCategory, StructureSpawnOverride> spawnOverrides;
|
||||
public final boolean adaptNoise;
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Structure {
|
||||
public static final Codec<Structure> DIRECT_CODEC = Registry.STRUCTURE_TYPES.byNameCodec().dispatch(Structure::type, StructureType::codec);
|
||||
public static final Codec<Holder<Structure>> CODEC = RegistryFileCodec.create(Registry.STRUCTURE_REGISTRY, DIRECT_CODEC);
|
||||
protected final Structure.StructureSettings settings;
|
||||
+ static { io.papermc.paper.world.structure.PaperConfiguredStructure.init(); } // Paper
|
||||
|
||||
public ConfiguredStructureFeature(F feature, FC config, HolderSet<Biome> biomes, boolean bl, Map<MobCategory, StructureSpawnOverride> map) {
|
||||
this.feature = feature;
|
||||
public static <S extends Structure> RecordCodecBuilder<S, Structure.StructureSettings> settingsCodec(RecordCodecBuilder.Instance<S> instance) {
|
||||
return Structure.StructureSettings.CODEC.forGetter((feature) -> {
|
||||
diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
@ -140,7 +126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.Bootstrap;
|
||||
+import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
+import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
+import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@ -186,11 +172,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Test
|
||||
+ public void testMinecraftToApi() {
|
||||
+ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.size());
|
||||
+ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), BuiltinRegistries.STRUCTURES.size());
|
||||
+
|
||||
+ Map<ResourceLocation, ConfiguredStructureFeature<?, ?>> missing = new LinkedHashMap<>();
|
||||
+ for (ConfiguredStructureFeature<?, ?> feature : BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE) {
|
||||
+ final ResourceLocation key = BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.getKey(feature);
|
||||
+ Map<ResourceLocation, Structure> missing = new LinkedHashMap<>();
|
||||
+ for (Structure feature : BuiltinRegistries.STRUCTURES) {
|
||||
+ final ResourceLocation key = BuiltinRegistries.STRUCTURES.getKey(feature);
|
||||
+ assertNotNull("Missing built-in registry key", key);
|
||||
+ if (DEFAULT_CONFIGURED_STRUCTURES.get(CraftNamespacedKey.fromMinecraft(key)) == null) {
|
||||
+ missing.put(key, feature);
|
||||
@ -203,11 +189,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Test
|
||||
+ public void testApiToMinecraft() {
|
||||
+ for (NamespacedKey apiKey : DEFAULT_CONFIGURED_STRUCTURES.keySet()) {
|
||||
+ assertTrue(apiKey + " does not have a minecraft counterpart", BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.containsKey(CraftNamespacedKey.toMinecraft(apiKey)));
|
||||
+ assertTrue(apiKey + " does not have a minecraft counterpart", BuiltinRegistries.STRUCTURES.containsKey(CraftNamespacedKey.toMinecraft(apiKey)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static String printMissing(Map<ResourceLocation, ConfiguredStructureFeature<?, ?>> missing) {
|
||||
+ private static String printMissing(Map<ResourceLocation, Structure> missing) {
|
||||
+ final StringJoiner joiner = new StringJoiner("\n", "Missing: \n", "");
|
||||
+
|
||||
+ missing.forEach((key, configuredFeature) -> {
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
public boolean isWhiteListed(GameProfile profile) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
@ -11,24 +11,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
||||
if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) {
|
||||
if (id >= 0 && id < this.selectablePatterns.size()) {
|
||||
- this.selectedBannerPatternIndex.set(id);
|
||||
- this.setupResultSlot((Holder) this.selectablePatterns.get(id));
|
||||
+ // Paper start
|
||||
+ int enumBannerPatternTypeOrdinal = id;
|
||||
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getHashname()));
|
||||
+ int selectablePatternIndex = id;
|
||||
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(this.selectablePatterns.get(selectablePatternIndex).value().getHashname()));
|
||||
+ if (!event.callEvent()) {
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (BannerPattern nms : BannerPattern.values()) {
|
||||
+ if (event.getPatternType().getIdentifier().equals(nms.getHashname())) {
|
||||
+ enumBannerPatternTypeOrdinal = nms.ordinal();
|
||||
+ Holder<BannerPattern> selectedPattern = null;
|
||||
+ for (int i = 0; i < this.selectablePatterns.size(); i++) {
|
||||
+ final Holder<BannerPattern> holder = this.selectablePatterns.get(i);
|
||||
+ if (event.getPatternType().getIdentifier().equals(holder.value().getHashname())) {
|
||||
+ selectablePatternIndex = i;
|
||||
+ selectedPattern = holder;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (selectedPattern == null) {
|
||||
+ for (BannerPattern pattern : Registry.BANNER_PATTERN) {
|
||||
+ if (event.getPatternType().getIdentifier().equals(pattern.getHashname())) {
|
||||
+ selectedPattern = Registry.BANNER_PATTERN.getHolder(Registry.BANNER_PATTERN.getId(pattern)).orElseThrow();
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ selectablePatternIndex = -1;
|
||||
+ }
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ this.selectedBannerPatternIndex.set(enumBannerPatternTypeOrdinal);
|
||||
+ this.selectedBannerPatternIndex.set(selectablePatternIndex);
|
||||
+ this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected"));
|
||||
+ // Paper end
|
||||
this.setupResultSlot();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> {
|
||||
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> {
|
||||
ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
|
||||
source.sendFailure(new TranslatableComponent("commands.reload.failure"));
|
||||
source.sendFailure(Component.translatable("commands.reload.failure"));
|
||||
return null;
|
||||
@@ -0,0 +0,0 @@ public class ReloadCommand {
|
||||
WorldData savedata = minecraftserver.getWorldData();
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- t0.setFromArgument(context, "value");
|
||||
+ t0.setFromArgument(context, "value", key); // Paper
|
||||
commandlistenerwrapper.sendSuccess(new TranslatableComponent("commands.gamerule.set", new Object[]{key.getId(), t0.toString()}), true);
|
||||
commandlistenerwrapper.sendSuccess(Component.translatable("commands.gamerule.set", key.getId(), t0.toString()), true);
|
||||
return t0.getCommandResult();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
40
patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch
Normale Datei
40
patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch
Normale Datei
@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 24 Jun 2020 15:14:51 -0600
|
||||
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
@@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu {
|
||||
public MobEffect getSecondaryEffect() {
|
||||
return MobEffect.byId(this.beaconData.get(2));
|
||||
}
|
||||
+ // Paper start
|
||||
+ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) {
|
||||
+ return effect.flatMap(net.minecraft.core.Registry.MOB_EFFECT::getResourceKey).map(key -> {
|
||||
+ return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()));
|
||||
+ }).orElse(null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
|
||||
if (this.paymentSlot.hasItem()) {
|
||||
- this.beaconData.set(1, (Integer) primary.map(MobEffect::getId).orElse(-1));
|
||||
- this.beaconData.set(2, (Integer) secondary.map(MobEffect::getId).orElse(-1));
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
|
||||
+ if (event.callEvent()) {
|
||||
+ this.beaconData.set(1, event.getPrimary() == null ? -1 : event.getPrimary().getId());
|
||||
+ this.beaconData.set(2, event.getSecondary() == null ? -1 : event.getSecondary().getId());
|
||||
+ if (event.willConsumeItem()) {
|
||||
+ // Paper end
|
||||
this.paymentSlot.remove(1);
|
||||
+ }
|
||||
this.access.execute(Level::blockEntityChanged);
|
||||
+ } // Paper end
|
||||
}
|
||||
|
||||
}
|
@ -28,11 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.populateDefaultEquipmentSlots(difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(difficulty);
|
||||
this.populateDefaultEquipmentSlots(randomsource, difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
|
||||
this.reassessWeaponGoal();
|
||||
- this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
|
||||
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
|
||||
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
@ -44,8 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
float f = difficulty.getSpecialMultiplier();
|
||||
|
||||
- this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * f);
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper
|
||||
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f);
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || randomsource.nextFloat() < 0.55F * f); // Paper
|
||||
if (object == null) {
|
||||
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(world.getRandom()), true);
|
||||
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
|
||||
}
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
this.recipeType = recipeType;
|
||||
this.recipeType = recipeType; // Paper
|
||||
}
|
||||
|
||||
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
|
||||
@ -23,9 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.COMPOSTER, 300);
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100);
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100);
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.MANGROVE_ROOTS, 300);
|
||||
- return map;
|
||||
+ // Paper start - cache burn durations
|
||||
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
|
@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager {
|
||||
private static class VindicatorBreakDoorGoal extends BreakDoorGoal {
|
||||
|
||||
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
|
||||
public VindicatorBreakDoorGoal(Mob mob) {
|
||||
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
|
||||
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.entitiesDifficultyBreakDoors.getOrDefault(mob.getType(), mob.level.paperConfig.entitiesDifficultyBreakDoors.get(EntityType.VINDICATOR)))); // Paper
|
@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
|
||||
MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);
|
||||
|
||||
this.player.sendMessage(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
|
||||
this.player.sendSystemMessage(ichatmutablecomponent, ChatType.GAME_INFO);
|
||||
- } else if (enuminteractionresult.shouldSwing()) {
|
||||
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) {
|
||||
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper
|
||||
this.player.swing(enumhand, true);
|
||||
}
|
||||
}
|
@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
@@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock {
|
||||
int i = tileentitydispenser.getRandomSlot();
|
||||
int i = tileentitydispenser.getRandomSlot(world.random);
|
||||
|
||||
if (i < 0) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here
|
||||
world.levelEvent(1001, pos, 0);
|
||||
world.gameEvent(GameEvent.DISPENSE_FAIL, pos);
|
||||
world.gameEvent((Entity) null, GameEvent.DISPENSE_FAIL, pos);
|
||||
+ } // Paper
|
||||
} else {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i);
|
||||
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
||||
@@ -0,0 +0,0 @@ public class DropperBlock extends DispenserBlock {
|
||||
int i = tileentitydispenser.getRandomSlot();
|
||||
int i = tileentitydispenser.getRandomSlot(world.random);
|
||||
|
||||
if (i < 0) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -0,0 +0,0 @@ public class ScheduleCommand {
|
||||
return new TranslatableComponent("commands.schedule.cleared.failure", new Object[]{object});
|
||||
return Component.translatable("commands.schedule.cleared.failure", object);
|
||||
});
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
|
||||
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
|
@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
});
|
||||
optional1.ifPresent((villageplacetype) -> {
|
||||
optional1.ifPresent((holder) -> {
|
||||
this.getServer().execute(() -> {
|
||||
+ // Paper start
|
||||
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
|
||||
+ this.getPoiManager().remove(blockposition1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.getPoiManager().add(blockposition1, villageplacetype);
|
||||
this.getPoiManager().add(blockposition1, holder);
|
||||
DebugPackets.sendPoiAddedPacket(this, blockposition1);
|
||||
});
|
@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 24 Jun 2020 15:14:51 -0600
|
||||
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
@@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu {
|
||||
|
||||
public void updateEffects(int primaryEffectId, int secondaryEffectId) {
|
||||
if (this.paymentSlot.hasItem()) {
|
||||
- this.beaconData.set(1, primaryEffectId);
|
||||
- this.beaconData.set(2, secondaryEffectId);
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), org.bukkit.potion.PotionEffectType.getById(primaryEffectId), org.bukkit.potion.PotionEffectType.getById(secondaryEffectId), this.access.getLocation().getBlock());
|
||||
+ if (event.callEvent()) {
|
||||
+ this.beaconData.set(1, event.getPrimary() == null ? 0 : event.getPrimary().getId());
|
||||
+ this.beaconData.set(2, event.getSecondary() == null ? 0 : event.getSecondary().getId());
|
||||
+ if (!event.willConsumeItem()) return;
|
||||
this.paymentSlot.remove(1);
|
||||
this.access.execute(Level::blockEntityChanged);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren