Skip to content

Commit 4ca9e36

Browse files
committed
it compiles \o/
1 parent d72168f commit 4ca9e36

11 files changed

Lines changed: 18 additions & 17 deletions

File tree

purpur-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
private final RandomSequences randomSequences;
1010
final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
1111

12-
@@ -609,7 +_,24 @@
12+
@@ -609,8 +_,25 @@
1313
// CraftBukkit end
1414
this.tickTime = tickTime;
1515
this.server = server;
1616
- this.customSpawners = customSpawners;
17+
+ this.customSpawners = new ArrayList<>(); // Purpur - Allow toggling special MobSpawners per world
18+
this.serverLevelData = levelData;
1719
+ // Purpur start - Allow toggling special MobSpawners per world
18-
+ this.customSpawners = new ArrayList<>();
1920
+ if (purpurConfig.phantomSpawning) {
2021
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
2122
+ }
@@ -32,9 +33,9 @@
3233
+ this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
3334
+ }
3435
+ // Purpur end - Allow toggling special MobSpawners per world
35-
this.serverLevelData = levelData;
3636
ChunkGenerator chunkGenerator = levelStem.generator();
3737
// CraftBukkit start
38+
this.serverLevelData.setWorld(this);
3839
@@ -692,6 +_,7 @@
3940
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
4041
// Paper end - rewrite chunk system

purpur-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
+ new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TNT));
2121
+ tntItem.setPickUpDelay(10);
2222
+
23-
+ inHand.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand));
23+
+ inHand.hurtAndBreak(1, player, hand.asEquipmentSlot());
2424
+ serverWorld.addFreshEntity(tntItem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM);
2525
+
2626
+ this.playSound(net.minecraft.sounds.SoundEvents.SHEEP_SHEAR);

purpur-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/Snowball.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
1515
+ super.onHitBlock(blockHitResult);
1616
+
17-
+ if (!this.level().isClientSide) {
17+
+ if (!this.level().isClientSide()) {
1818
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
1919
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
2020
+

purpur-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
1010
+ 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()) {
1111
+ this.wasCanceled = true;
12-
+ return;
12+
+ return 0;
1313
+ }
1414
+ } else {
1515
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
1616
+ org.bukkit.block.Block block = location.getBlock();
1717
+ org.bukkit.block.BlockState blockState = (this.damageSource.causingBlockSnapshot() != null) ? this.damageSource.causingBlockSnapshot() : block.getState();
1818
+ 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()) {
1919
+ this.wasCanceled = true;
20-
+ return;
20+
+ return 0;
2121
+ }
2222
+ }
2323
+ // Purpur end - Add PreExplodeEvents

purpur-server/src/main/java/org/purpurmc/purpur/command/CreditsCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> t
2727
for (ServerPlayer player : targets) {
2828
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
2929
player.connection.send(packet);
30-
String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().getName());
30+
String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().name());
3131
sender.sendSuccess(output, false);
3232
}
3333
return targets.size();

purpur-server/src/main/java/org/purpurmc/purpur/command/DemoCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> t
2727
for (ServerPlayer player : targets) {
2828
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0);
2929
player.connection.send(packet);
30-
String output = String.format(PurpurConfig.demoCommandOutput, player.getGameProfile().getName());
30+
String output = String.format(PurpurConfig.demoCommandOutput, player.getGameProfile().name());
3131
sender.sendSuccess(output, false);
3232
}
3333
return targets.size();

purpur-server/src/main/java/org/purpurmc/purpur/command/PingCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
2424

2525
private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
2626
for (ServerPlayer player : targets) {
27-
String output = String.format(PurpurConfig.pingCommandOutput, player.getGameProfile().getName(), player.connection.latency());
27+
String output = String.format(PurpurConfig.pingCommandOutput, player.getGameProfile().name(), player.connection.latency());
2828
sender.sendSuccess(output, false);
2929
}
3030
return targets.size();

purpur-server/src/main/java/org/purpurmc/purpur/command/RamBarCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> t
3535
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.rambarCommandOutput,
3636
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
3737
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
38-
Placeholder.parsed("target", player.getGameProfile().getName()));
38+
Placeholder.parsed("target", player.getGameProfile().name()));
3939

4040
sender.sendSuccess(output, false);
4141
}

purpur-server/src/main/java/org/purpurmc/purpur/command/TPSBarCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> t
3535
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.tpsbarCommandOutput,
3636
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
3737
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
38-
Placeholder.parsed("target", player.getGameProfile().getName()));
38+
Placeholder.parsed("target", player.getGameProfile().name()));
3939

4040
sender.sendSuccess(output, false);
4141
}

purpur-server/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void setYawPitch(float yRot, float xRot) {
5050
(byte) Mth.floor(entity.getXRot() * 256.0F / 360.0F),
5151
entity.onGround
5252
);
53-
((ServerLevel) entity.level()).getChunkSource().broadcast(entity, entityPacket);
53+
((ServerLevel) entity.level()).getChunkSource().sendToTrackingPlayers(entity, entityPacket);
5454
}
5555

5656
public void setOffsets(float yaw, float pitch) {

0 commit comments

Comments
 (0)