more patches

This commit is contained in:
Jake Potrebic 2021-06-14 12:58:32 -07:00
parent 26e04471c9
commit efc6fa6a04
36 changed files with 174 additions and 465 deletions

View file

@ -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

View file

@ -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 | Martin <admin@minidigger.dev>
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/DataSlot.java
+++ b/src/main/java/net/minecraft/world/inventory/DataSlot.java
@@ -0,0 +0,0 @@ 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() {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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 = () -> {
@@ -0,0 +0,0 @@ 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();
}

View file

@ -1,90 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 18 Nov 2020 20:52:25 -0800
Subject: [PATCH] Entity load/save limit per chunk
Adds a config option to limit the number of entities saved and loaded
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.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import net.minecraft.world.Difficulty;
+import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.monster.Vindicator;
import net.minecraft.world.entity.monster.Zombie;
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
Difficulty.class
);
}
+
+ public Map<EntityType<?>, Integer> entityPerChunkSaveLimits = new HashMap<>();
+ private void entityPerChunkSaveLimits() {
+ getInt("entity-per-chunk-save-limit.experience_orb", -1);
+ getInt("entity-per-chunk-save-limit.snowball", -1);
+ getInt("entity-per-chunk-save-limit.ender_pearl", -1);
+ getInt("entity-per-chunk-save-limit.arrow", -1);
+ EntityType.getEntityNameList().forEach(name -> {
+ final EntityType<?> type = EntityType.getByName(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString()));
+ final String path = ".entity-per-chunk-save-limit." + name.getPath();
+ final int value = config.getInt("world-settings." + worldName + path, config.getInt("world-settings.default" + path, -1)); // get without setting defaults
+ if (value != -1) entityPerChunkSaveLimits.put(type, value);
+ });
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -0,0 +0,0 @@ public class ChunkSerializer {
chunk.setLastSaveHadEntities(false);
+ // Paper start
+ final Map<EntityType<?>, Integer> savedEntityCounts = Maps.newHashMap();
for (int j = 0; j < chunk.getEntitySlices().length; ++j) {
Iterator iterator1 = chunk.getEntitySlices()[j].iterator();
while (iterator1.hasNext()) {
Entity entity = (Entity) iterator1.next();
+ final EntityType<?> entityType = entity.getType();
+ final int saveLimit = worldserver.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1);
+ if (saveLimit > -1) {
+ if (savedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) {
+ continue;
+ }
+ savedEntityCounts.merge(entityType, 1, Integer::sum);
+ }
+ // Paper end
CompoundTag nbttagcompound4 = new CompoundTag();
// Paper start
if (asyncsavedata == null && !entity.removed && (int) Math.floor(entity.getX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.getZ()) >> 4 != chunk.getPos().z) {
@@ -0,0 +0,0 @@ public class ChunkSerializer {
ListTag nbttaglist = tag.getList("Entities", 10);
Level world = chunk.getLevel();
+ // Paper start
+ final Map<EntityType<?>, Integer> loadedEntityCounts = Maps.newHashMap();
for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
EntityType.loadEntityRecursive(nbttagcompound1, world, (entity) -> {
+ final EntityType<?> entityType = entity.getType();
+ final int saveLimit = world.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1);
+ if (saveLimit > -1) {
+ if (loadedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) {
+ return null;
+ }
+ loadedEntityCounts.merge(entityType, 1, Integer::sum);
+ }
+ // Paper end
chunk.addEntity(entity);
return entity;
});

View file

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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});
});
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) {
@@ -0,0 +0,0 @@ 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();
@@ -0,0 +0,0 @@ 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);

View file

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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 {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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;

View file

@ -8,28 +8,20 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ 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 {
@@ -0,0 +0,0 @@ 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 {
@ -73,8 +65,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@ -111,28 +104,19 @@ diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotE
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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
}

View file

@ -62,4 +62,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
// Paper end
// Spigot start
@Override

View file

@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
if (value != -1) entityPerChunkSaveLimits.put(type, value);
});
private void perPlayerMobSpawns() {
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false);
}
+
+ public boolean enderDragonsDeathAlwaysPlacesDragonEgg = false;
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java

View file

@ -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 | Martin <admin@minidigger.dev>
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -0,0 +0,0 @@ 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 = () -> {
@@ -0,0 +0,0 @@ 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();
}

View file

@ -30,12 +30,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @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
@ -45,11 +45,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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();

View file

@ -8,17 +8,6 @@ diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/m
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 @@ 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;
@@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu {
public void updateEffects(int primaryEffectId, int secondaryEffectId) {
@ -26,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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
}

View file

@ -31,7 +31,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {

View file

@ -8,20 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
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 @@ 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;
@@ -0,0 +0,0 @@ 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
@ -33,31 +25,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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())) {

View file

@ -8,27 +8,19 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public abstract class PlayerList {
for (Iterator iterator = entity.getIndirectPassengers().iterator(); iterator.hasNext(); entity1.removed = true) {
entity1 = (Entity) iterator.next();
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {
+ // Paper start
+ if (entity1 instanceof AbstractVillager) {
+ final AbstractVillager villager = (AbstractVillager) entity1;
+ 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
worldserver.despawn(entity1);
}
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
});
}

View file

@ -12,30 +12,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public class CraftEventFactory {
BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block);
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.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);
+ 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

View file

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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", 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) {
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ 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 {

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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
}

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}

View file

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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;

View file

@ -8,10 +8,10 @@ diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
super(type, world);
@@ -0,0 +0,0 @@ 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;
}
@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@Override
public boolean canChangeDimensions() {
@ -43,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -0,0 +0,0 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
public BossBar getBossBar() {
return bossBar;
return this.bossBar;
}
+
+ // Paper start