Remap CraftBukkit to Mojang+Yarn Mappings

By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:55 +01:00
parent a265d64138
commit 30e4583dbe
1780 changed files with 44628 additions and 41274 deletions

View File

@@ -0,0 +1,30 @@
--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -11,6 +11,12 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.phys.Vec3;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.world.GenericGameEvent;
+// CraftBukkit end
public class GameEventDispatcher {
@@ -23,6 +29,14 @@
public void post(Holder<GameEvent> event, Vec3 emitterPos, GameEvent.Context emitter) {
int i = ((GameEvent) event.value()).notificationRadius();
BlockPos blockposition = BlockPos.containing(emitterPos);
+ // CraftBukkit start
+ GenericGameEvent event1 = new GenericGameEvent(CraftGameEvent.minecraftToBukkit(event.value()), CraftLocation.toBukkit(blockposition, this.level.getWorld()), (emitter.sourceEntity() == null) ? null : emitter.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ this.level.getCraftServer().getPluginManager().callEvent(event1);
+ if (event1.isCancelled()) {
+ return;
+ }
+ i = event1.getRadius();
+ // CraftBukkit end
int j = SectionPos.blockToSectionCoord(blockposition.getX() - i);
int k = SectionPos.blockToSectionCoord(blockposition.getY() - i);
int l = SectionPos.blockToSectionCoord(blockposition.getZ() - i);

View File

@@ -1,31 +0,0 @@
--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -12,6 +12,13 @@
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.world.GenericGameEvent;
+// CraftBukkit end
+
public class GameEventDispatcher {
private final WorldServer level;
@@ -23,6 +30,14 @@
public void post(Holder<GameEvent> holder, Vec3D vec3d, GameEvent.a gameevent_a) {
int i = ((GameEvent) holder.value()).notificationRadius();
BlockPosition blockposition = BlockPosition.containing(vec3d);
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(CraftGameEvent.minecraftToBukkit(holder.value()), CraftLocation.toBukkit(blockposition, level.getWorld()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ i = event.getRadius();
+ // CraftBukkit end
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);

View File

@@ -0,0 +1,50 @@
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
@@ -30,6 +30,11 @@
import net.minecraft.world.level.gameevent.PositionSource;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
+// CraftBukkit start
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockReceiveGameEvent;
+// CraftBukkit end
public interface VibrationSystem {
@@ -233,7 +238,8 @@
if (callback.requiresAdjacentChunksToBeTicking() && !Ticker.areAdjacentChunksTicking(world, blockposition1)) {
return false;
} else {
- callback.onReceiveVibration(world, blockposition, vibration.gameEvent(), (Entity) vibration.getEntity(world).orElse((Object) null), (Entity) vibration.getProjectileOwner(world).orElse((Object) null), VibrationSystem.Listener.distanceBetweenInBlocks(blockposition, blockposition1));
+ // CraftBukkit - decompile error
+ callback.onReceiveVibration(world, blockposition, vibration.gameEvent(), (Entity) vibration.getEntity(world).orElse(null), (Entity) vibration.getProjectileOwner(world).orElse(null), VibrationSystem.Listener.distanceBetweenInBlocks(blockposition, blockposition1));
listenerData.setCurrentVibration((VibrationInfo) null);
return true;
}
@@ -288,8 +294,14 @@
return false;
} else {
Vec3 vec3d1 = (Vec3) optional.get();
-
- if (!vibrationsystem_d.canReceiveVibration(world, BlockPos.containing(emitterPos), event, emitter)) {
+ // CraftBukkit start
+ boolean defaultCancel = !vibrationsystem_d.canReceiveVibration(world, BlockPos.containing(emitterPos), event, emitter);
+ Entity entity = emitter.sourceEntity();
+ BlockReceiveGameEvent event1 = new BlockReceiveGameEvent(CraftGameEvent.minecraftToBukkit(event.value()), CraftBlock.at(world, BlockPos.containing(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ event1.setCancelled(defaultCancel);
+ world.getCraftServer().getPluginManager().callEvent(event1);
+ if (event1.isCancelled()) {
+ // CraftBukkit end
return false;
} else if (Listener.isOccluded(world, emitterPos, vec3d1)) {
return false;
@@ -342,7 +354,7 @@
return instance.group(VibrationInfo.CODEC.lenientOptionalFieldOf("event").forGetter((vibrationsystem_a) -> {
return Optional.ofNullable(vibrationsystem_a.currentVibration);
}), VibrationSelector.CODEC.fieldOf("selector").forGetter(VibrationSystem.Data::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> {
- return new VibrationSystem.Data((VibrationInfo) optional.orElse((Object) null), vibrationselector, integer, true);
+ return new VibrationSystem.Data((VibrationInfo) optional.orElse(null), vibrationselector, integer, true); // CraftBukkit - decompile error
});
});
public static final String NBT_TAG_KEY = "listener";

View File

@@ -1,51 +0,0 @@
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
@@ -31,6 +31,12 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockReceiveGameEvent;
+// CraftBukkit end
+
public interface VibrationSystem {
List<ResourceKey<GameEvent>> RESONANCE_EVENTS = List.of(GameEvent.RESONATE_1.key(), GameEvent.RESONATE_2.key(), GameEvent.RESONATE_3.key(), GameEvent.RESONATE_4.key(), GameEvent.RESONATE_5.key(), GameEvent.RESONATE_6.key(), GameEvent.RESONATE_7.key(), GameEvent.RESONATE_8.key(), GameEvent.RESONATE_9.key(), GameEvent.RESONATE_10.key(), GameEvent.RESONATE_11.key(), GameEvent.RESONATE_12.key(), GameEvent.RESONATE_13.key(), GameEvent.RESONATE_14.key(), GameEvent.RESONATE_15.key());
@@ -233,7 +239,8 @@
if (vibrationsystem_d.requiresAdjacentChunksToBeTicking() && !areAdjacentChunksTicking(worldserver, blockposition1)) {
return false;
} else {
- vibrationsystem_d.onReceiveVibration(worldserver, blockposition, vibrationinfo.gameEvent(), (Entity) vibrationinfo.getEntity(worldserver).orElse((Object) null), (Entity) vibrationinfo.getProjectileOwner(worldserver).orElse((Object) null), VibrationSystem.b.distanceBetweenInBlocks(blockposition, blockposition1));
+ // CraftBukkit - decompile error
+ vibrationsystem_d.onReceiveVibration(worldserver, blockposition, vibrationinfo.gameEvent(), (Entity) vibrationinfo.getEntity(worldserver).orElse(null), (Entity) vibrationinfo.getProjectileOwner(worldserver).orElse(null), VibrationSystem.b.distanceBetweenInBlocks(blockposition, blockposition1));
vibrationsystem_a.setCurrentVibration((VibrationInfo) null);
return true;
}
@@ -288,8 +295,14 @@
return false;
} else {
Vec3D vec3d1 = (Vec3D) optional.get();
-
- if (!vibrationsystem_d.canReceiveVibration(worldserver, BlockPosition.containing(vec3d), holder, gameevent_a)) {
+ // CraftBukkit start
+ boolean defaultCancel = !vibrationsystem_d.canReceiveVibration(worldserver, BlockPosition.containing(vec3d), holder, gameevent_a);
+ Entity entity = gameevent_a.sourceEntity();
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(CraftGameEvent.minecraftToBukkit(holder.value()), CraftBlock.at(worldserver, BlockPosition.containing(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ // CraftBukkit end
return false;
} else if (isOccluded(worldserver, vec3d, vec3d1)) {
return false;
@@ -342,7 +355,7 @@
return instance.group(VibrationInfo.CODEC.lenientOptionalFieldOf("event").forGetter((vibrationsystem_a) -> {
return Optional.ofNullable(vibrationsystem_a.currentVibration);
}), VibrationSelector.CODEC.fieldOf("selector").forGetter(VibrationSystem.a::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.a::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> {
- return new VibrationSystem.a((VibrationInfo) optional.orElse((Object) null), vibrationselector, integer, true);
+ return new VibrationSystem.a((VibrationInfo) optional.orElse(null), vibrationselector, integer, true); // CraftBukkit - decompile error
});
});
public static final String NBT_TAG_KEY = "listener";