more patches
This commit is contained in:
parent
b2a63428c8
commit
09ead8b043
|
@ -83,3 +83,7 @@ c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block
|
|||
c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache
|
||||
m (Ljava/lang/String;)Lcom/mojang/authlib/GameProfile; getProfile get
|
||||
p 0 name
|
||||
|
||||
# change dimension in ServerPlayer TODO (not sure what's wrong here)
|
||||
#c net/minecraft/server/level/EntityPlayer net/minecraft/server/level/ServerPlayer
|
||||
# m (Lnet/minecraft/server/level/ServerLevel;Lorg/bukkit/event/player/PlayerTeleportEvent$TeleportCause)Lnet/minecraft/world/entity/Entity; b changeDimension
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7aa9fb852dce23c53fee80e97e0dcdb278ae82ba..68a03821a5f06308a9c51fdf107d3924c44886c8 100644
|
||||
index d281d270bba71da5a7d1326112e73d9cdb1ed57b..9c7960f56733ff18b949cffe15f082c4cde28317 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1929,6 +1929,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1956,6 +1956,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Nullable
|
||||
Firework boostElytra(@NotNull ItemStack firework);
|
|
@ -8,6 +8,8 @@ to a chunk. The default values of -1 disable the limit. Although
|
|||
defaults are only included for certain entites, this allows setting
|
||||
limits for any entity type.
|
||||
|
||||
1.17: entities not in chunks anymore
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7ebc85264a2cbfb601dfe5472b561cac1a7cf8bf..486e5438254348db68017228af131cba7defd637 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@ -1,34 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Mon, 11 Jan 2021 12:43:51 -0800
|
||||
Subject: [PATCH] Fix villager boat exploit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7e07fd0c8dec9f9cdeda65dfa0ccf42b4dde010e..9d1116f601b79dabf7a0d9e5ecf5c2a0306f9aa4 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -78,6 +78,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
+import net.minecraft.world.entity.npc.AbstractVillager;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.GameType;
|
||||
@@ -617,6 +618,15 @@ public abstract class PlayerList {
|
||||
|
||||
for (Iterator iterator = entity.getIndirectPassengers().iterator(); iterator.hasNext(); entity1.removed = true) {
|
||||
entity1 = (Entity) iterator.next();
|
||||
+ // Paper start
|
||||
+ if (entity1 instanceof AbstractVillager) {
|
||||
+ final AbstractVillager villager = (AbstractVillager) entity1;
|
||||
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
|
||||
+ if (human != null) {
|
||||
+ villager.setTradingPlayer(null);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
worldserver.despawn(entity1);
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 4 Jan 2021 19:52:44 -0800
|
||||
Subject: [PATCH] Make schedule command per-world
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
index 122a790285734ecd95fe6817043a84cf1752dbe8..173ab97b01b2191d9d731a28f2690eb4f539880b 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -32,7 +32,7 @@ public class ScheduleCommand {
|
||||
return new TranslatableComponent("commands.schedule.cleared.failure", new Object[]{object});
|
||||
});
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
|
||||
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
|
||||
+ return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getLevel().worldDataServer.overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper
|
||||
};
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
@@ -55,7 +55,7 @@ public class ScheduleCommand {
|
||||
} else {
|
||||
long j = source.getLevel().getGameTime() + (long) i;
|
||||
ResourceLocation minecraftkey = (ResourceLocation) pair.getFirst();
|
||||
- TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getServer().getWorldData().overworldData().getScheduledEvents();
|
||||
+ TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getLevel().worldDataServer.overworldData().getScheduledEvents(); // Paper
|
||||
|
||||
((Either) pair.getSecond()).ifLeft((customfunction) -> {
|
||||
String s = minecraftkey.toString();
|
||||
@@ -81,7 +81,7 @@ public class ScheduleCommand {
|
||||
}
|
||||
|
||||
private static int remove(CommandSourceStack commandlistenerwrapper, String s) throws CommandSyntaxException {
|
||||
- int i = commandlistenerwrapper.getServer().getWorldData().overworldData().getScheduledEvents().remove(s);
|
||||
+ int i = commandlistenerwrapper.getLevel().worldDataServer.overworldData().getScheduledEvents().remove(s); // Paper
|
||||
|
||||
if (i == 0) {
|
||||
throw ScheduleCommand.ERROR_CANT_REMOVE.create(s);
|
|
@ -1,42 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Sun, 17 Jan 2021 13:16:09 +1000
|
||||
Subject: [PATCH] Implement BlockPreDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
index 2a4cb76bdfcf55ba222b4976359c1b8efb165009..08ce586f8d024b57a20031868ca2a3058bc500ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
@@ -88,6 +88,7 @@ public class DispenserBlock extends BaseEntityBlock {
|
||||
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
|
||||
if (idispensebehavior != DispenseItemBehavior.NOOP) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(worldserver, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here
|
||||
eventFired = false; // CraftBukkit - reset event status
|
||||
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 586d21eed8189adf696ca6d3642afebbe752d1b5..34c0216baa69206aca51821aec421484b18cb04c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -59,6 +59,7 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+import io.papermc.paper.event.block.BlockPreDispenseEvent; // Paper
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location; // Paper
|
||||
import org.bukkit.Material;
|
||||
@@ -1802,5 +1803,11 @@ public class CraftEventFactory {
|
||||
BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block);
|
||||
return event.callEvent();
|
||||
}
|
||||
+
|
||||
+ public static boolean handleBlockPreDispenseEvent(ServerLevel worldserver, BlockPos blockposition, ItemStack itemStack, int slot) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ BlockPreDispenseEvent event = new BlockPreDispenseEvent(block, org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), slot);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 27 Nov 2020 17:14:27 -0800
|
||||
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
|
||||
|
||||
Co-Authored-By: MiniDigger <admin@minidigger.me>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index d2f762371f82d54bcec8b1a0a02d0866e55fd174..b5eeb2749237d589eafdfbea073bfe90e609600b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractContainerMenu {
|
||||
return slot;
|
||||
}
|
||||
|
||||
- protected DataSlot addDataSlot(DataSlot containerproperty) {
|
||||
+ protected DataSlot addDataSlot(DataSlot containerproperty) { return addDataSlot(containerproperty); } protected DataSlot addDataSlot(DataSlot containerproperty) { // Paper - OBFHELPER
|
||||
this.dataSlots.add(containerproperty);
|
||||
return containerproperty;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/DataSlot.java b/src/main/java/net/minecraft/world/inventory/DataSlot.java
|
||||
index 56d99e39f8cfe46a780bd17a0f99c3cbbe01c719..e851d6c8e5ad58091a58d489a48cd3ec379ce0da 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/DataSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/DataSlot.java
|
||||
@@ -20,7 +20,7 @@ public abstract class DataSlot {
|
||||
};
|
||||
}
|
||||
|
||||
- public static DataSlot shared(final int[] array, final int index) {
|
||||
+ public static DataSlot shared(final int[] aint, final int i) { return shared(aint, i); } public static DataSlot shared(final int[] array, final int index) { // Paper - OBFHELPER
|
||||
return new DataSlot() {
|
||||
@Override
|
||||
public int get() {
|
||||
@@ -54,7 +54,7 @@ public abstract class DataSlot {
|
||||
|
||||
public abstract void set(int value);
|
||||
|
||||
- public boolean checkAndClearUpdateFlag() {
|
||||
+ public boolean checkAndClearUpdateFlag() { return checkAndClearUpdateFlag(); } public boolean checkAndClearUpdateFlag() { // Paper - OBFHELPER
|
||||
int i = this.get();
|
||||
boolean flag = i != this.prevValue;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index 072bac443e7c54ac2b92e1d93b757bdacf230fbb..beb02f953719170d1668ada1c09d073d84bb7baf 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -21,13 +21,14 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
import org.bukkit.entity.Player;
|
||||
// CraftBukkit end
|
||||
+import io.papermc.paper.event.player.PlayerStonecutterRecipeSelectEvent; // Paper
|
||||
|
||||
public class StonecutterMenu extends AbstractContainerMenu {
|
||||
|
||||
private final ContainerLevelAccess access;
|
||||
private final DataSlot selectedRecipeIndex;
|
||||
private final Level level;
|
||||
- private List<StonecutterRecipe> recipes;
|
||||
+ private List<StonecutterRecipe> recipes; public final List<StonecutterRecipe> getRecipes() { return this.recipes; } // Paper - OBFHELPER
|
||||
private ItemStack input;
|
||||
private long lastSoundTime;
|
||||
final Slot inputSlot;
|
||||
@@ -57,7 +58,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
|
||||
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
|
||||
super(MenuType.STONECUTTER, syncId);
|
||||
- this.selectedRecipeIndex = DataSlot.standalone();
|
||||
+ this.selectedRecipeIndex = addDataSlot(DataSlot.shared(new int[1], 0)); // Paper - allow replication
|
||||
this.recipes = Lists.newArrayList();
|
||||
this.input = ItemStack.EMPTY;
|
||||
this.slotUpdateListener = () -> {
|
||||
@@ -135,13 +136,36 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
||||
if (this.isValidRecipeIndex(id)) {
|
||||
- this.selectedRecipeIndex.set(id);
|
||||
+ // Paper start
|
||||
+ int recipeIndex = id;
|
||||
+ this.selectedRecipeIndex.set(recipeIndex);
|
||||
+ this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed
|
||||
+ if (this.isValidRecipeIndex(id)) {
|
||||
+ PlayerStonecutterRecipeSelectEvent event = new PlayerStonecutterRecipeSelectEvent((Player) player.getBukkitEntity(), (org.bukkit.inventory.StonecutterInventory) getBukkitView().getTopInventory(), (org.bukkit.inventory.StonecuttingRecipe) this.getRecipes().get(id).toBukkitRecipe());
|
||||
+ if (!event.callEvent()) {
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ return false;
|
||||
+ }
|
||||
+ int newRecipeIndex;
|
||||
+ if (!this.getRecipes().get(recipeIndex).getId().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getStonecuttingRecipe().getKey()))) { // If the recipe did NOT stay the same
|
||||
+ for (newRecipeIndex = 0; newRecipeIndex < this.getRecipes().size(); newRecipeIndex++) {
|
||||
+ if (this.getRecipes().get(newRecipeIndex).getId().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getStonecuttingRecipe().getKey()))) {
|
||||
+ recipeIndex = newRecipeIndex;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it
|
||||
+ // Paper end
|
||||
this.setupResultSlot();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+ private boolean isValidRecipeIndex(int index) { return this.isValidRecipeIndex(index); } // Paper - OBFHELPER
|
||||
private boolean isValidRecipeIndex(int i) {
|
||||
return i >= 0 && i < this.recipes.size();
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Mon, 25 Jan 2021 14:53:57 +0100
|
||||
Subject: [PATCH] add DragonEggFormEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index e2f784b771b12bd646d519938c33b1c86cc2686d..f32e2c71929a73258e4eb521c160c247690744d2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -57,6 +57,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfigur
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import io.papermc.paper.event.block.DragonEggFormEvent; // Paper - DragonEggFormEvent
|
||||
|
||||
public class EndDragonFight {
|
||||
|
||||
@@ -396,9 +397,24 @@ public class EndDragonFight {
|
||||
this.dragonEvent.setVisible(false);
|
||||
this.spawnExitPortal(true);
|
||||
this.spawnNewGateway();
|
||||
+ // Paper start - DragonEggFormEvent
|
||||
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getPosition());
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition);
|
||||
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = new org.bukkit.craftbukkit.block.CraftBlockState(eggBlock);
|
||||
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
|
||||
+ DragonEggFormEvent eggEvent = new DragonEggFormEvent(eggBlock, eggState,
|
||||
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
|
||||
+ // Paper end - DragonEggFormEvent
|
||||
if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
|
||||
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
|
||||
+ // Paper start - DragonEggFormEvent
|
||||
+ //this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData());
|
||||
+ } else {
|
||||
+ eggEvent.setCancelled(true);
|
||||
+ }
|
||||
+ if (eggEvent.callEvent()) {
|
||||
+ eggEvent.getNewState().update(true);
|
||||
}
|
||||
+ // Paper end - DragonEggFormEvent
|
||||
|
||||
this.previouslyKilled = true;
|
||||
this.dragonKilled = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
|
||||
index cd24e9db1e9a490117716d4883376bb6b59c7c67..e085607f4033476e80b7dcd7b026449c12a47cf6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
||||
|
||||
public class EndPodiumFeature extends Feature<NoneFeatureConfiguration> {
|
||||
|
||||
- public static final BlockPos END_PODIUM_LOCATION = BlockPos.ZERO;
|
||||
+ public static final BlockPos END_PODIUM_LOCATION = BlockPos.ZERO; public static BlockPos getPosition() { return END_PODIUM_LOCATION; } // Paper - OBFHELPER
|
||||
private final boolean active;
|
||||
|
||||
public EndPodiumFeature(boolean open) {
|
||||
@@ -22,43 +22,43 @@ public class EndPodiumFeature extends Feature<NoneFeatureConfiguration> {
|
||||
this.active = open;
|
||||
}
|
||||
|
||||
- public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
- Iterator iterator = BlockPos.betweenClosed(new BlockPos(pos.getX() - 4, pos.getY() - 1, pos.getZ() - 4), new BlockPos(pos.getX() + 4, pos.getY() + 32, pos.getZ() + 4)).iterator();
|
||||
+ public boolean generate(WorldGenLevel generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPos blockposition, NoneFeatureConfiguration worldgenfeatureemptyconfiguration) { // Paper - decompile fix
|
||||
+ Iterator iterator = BlockPos.betweenClosed(new BlockPos(blockposition.getX() - 4, blockposition.getY() - 1, blockposition.getZ() - 4), new BlockPos(blockposition.getX() + 4, blockposition.getY() + 32, blockposition.getZ() + 4)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos blockposition1 = (BlockPos) iterator.next();
|
||||
- boolean flag = blockposition1.closerThan((Vec3i) pos, 2.5D);
|
||||
+ boolean flag = blockposition1.closerThan((Vec3i) blockposition, 2.5D);
|
||||
|
||||
- if (flag || blockposition1.closerThan((Vec3i) pos, 3.5D)) {
|
||||
- if (blockposition1.getY() < pos.getY()) {
|
||||
+ if (flag || blockposition1.closerThan((Vec3i) blockposition, 3.5D)) {
|
||||
+ if (blockposition1.getY() < blockposition.getY()) {
|
||||
if (flag) {
|
||||
- this.setBlock(world, blockposition1, Blocks.BEDROCK.defaultBlockState());
|
||||
- } else if (blockposition1.getY() < pos.getY()) {
|
||||
- this.setBlock(world, blockposition1, Blocks.END_STONE.defaultBlockState());
|
||||
+ this.setBlock(generatoraccessseed, blockposition1, Blocks.BEDROCK.defaultBlockState());
|
||||
+ } else if (blockposition1.getY() < blockposition.getY()) {
|
||||
+ this.setBlock(generatoraccessseed, blockposition1, Blocks.END_STONE.defaultBlockState());
|
||||
}
|
||||
- } else if (blockposition1.getY() > pos.getY()) {
|
||||
- this.setBlock(world, blockposition1, Blocks.AIR.defaultBlockState());
|
||||
+ } else if (blockposition1.getY() > blockposition.getY()) {
|
||||
+ this.setBlock(generatoraccessseed, blockposition1, Blocks.AIR.defaultBlockState());
|
||||
} else if (!flag) {
|
||||
- this.setBlock(world, blockposition1, Blocks.BEDROCK.defaultBlockState());
|
||||
+ this.setBlock(generatoraccessseed, blockposition1, Blocks.BEDROCK.defaultBlockState());
|
||||
} else if (this.active) {
|
||||
- this.setBlock(world, new BlockPos(blockposition1), Blocks.END_PORTAL.defaultBlockState());
|
||||
+ this.setBlock(generatoraccessseed, new BlockPos(blockposition1), Blocks.END_PORTAL.defaultBlockState());
|
||||
} else {
|
||||
- this.setBlock(world, new BlockPos(blockposition1), Blocks.AIR.defaultBlockState());
|
||||
+ this.setBlock(generatoraccessseed, new BlockPos(blockposition1), Blocks.AIR.defaultBlockState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
- this.setBlock(world, pos.above(i), Blocks.BEDROCK.defaultBlockState());
|
||||
+ this.setBlock(generatoraccessseed, blockposition.above(i), Blocks.BEDROCK.defaultBlockState());
|
||||
}
|
||||
|
||||
- BlockPos blockposition2 = pos.above(2);
|
||||
+ BlockPos blockposition2 = blockposition.above(2);
|
||||
Iterator iterator1 = Direction.Plane.HORIZONTAL.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
Direction enumdirection = (Direction) iterator1.next();
|
||||
|
||||
- this.setBlock(world, blockposition2.relative(enumdirection), (BlockState) Blocks.WALL_TORCH.defaultBlockState().setValue(WallTorchBlock.FACING, enumdirection));
|
||||
+ this.setBlock(generatoraccessseed, blockposition2.relative(enumdirection), (BlockState) Blocks.WALL_TORCH.defaultBlockState().setValue(WallTorchBlock.FACING, enumdirection));
|
||||
}
|
||||
|
||||
return true;
|
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Mon, 11 Jan 2021 12:43:51 -0800
|
||||
Subject: [PATCH] Fix villager boat exploit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index ce6d9b460f0f55fc6d5544d5c8d2b78e5fcc3937..9a37a962b141e9faecc9f6f4906a9d727d20c20a 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -613,6 +613,15 @@ public abstract class PlayerList {
|
||||
PlayerList.LOGGER.debug("Removing player mount");
|
||||
entityplayer.stopRiding();
|
||||
entity.getPassengersAndSelf().forEach((entity1) -> {
|
||||
+ // Paper start
|
||||
+ if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager) {
|
||||
+ final net.minecraft.world.entity.npc.AbstractVillager villager = (net.minecraft.world.entity.npc.AbstractVillager) entity1;
|
||||
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
|
||||
+ if (human != null) {
|
||||
+ villager.setTradingPlayer(null);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
});
|
||||
}
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 9d1116f601b79dabf7a0d9e5ecf5c2a0306f9aa4..c962b6fc0c65dc5e2ea636220727bca63bf4b740 100644
|
||||
index 9a37a962b141e9faecc9f6f4906a9d727d20c20a..d01712cad42c078a726d6f757a4d8f0e3f186274 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1134,22 +1134,29 @@ public abstract class PlayerList {
|
||||
@@ -1113,22 +1113,29 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
||||
|
@ -46,10 +46,10 @@ index 9d1116f601b79dabf7a0d9e5ecf5c2a0306f9aa4..c962b6fc0c65dc5e2ea636220727bca6
|
|||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 40380fff222cc1f3340cf6a6c4afbe60aaa5d3a6..d2d179cdef8129653983b01d94928ba83f64f644 100644
|
||||
index 9236027beb13ae4f2e35c46f6c176fd5d7d20b4f..a9fdf153a9442830c7ce9e8fb6147b2c7b33db55 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2296,6 +2296,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -548,6 +548,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
|
||||
: null;
|
||||
}
|
||||
|
@ -62,4 +62,4 @@ index 40380fff222cc1f3340cf6a6c4afbe60aaa5d3a6..d2d179cdef8129653983b01d94928ba8
|
|||
+ }
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
||||
@Override
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add StructureLocateEvent
|
|||
|
||||
|
||||
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 860af116dbc7dd9d691ff27d28a2d10dbec83df4..29310d96eb562ead1e568a97b6f3019e43ca0a88 100644
|
||||
index 6a93d3b3798b15fd75ca797665b442dcc634b89a..c2b0b1adcff5baf169901710d492317d44b93846 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.chunk;
|
||||
|
@ -16,7 +16,7 @@ index 860af116dbc7dd9d691ff27d28a2d10dbec83df4..29310d96eb562ead1e568a97b6f3019e
|
|||
import java.util.BitSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -160,6 +161,22 @@ public abstract class ChunkGenerator {
|
||||
@@ -185,6 +186,22 @@ public abstract class ChunkGenerator {
|
||||
|
||||
@Nullable
|
||||
public BlockPos findNearestMapFeature(ServerLevel world, StructureFeature<?> feature, BlockPos center, int radius, boolean skipExistingChunks) {
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Collision option for requiring a player participant
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 486e5438254348db68017228af131cba7defd637..3dd228ae8071a747f2cd7b2b46a2215183f72cd0 100644
|
||||
index dd5c092a035a30c477fe828b58bc918fc48daa03..16b80fe4c55c51d3afaefba7eef97d1e3e4a3248 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -717,6 +717,18 @@ public class PaperWorldConfig {
|
||||
@@ -67,6 +67,18 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@ index 486e5438254348db68017228af131cba7defd637..3dd228ae8071a747f2cd7b2b46a22151
|
|||
public int wanderingTraderSpawnDayTicks = 24000;
|
||||
public int wanderingTraderSpawnChanceFailureIncrement = 25;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index ec98f5f59ca2b4cb58eb00ed8cdfa364f8bacd88..87c719caf796f54296ff7e412548062e02af270e 100644
|
||||
index fec2a44c4a110407d33002a955fe5dacbccc840c..9023cee63d77886683840f8d5650a8e07426b4c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1465,6 +1465,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
@@ -1587,6 +1587,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
public void push(Entity entity) {
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
|
@ -40,7 +40,7 @@ index ec98f5f59ca2b4cb58eb00ed8cdfa364f8bacd88..87c719caf796f54296ff7e412548062e
|
|||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = Mth.absMax(d0, d1);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
index 9cbde70787d8044f0edeb3d459231dd7fbb79584..25df3ef6b96bec39847a732394af8eccdb4d5d45 100644
|
||||
index 9653b142c199c068e4d6175bcd3cbecb6465853f..309bafd257d4932cfd69c2c212b32306938cd234 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
|
@ -51,7 +51,7 @@ index 9cbde70787d8044f0edeb3d459231dd7fbb79584..25df3ef6b96bec39847a732394af8ecc
|
|||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -766,6 +767,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||
@@ -833,6 +834,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||
public void push(Entity entity) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
|
@ -60,10 +60,10 @@ index 9cbde70787d8044f0edeb3d459231dd7fbb79584..25df3ef6b96bec39847a732394af8ecc
|
|||
// CraftBukkit start
|
||||
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index 6a9c18540886979b2212bf7917a21753c9a9db3c..e7ac3bff190c899397d6576fabbf4966878ea7e5 100644
|
||||
index a1b93f2878e22fa1d0cad639416d2dc5b8339c73..aa7c022c4faade23bd9061311d4152cf845d3331 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket;
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
|
@ -71,7 +71,7 @@ index 6a9c18540886979b2212bf7917a21753c9a9db3c..e7ac3bff190c899397d6576fabbf4966
|
|||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
@@ -229,6 +230,7 @@ public class Boat extends Entity {
|
||||
@@ -240,6 +241,7 @@ public class Boat extends Entity {
|
||||
|
||||
@Override
|
||||
public void push(Entity entity) {
|
|
@ -7,13 +7,13 @@ The duplicate ProjectileHitEvent in EntityFireball was removed. The
|
|||
event was always called before the duplicate call.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
index 872ff430547276e2a41a48aa07ae63b87ab39e5d..cba1b361162456cf297d88439f76586a2f61fc45 100644
|
||||
index dd5209ab2e5b59312349e709392689f25da162c0..3a088afd8269606543ebc9fb2074eb70431fcd39 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
@@ -86,7 +86,7 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
@@ -97,7 +97,7 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
if (this.removed) {
|
||||
if (this.isRemoved()) {
|
||||
- CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ // CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Paper - this is an undesired duplicate event
|
||||
}
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Return chat component with empty text instead of throwing
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index b5d79635cd8b0eb6b17962450b347010aeb52654..d2f762371f82d54bcec8b1a0a02d0866e55fd174 100644
|
||||
index 766c907f92ca8cb19b22cd19185cc92603aeca03..311ace44ba65d6dd24941b56e78e148134ceb6f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.ReportedException;
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.ReportedException;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -17,7 +17,7 @@ index b5d79635cd8b0eb6b17962450b347010aeb52654..d2f762371f82d54bcec8b1a0a02d0866
|
|||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -60,7 +61,12 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -82,7 +83,12 @@ public abstract class AbstractContainerMenu {
|
||||
}
|
||||
private Component title;
|
||||
public final Component getTitle() {
|
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 4 Jan 2021 19:52:44 -0800
|
||||
Subject: [PATCH] Make schedule command per-world
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
index 018923e519544561747240618bce5df60475cdc6..7f5d249502e9b2fb9e5811cfeb43122b47f7b111 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -29,7 +29,7 @@ public class ScheduleCommand {
|
||||
return new TranslatableComponent("commands.schedule.cleared.failure", eventName);
|
||||
});
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (context, builder) -> {
|
||||
- return SharedSuggestionProvider.suggest(context.getSource().getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), builder);
|
||||
+ return SharedSuggestionProvider.suggest(context.getSource().getLevel().serverLevelData.overworldData().getScheduledEvents().getEventsIds(), builder); // Paper
|
||||
};
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
@@ -52,7 +52,7 @@ public class ScheduleCommand {
|
||||
} else {
|
||||
long l = source.getLevel().getGameTime() + (long)time;
|
||||
ResourceLocation resourceLocation = function.getFirst();
|
||||
- TimerQueue<MinecraftServer> timerQueue = source.getServer().getWorldData().overworldData().getScheduledEvents();
|
||||
+ TimerQueue<MinecraftServer> timerQueue = source.getLevel().serverLevelData.getScheduledEvents(); // Paper
|
||||
function.getSecond().ifLeft((functionx) -> {
|
||||
String string = resourceLocation.toString();
|
||||
if (replace) {
|
||||
@@ -75,7 +75,7 @@ public class ScheduleCommand {
|
||||
}
|
||||
|
||||
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
|
||||
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName);
|
||||
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper
|
||||
if (i == 0) {
|
||||
throw ERROR_CANT_REMOVE.create(eventName);
|
||||
} else {
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max leash distance
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 3dd228ae8071a747f2cd7b2b46a2215183f72cd0..c4ca7ed5b251a2a3d64297351ef32541a4243c35 100644
|
||||
index 16b80fe4c55c51d3afaefba7eef97d1e3e4a3248..4ceb6b048889c62edb69c88422abddd1aee0bcf7 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -166,6 +166,12 @@ public class PaperWorldConfig {
|
||||
@@ -266,6 +266,12 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Sun, 17 Jan 2021 13:16:09 +1000
|
||||
Subject: [PATCH] Implement BlockPreDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
index 501a5483160dba050261bb3448317a097cdb7ef2..2dcac4b638073aa1748f26f61219dbf95fd1ced6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
@@ -91,6 +91,7 @@ public class DispenserBlock extends BaseEntityBlock {
|
||||
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
|
||||
if (idispensebehavior != DispenseItemBehavior.NOOP) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here
|
||||
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
|
||||
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index f6f2856c407abe195f1dfee7f4a7e30baea585f7..ea7082ab595f7bce572eec66ce7790a0afa8dae1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1809,5 +1809,11 @@ public class CraftEventFactory {
|
||||
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
|
||||
return event.callEvent();
|
||||
}
|
||||
+
|
||||
+ public static boolean handleBlockPreDispenseEvent(ServerLevel serverLevel, BlockPos pos, ItemStack itemStack, int slot) {
|
||||
+ org.bukkit.block.Block block = serverLevel.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ io.papermc.paper.event.block.BlockPreDispenseEvent event = new io.papermc.paper.event.block.BlockPreDispenseEvent(block, org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), slot);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Added Vanilla Entity Tags
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/CraftEntityTag.java b/src/main/java/io/papermc/paper/CraftEntityTag.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..687edf189871fc989174248dbf070bcba161f1a8
|
||||
index 0000000000000000000000000000000000000000..6271586368c65250c887739d04c5fccf95fdb2d8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/CraftEntityTag.java
|
||||
@@ -0,0 +1,28 @@
|
||||
|
@ -30,32 +30,32 @@ index 0000000000000000000000000000000000000000..687edf189871fc989174248dbf070bcb
|
|||
+
|
||||
+ @Override
|
||||
+ public boolean isTagged(EntityType item) {
|
||||
+ return getHandle().isTagged(CraftMagicNumbers.getEntityTypes(item));
|
||||
+ return getHandle().contains(CraftMagicNumbers.getEntityTypes(item));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Set<EntityType> getValues() {
|
||||
+ return Collections.unmodifiableSet(getHandle().getTagged().stream().map(CraftMagicNumbers::getEntityType).collect(Collectors.toSet()));
|
||||
+ return Collections.unmodifiableSet(getHandle().getValues().stream().map(CraftMagicNumbers::getEntityType).collect(Collectors.toSet()));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 046fbc646d2818bb2c7e08ff22093523e8246523..3d7cc98710bb925743e6fe8de1f154096334d46c 100644
|
||||
index ecae20bb39848cc0223df3c4804a68f4e0731e3b..726db110f27ce46b8ed9c78dad14542bba1622a8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2221,6 +2221,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2222,6 +2222,11 @@ public final class CraftServer implements Server {
|
||||
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
|
||||
|
||||
return (org.bukkit.Tag<T>) new CraftFluidTag(console.getTags().getFluids(), key);
|
||||
return (org.bukkit.Tag<T>) new CraftFluidTag(FluidTags.getAllTags(), key);
|
||||
+ // Paper start
|
||||
+ case org.bukkit.Tag.REGISTRY_ENTITIES:
|
||||
+ Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity namespace must have entitytype type");
|
||||
+ return (org.bukkit.Tag<T>) new io.papermc.paper.CraftEntityTag(console.getTags().getEntityTypes(), key);
|
||||
+ return (org.bukkit.Tag<T>) new io.papermc.paper.CraftEntityTag(net.minecraft.tags.EntityTypeTags.getAllTags(), key);
|
||||
+ // Paper end
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index ac94fd569bd4c79e30adef148e09e395ba8c1812..25a29d997f163ce2b11330d66a691601f514a9cb 100644
|
||||
index 3d5f9ac267943fe2487a5cc4f9f059b169b438a8..f70d7b1c9b10f59b4d9c8575b9cc35409fec11e4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -116,8 +116,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] added Wither API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 1f330d852eb9b3a36570542e10a88ae065798714..fd91c80cd6337b5fa41d6060ecdb44b8fa68a16a 100644
|
||||
index 03263689479d0f163fceb834bda07e7be13b798d..1e479853ec239b5e970b478adb3419e400d2f1d6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -80,6 +80,11 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
@@ -83,6 +83,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable();
|
||||
};
|
||||
private static final TargetingConditions TARGETING_CONDITIONS = (new TargetingConditions()).range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
|
||||
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
|
||||
+ // Paper start
|
||||
+ private boolean canPortal = false;
|
||||
+
|
||||
|
@ -20,15 +20,7 @@ index 1f330d852eb9b3a36570542e10a88ae065798714..fd91c80cd6337b5fa41d6060ecdb44b8
|
|||
|
||||
public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -578,6 +583,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
this.entityData.set((EntityDataAccessor) WitherBoss.DATA_TARGETS.get(headIndex), id);
|
||||
}
|
||||
|
||||
+ public final boolean isPowered() { return this.isPowered(); } // Paper - OBFHELPER
|
||||
public boolean isPowered() {
|
||||
return this.getHealth() <= this.getMaxHealth() / 2.0F;
|
||||
}
|
||||
@@ -594,7 +600,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
@@ -591,7 +596,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
@Override
|
||||
public boolean canChangeDimensions() {
|
||||
|
@ -38,12 +30,12 @@ index 1f330d852eb9b3a36570542e10a88ae065798714..fd91c80cd6337b5fa41d6060ecdb44b8
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
index fdcd680b972da54f9cdb41dff5563e42bd12d8e3..a09f46c586416b77dda40067fe1639a9250af3f0 100644
|
||||
index 640b0860fbe3412da32d03187e6f355ba8f099ea..299d5e47489cfe489ac130a33a08cdb29ba76d72 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -38,4 +38,31 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
|
||||
public BossBar getBossBar() {
|
||||
return bossBar;
|
||||
return this.bossBar;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
|
@ -5,33 +5,22 @@ 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 1371bfe4a4b5bb065de4d2118b2b32f4ee0b78d9..20069eeece4e03827ed4b3b4e2b713c43b23a366 100644
|
||||
index 4c76ef8ac18c538f97fd33cf5de47441c17b9181..91118c5d7d1414cacb80aad753c44c90f5812cf2 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
@@ -11,6 +11,10 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
+// Paper start
|
||||
+import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent;
|
||||
+// Paper end
|
||||
+
|
||||
public class BeaconMenu extends AbstractContainerMenu {
|
||||
|
||||
private final Container beacon;
|
||||
@@ -137,9 +141,15 @@ public class BeaconMenu extends AbstractContainerMenu {
|
||||
@@ -160,9 +160,15 @@ 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
|
||||
+ PlayerChangeBeaconEffectEvent event = new 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());
|
||||
+ 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.a(1);
|
||||
this.paymentSlot.remove(1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix console spam when removing chests in water
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
index 6b95cd2e2af66eef324dfcc8f7642da2f9e39d4e..d061548b5490f441b91a2dd90e7668a05f7f2112 100644
|
||||
index eecb8c089b5f426b1395b47f714af32c210555ef..d980a556785b52fe827310b83638139df0816b11 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -239,7 +239,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
@@ -248,7 +248,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
if (!state.is(newState.getBlock())) {
|
|
@ -5,12 +5,12 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index c4ca7ed5b251a2a3d64297351ef32541a4243c35..40939de88b1a8169dbfc7a0cd288c2fe9b706426 100644
|
||||
index 4ceb6b048889c62edb69c88422abddd1aee0bcf7..7738b5959f347cb369646852e7174aa580546400 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -795,4 +795,9 @@ public class PaperWorldConfig {
|
||||
if (value != -1) entityPerChunkSaveLimits.put(type, value);
|
||||
});
|
||||
@@ -683,5 +683,10 @@ public class PaperWorldConfig {
|
||||
private void perPlayerMobSpawns() {
|
||||
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false);
|
||||
}
|
||||
+
|
||||
+ public boolean enderDragonsDeathAlwaysPlacesDragonEgg = false;
|
||||
|
@ -18,11 +18,12 @@ index c4ca7ed5b251a2a3d64297351ef32541a4243c35..40939de88b1a8169dbfc7a0cd288c2fe
|
|||
+ enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
|
||||
+ }
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 84447e9845edad2d228b94184b35b4afb453a14b..e2f784b771b12bd646d519938c33b1c86cc2686d 100644
|
||||
index e1d689aa65b8d993c7223d306363366f3adff62f..f88719dede80c064f6210e078c435ffda32ecc1a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -396,7 +396,7 @@ public class EndDragonFight {
|
||||
@@ -363,7 +363,7 @@ public class EndDragonFight {
|
||||
this.dragonEvent.setVisible(false);
|
||||
this.spawnExitPortal(true);
|
||||
this.spawnNewGateway();
|
|
@ -0,0 +1,51 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 27 Nov 2020 17:14:27 -0800
|
||||
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
|
||||
|
||||
Co-Authored-By: MiniDigger <admin@minidigger.me>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index eac9765ecf0b33cab8b04204591de8d56c6f75c7..72d1d7722691ff411cb481ac8be6afba0c3b989c 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -62,7 +62,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
|
||||
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
|
||||
super(MenuType.STONECUTTER, syncId);
|
||||
- this.selectedRecipeIndex = DataSlot.standalone();
|
||||
+ this.selectedRecipeIndex = addDataSlot(DataSlot.shared(new int[1], 0)); // Paper - allow replication
|
||||
this.recipes = Lists.newArrayList();
|
||||
this.input = ItemStack.EMPTY;
|
||||
this.slotUpdateListener = () -> {
|
||||
@@ -156,7 +156,29 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
||||
if (this.isValidRecipeIndex(id)) {
|
||||
- this.selectedRecipeIndex.set(id);
|
||||
+ // Paper start
|
||||
+ int recipeIndex = id;
|
||||
+ this.selectedRecipeIndex.set(recipeIndex);
|
||||
+ this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed
|
||||
+ if (this.isValidRecipeIndex(id)) {
|
||||
+ io.papermc.paper.event.player.PlayerStonecutterRecipeSelectEvent event = new io.papermc.paper.event.player.PlayerStonecutterRecipeSelectEvent((Player) player.getBukkitEntity(), (org.bukkit.inventory.StonecutterInventory) getBukkitView().getTopInventory(), (org.bukkit.inventory.StonecuttingRecipe) this.getRecipes().get(id).toBukkitRecipe());
|
||||
+ if (!event.callEvent()) {
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ return false;
|
||||
+ }
|
||||
+ int newRecipeIndex;
|
||||
+ if (!this.getRecipes().get(recipeIndex).getId().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getStonecuttingRecipe().getKey()))) { // If the recipe did NOT stay the same
|
||||
+ for (newRecipeIndex = 0; newRecipeIndex < this.getRecipes().size(); newRecipeIndex++) {
|
||||
+ if (this.getRecipes().get(newRecipeIndex).getId().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getStonecuttingRecipe().getKey()))) {
|
||||
+ recipeIndex = newRecipeIndex;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it
|
||||
+ // Paper end
|
||||
this.setupResultSlot();
|
||||
}
|
||||
|
|
@ -5,36 +5,28 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 87dd6c012bf1ca6a1e8df44dc0957c4c67d02adc..ea34306858116e5626383af408529091836c2752 100644
|
||||
index c9324245d18f8268191c0a89b465ef3054dd014d..c25f80baea8857c35a3faaa82d80e2e358449a83 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -86,6 +86,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTransformEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+import org.bukkit.event.player.PlayerUnleashEntityEvent; // Paper
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class Mob extends LivingEntity {
|
||||
@@ -1205,12 +1206,15 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1208,12 +1208,15 @@ public abstract class Mob extends LivingEntity {
|
||||
return InteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == player) {
|
||||
// CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
- if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player).isCancelled()) {
|
||||
+ // Paper start - drop leash variable
|
||||
+ PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, !player.abilities.instabuild);
|
||||
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, !player.getAbilities().instabuild);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Paper end
|
||||
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder()));
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.dropLeash(true, !player.abilities.instabuild);
|
||||
- this.dropLeash(true, !player.getAbilities().instabuild);
|
||||
+ this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable
|
||||
return InteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else {
|
||||
InteractionResult enuminteractionresult = this.checkAndHandleImportantInteractions(player, hand);
|
||||
@@ -1364,8 +1368,11 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1371,8 +1374,11 @@ public abstract class Mob extends LivingEntity {
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
|
@ -48,7 +40,7 @@ index 87dd6c012bf1ca6a1e8df44dc0957c4c67d02adc..ea34306858116e5626383af408529091
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1433,8 +1440,11 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1435,8 +1441,11 @@ public abstract class Mob extends LivingEntity {
|
||||
boolean flag1 = super.startRiding(entity, force);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
|
@ -62,7 +54,7 @@ index 87dd6c012bf1ca6a1e8df44dc0957c4c67d02adc..ea34306858116e5626383af408529091
|
|||
}
|
||||
|
||||
return flag1;
|
||||
@@ -1636,7 +1646,10 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1606,8 +1615,11 @@ public abstract class Mob extends LivingEntity {
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
|
@ -73,8 +65,9 @@ index 87dd6c012bf1ca6a1e8df44dc0957c4c67d02adc..ea34306858116e5626383af408529091
|
|||
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
|
||||
+ this.dropLeash(true, event.isDropLeash());
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
this.getAllSlots().forEach((itemstack) -> {
|
||||
if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
index a884940cc576704951d42c6b0d00f5a319297c29..d16a7bab5495d58ea9e6811d4b507667cfa3d264 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
|
@ -108,40 +101,31 @@ index a884940cc576704951d42c6b0d00f5a319297c29..d16a7bab5495d58ea9e6811d4b507667
|
|||
} else if (f > 6.0F) {
|
||||
double d0 = (entity.getX() - this.getX()) / (double) f;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
|
||||
index 465548de7e32028a2aed4b6e9543e1bd9b73700b..1f54c020cc2b1928b2e7edda9ddf7b9d61e6424b 100644
|
||||
index b9b67134f02fd7484ed19905c9ae1f9b8a26ce26..c05f173b7642380900fdd77ce5d2c020468b5fc0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
|
||||
@@ -28,6 +28,8 @@ import net.minecraft.world.phys.AABB;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
// CraftBukkit end
|
||||
|
||||
+import org.bukkit.event.player.PlayerUnleashEntityEvent; // Paper
|
||||
+
|
||||
public class LeashFenceKnotEntity extends HangingEntity {
|
||||
|
||||
public LeashFenceKnotEntity(EntityType<? extends LeashFenceKnotEntity> type, Level world) {
|
||||
@@ -123,11 +125,14 @@ public class LeashFenceKnotEntity extends HangingEntity {
|
||||
@@ -123,11 +123,14 @@ public class LeashFenceKnotEntity extends HangingEntity {
|
||||
entityinsentient = (Mob) iterator.next();
|
||||
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
|
||||
// CraftBukkit start
|
||||
- if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, player).isCancelled()) {
|
||||
+ // Paper start - drop leash variable
|
||||
+ PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, player, !player.abilities.instabuild);
|
||||
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, player, !player.getAbilities().instabuild);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Paper end
|
||||
die = false;
|
||||
continue;
|
||||
}
|
||||
- entityinsentient.dropLeash(true, !player.abilities.instabuild); // false -> survival mode boolean
|
||||
- entityinsentient.dropLeash(true, !player.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ entityinsentient.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - drop leash variable
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 34c0216baa69206aca51821aec421484b18cb04c..ea7c30ef17fc66c1fb55d5909f94651c98b181be 100644
|
||||
index ea7082ab595f7bce572eec66ce7790a0afa8dae1..2b5f63c3f0ff3039fbef9afdfa46e0e715d347bc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1460,8 +1460,10 @@ public class CraftEventFactory {
|
||||
@@ -1466,8 +1466,10 @@ public class CraftEventFactory {
|
||||
return itemInHand;
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled.
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 7a615a18f1f297adfe7e046407a019d8933e9ed9..8e27559a12ada05e0530c7fe5b0bfbc4422ccbd6 100644
|
||||
index 7ab28e9bd3f785838b7fa4ac5811c0e71cddcb61..b609740fb95ccd4c9d7a2a95fad3dfbff630db5f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -825,7 +825,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -778,7 +778,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
// Paper start - per player mob spawning
|
||||
NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index ff831ca0cbc0cabbf78178c609ccf70d78da7980..314f168c9d17ab3654c9dda07e48839570f0d332 100644
|
||||
index 5a87875b03740053d8cde6d81c57703d0b0ef57e..f9cf0c088f4c3de0a1a7b92beb6ee0c57a0b1326 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1115,6 +1115,11 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
@@ -1117,6 +1117,11 @@ public class ServerPlayer extends Player {
|
||||
this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
// CraftBukkit end
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Mon, 25 Jan 2021 14:53:57 +0100
|
||||
Subject: [PATCH] add DragonEggFormEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index f88719dede80c064f6210e078c435ffda32ecc1a..93dd5a2d0b550b0373cbf59376a04e9fd6146e92 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -363,9 +363,24 @@ public class EndDragonFight {
|
||||
this.dragonEvent.setVisible(false);
|
||||
this.spawnExitPortal(true);
|
||||
this.spawnNewGateway();
|
||||
+ // Paper start - DragonEggFormEvent
|
||||
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition);
|
||||
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = new org.bukkit.craftbukkit.block.CraftBlockState(eggBlock);
|
||||
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
|
||||
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(eggBlock, eggState,
|
||||
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
|
||||
+ // Paper end - DragonEggFormEvent
|
||||
if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
|
||||
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
|
||||
+ // Paper start - DragonEggFormEvent
|
||||
+ //this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData());
|
||||
+ } else {
|
||||
+ eggEvent.setCancelled(true);
|
||||
+ }
|
||||
+ if (eggEvent.callEvent()) {
|
||||
+ eggEvent.getNewState().update(true);
|
||||
}
|
||||
+ // Paper end - DragonEggFormEvent
|
||||
|
||||
this.previouslyKilled = true;
|
||||
this.dragonKilled = true;
|
|
@ -5,59 +5,43 @@ Subject: [PATCH] EntityMoveEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 892ca65d258b0745be95d7ef4886c49899b24d92..bc44811f26076871848ba8f5c582ab26b1fd7170 100644
|
||||
index 51bbb11ff8d3da95fa6d9890be3135a34b3eafac..c8213692e658f6eb82d3bd843b9525ff6565cc81 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -13,6 +13,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||
+import io.papermc.paper.event.entity.EntityMoveEvent;
|
||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedWriter;
|
||||
@@ -1458,6 +1459,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1524,6 +1524,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
while (iterator.hasNext()) {
|
||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||
+ worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||
HopperBlockEntity.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
|
||||
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
|
||||
|
||||
this.profiler.push(() -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 9f1838d12b13d64f10871eb672ed2aec78d9936e..338b4c382fb8ea349ce81f2009e96de1df7ac5e2 100644
|
||||
index 0e14946284738b751790b2763bfe197c0148a54a..5cd1fe3506b1009de9fce64c3f4f44a29f13c359 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -207,6 +207,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
@@ -200,6 +200,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
public final LevelStorageSource.LevelStorageAccess convertable;
|
||||
public final UUID uuid;
|
||||
public boolean hasPhysicsEvent = true; // Paper
|
||||
+ public boolean hasEntityMoveEvent = false; // Paper
|
||||
private static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 02ddb84c563b3149c4f1b0e24899ce8a21ad61bb..8bc74878919ab7cf6a50d425da61f1b8a8b0ee44 100644
|
||||
index 19ef1b2814270b9385ea15a89dac8c2613a672ee..8c3fb37c511ada39dafdd19fa85e21a1b458386b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -10,6 +10,7 @@ import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
+import io.papermc.paper.event.entity.EntityMoveEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
@@ -2909,6 +2910,20 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3217,6 +3217,20 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
this.pushEntities();
|
||||
this.level.getProfiler().pop();
|
||||
+ // Paper start
|
||||
+ if (((ServerLevel) level).hasEntityMoveEvent) {
|
||||
+ if (xo != getX() || yo != getY() || zo != getZ() || yRotO != yRot || xRotO != xRot) {
|
||||
+ Location from = new Location(level.getWorld(), xo, yo, zo, yRotO, xRotO);
|
||||
+ Location to = new Location (level.getWorld(), getX(), getY(), getZ(), yRot, xRot);
|
||||
+ EntityMoveEvent event = new EntityMoveEvent(getBukkitLivingEntity(), from, to.clone());
|
||||
+ if (((ServerLevel) this.level).hasEntityMoveEvent) {
|
||||
+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
|
||||
+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
|
||||
+ Location to = new Location (this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
|
||||
+ if (!event.callEvent()) {
|
||||
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
|
||||
+ } else if (!to.equals(event.getTo())) {
|
Loading…
Reference in New Issue