it compiles \o/

This commit is contained in:
granny
2025-09-23 21:49:47 -07:00
parent d72168f5c9
commit 4ca9e36463
11 changed files with 18 additions and 17 deletions

View File

@@ -9,13 +9,14 @@
private final RandomSequences randomSequences;
final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
@@ -609,7 +_,24 @@
@@ -609,8 +_,25 @@
// CraftBukkit end
this.tickTime = tickTime;
this.server = server;
- this.customSpawners = customSpawners;
+ this.customSpawners = new ArrayList<>(); // Purpur - Allow toggling special MobSpawners per world
this.serverLevelData = levelData;
+ // Purpur start - Allow toggling special MobSpawners per world
+ this.customSpawners = new ArrayList<>();
+ if (purpurConfig.phantomSpawning) {
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
+ }
@@ -32,9 +33,9 @@
+ this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
+ }
+ // Purpur end - Allow toggling special MobSpawners per world
this.serverLevelData = levelData;
ChunkGenerator chunkGenerator = levelStem.generator();
// CraftBukkit start
this.serverLevelData.setWorld(this);
@@ -692,6 +_,7 @@
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
// Paper end - rewrite chunk system

View File

@@ -20,7 +20,7 @@
+ new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TNT));
+ tntItem.setPickUpDelay(10);
+
+ inHand.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand));
+ inHand.hurtAndBreak(1, player, hand.asEquipmentSlot());
+ serverWorld.addFreshEntity(tntItem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM);
+
+ this.playSound(net.minecraft.sounds.SoundEvents.SHEEP_SHEAR);

View File

@@ -14,7 +14,7 @@
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
+ super.onHitBlock(blockHitResult);
+
+ if (!this.level().isClientSide) {
+ if (!this.level().isClientSide()) {
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
+

View File

@@ -9,7 +9,7 @@
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
+ if(!new org.purpurmc.purpur.event.entity.PreEntityExplodeEvent(this.source.getBukkitEntity(), location, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
+ this.wasCanceled = true;
+ return;
+ return 0;
+ }
+ } else {
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
@@ -17,7 +17,7 @@
+ org.bukkit.block.BlockState blockState = (this.damageSource.causingBlockSnapshot() != null) ? this.damageSource.causingBlockSnapshot() : block.getState();
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
+ this.wasCanceled = true;
+ return;
+ return 0;
+ }
+ }
+ // Purpur end - Add PreExplodeEvents

View File

@@ -27,7 +27,7 @@ public class CreditsCommand {
for (ServerPlayer player : targets) {
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
player.connection.send(packet);
String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().getName());
String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().name());
sender.sendSuccess(output, false);
}
return targets.size();

View File

@@ -27,7 +27,7 @@ public class DemoCommand {
for (ServerPlayer player : targets) {
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0);
player.connection.send(packet);
String output = String.format(PurpurConfig.demoCommandOutput, player.getGameProfile().getName());
String output = String.format(PurpurConfig.demoCommandOutput, player.getGameProfile().name());
sender.sendSuccess(output, false);
}
return targets.size();

View File

@@ -24,7 +24,7 @@ public class PingCommand {
private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
for (ServerPlayer player : targets) {
String output = String.format(PurpurConfig.pingCommandOutput, player.getGameProfile().getName(), player.connection.latency());
String output = String.format(PurpurConfig.pingCommandOutput, player.getGameProfile().name(), player.connection.latency());
sender.sendSuccess(output, false);
}
return targets.size();

View File

@@ -35,7 +35,7 @@ public class RamBarCommand {
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.rambarCommandOutput,
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
Placeholder.parsed("target", player.getGameProfile().getName()));
Placeholder.parsed("target", player.getGameProfile().name()));
sender.sendSuccess(output, false);
}

View File

@@ -35,7 +35,7 @@ public class TPSBarCommand {
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.tpsbarCommandOutput,
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
Placeholder.parsed("target", player.getGameProfile().getName()));
Placeholder.parsed("target", player.getGameProfile().name()));
sender.sendSuccess(output, false);
}

View File

@@ -50,7 +50,7 @@ public class LookControllerWASD extends LookControl {
(byte) Mth.floor(entity.getXRot() * 256.0F / 360.0F),
entity.onGround
);
((ServerLevel) entity.level()).getChunkSource().broadcast(entity, entityPacket);
((ServerLevel) entity.level()).getChunkSource().sendToTrackingPlayers(entity, entityPacket);
}
public void setOffsets(float yaw, float pitch) {

View File

@@ -37,7 +37,7 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
this.handle = data;
this.blockStorage = blockStorage;
CompoundTag customData = handle.occupant.entityData().copyTag();
CompoundTag customData = handle.occupant.entityData().copyTagWithEntityId();
try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(blockEntity.problemPath(), LOGGER)) {
ValueInput valueInput = TagValueInput.create(scopedCollector, RegistryAccess.EMPTY, customData);
@@ -106,11 +106,11 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
@Override
public void update() {
handle.occupant.entityData().copyTag().put("BukkitValues", this.persistentDataContainer.toTagCompound());
handle.occupant.entityData().copyTagWithEntityId().put("BukkitValues", this.persistentDataContainer.toTagCompound());
if(customName == null) {
handle.occupant.entityData().copyTag().remove("CustomName");
handle.occupant.entityData().copyTagWithEntityId().remove("CustomName");
} else {
handle.occupant.entityData().copyTag().putString("CustomName", CraftChatMessage.toJSON(PaperAdventure.asVanilla(customName)));
handle.occupant.entityData().copyTagWithEntityId().putString("CustomName", CraftChatMessage.toJSON(PaperAdventure.asVanilla(customName)));
}
}
}