reapply SummonEntityEffect

This commit is contained in:
Lulu13022002 2024-12-19 18:35:43 +01:00
parent a438cc45f6
commit 1f86b55302
No known key found for this signature in database
GPG Key ID: 491C8F0B8ACDEB01
5 changed files with 14 additions and 22 deletions

View File

@ -166,10 +166,10 @@ index 7702004b68b7735043914f93b54b4413cd21ba41..4d20bda4cba578c47216d450c99389b7
this.levelStorageAccess = levelStorageAccess; this.levelStorageAccess = levelStorageAccess;
this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile()); this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile());
diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java
index d7028ed8ebdecd647467b67f62f7431a6df59f76..9fdb825be2b04a5806bbb3d39948bad0863e7ae5 100644 index 23d241e98f37979701f80fb6f7b76954bd699ad6..fd7ad2b1bffe3880def0f0c9a7ed8de5088ecd71 100644
--- a/net/minecraft/server/level/ServerPlayerGameMode.java --- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -312,6 +312,7 @@ public class ServerPlayerGameMode { @@ -298,6 +298,7 @@ public class ServerPlayerGameMode {
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelected()); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelected()); // CraftBukkit
} }
} }
@ -269,7 +269,7 @@ index 809b3c37d3749c76c3c243cd91c593d03693e9b3..860d1c9729c4ee97ec6f40f7aa969829
} }
} }
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 2b5d99eb6860578cc1af8fbe2571c314846984dd..bc4260623dfb1d804f41593293a5c176c86df5a1 100644 index 51a136cf015de730ca0d1b48cf618a2ed69ea89f..96b0342ab7b922aa16d07b6c00542e6cb66c974a 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java --- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -109,7 +109,7 @@ public class LevelChunk extends ChunkAccess { @@ -109,7 +109,7 @@ public class LevelChunk extends ChunkAccess {

View File

@ -1,10 +1,8 @@
--- a/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java --- a/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java
+++ b/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java +++ b/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java
@@ -29,8 +_,9 @@ @@ -30,7 +_,7 @@
@Override
public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 origin) { public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 origin) {
BlockPos blockPos = BlockPos.containing(origin).offset(this.offset); BlockPos blockPos = BlockPos.containing(origin).offset(this.offset);
+ // }).orElse(true) &&
if (this.predicate.map(blockPredicate -> blockPredicate.test(level, blockPos)).orElse(true) if (this.predicate.map(blockPredicate -> blockPredicate.test(level, blockPos)).orElse(true)
- && level.setBlockAndUpdate(blockPos, this.blockState.getState(entity.getRandom(), blockPos))) { - && level.setBlockAndUpdate(blockPos, this.blockState.getState(entity.getRandom(), blockPos))) {
+ && org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, blockPos, this.blockState.getState(entity.getRandom(), blockPos), entity)) { // CraftBukkit - Call EntityBlockFormEvent + && org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, blockPos, this.blockState.getState(entity.getRandom(), blockPos), entity)) { // CraftBukkit - Call EntityBlockFormEvent

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java --- a/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
+++ b/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java +++ b/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
@@ -34,11 +_,16 @@ @@ -34,11 +_,18 @@
if (Level.isInSpawnableBounds(blockPos)) { if (Level.isInSpawnableBounds(blockPos)) {
Optional<Holder<EntityType<?>>> randomElement = this.entityTypes().getRandomElement(level.getRandom()); Optional<Holder<EntityType<?>>> randomElement = this.entityTypes().getRandomElement(level.getRandom());
if (!randomElement.isEmpty()) { if (!randomElement.isEmpty()) {
@ -11,9 +11,11 @@
lightningBolt.setCause(serverPlayer); lightningBolt.setCause(serverPlayer);
} }
+ // CraftBukkit start + // CraftBukkit start
+ level.strikeLightning(entity1, (item.itemStack().getItem() == net.minecraft.world.item.Items.TRIDENT) ? org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT : org.bukkit.event.weather.LightningStrikeEvent.Cause.ENCHANTMENT); + if (entity1 instanceof LightningBolt) {
+ level.strikeLightning(entity1, (item.itemStack().is(net.minecraft.world.item.Items.TRIDENT)) ? org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT : org.bukkit.event.weather.LightningStrikeEvent.Cause.ENCHANTMENT);
+ } else { + } else {
+ level.addFreshEntityWithPassengers(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENCHANTMENT); + level.addFreshEntityWithPassengers(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENCHANTMENT);
+ }
+ // CraftBukkit end + // CraftBukkit end
if (this.joinTeam && entity.getTeam() != null) { if (this.joinTeam && entity.getTeam() != null) {

View File

@ -90,7 +90,7 @@
+ final List<BlockPos> moved = pistonStructureResolver.getToPush(); + final List<BlockPos> moved = pistonStructureResolver.getToPush();
+ final List<BlockPos> broken = pistonStructureResolver.getToDestroy(); + final List<BlockPos> broken = pistonStructureResolver.getToDestroy();
+ +
+ List<org.bukkit.block.Block> blocks = new java.util.AbstractList<org.bukkit.block.Block>() { + List<org.bukkit.block.Block> blocks = new java.util.AbstractList<>() {
+ +
+ @Override + @Override
+ public int size() { + public int size() {
@ -102,7 +102,7 @@
+ if (index >= this.size() || index < 0) { + if (index >= this.size() || index < 0) {
+ throw new ArrayIndexOutOfBoundsException(index); + throw new ArrayIndexOutOfBoundsException(index);
+ } + }
+ BlockPos pos = (BlockPos) (index < moved.size() ? moved.get(index) : broken.get(index - moved.size())); + BlockPos pos = index < moved.size() ? moved.get(index) : broken.get(index - moved.size());
+ return bblock.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); + return bblock.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+ } + }
+ }; + };

View File

@ -1,13 +1,5 @@
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -46,6 +_,7 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
+import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.Explosion;
@@ -167,16 +_,24 @@ @@ -167,16 +_,24 @@
} }
@ -17,7 +9,7 @@
+ } + }
+ +
+ // CraftBukkit start + // CraftBukkit start
+ protected void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, @Nullable UseOnContext context) { + protected void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, @Nullable net.minecraft.world.item.context.UseOnContext context) {
+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); + this.onPlace(iblockdata, world, blockposition, iblockdata1, flag);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -152,7 +144,7 @@
+ this.onPlace(level, pos, oldState, movedByPiston, null); + this.onPlace(level, pos, oldState, movedByPiston, null);
+ } + }
+ +
+ public void onPlace(Level level, BlockPos pos, BlockState oldState, boolean movedByPiston, @Nullable UseOnContext context) { + public void onPlace(Level level, BlockPos pos, BlockState oldState, boolean movedByPiston, @Nullable net.minecraft.world.item.context.UseOnContext context) {
+ this.getBlock().onPlace(this.asState(), level, pos, oldState, movedByPiston, context); + this.getBlock().onPlace(this.asState(), level, pos, oldState, movedByPiston, context);
+ // CraftBukkit end + // CraftBukkit end
} }