mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
it compiles \o/
This commit is contained in:
@@ -9,13 +9,14 @@
|
|||||||
private final RandomSequences randomSequences;
|
private final RandomSequences randomSequences;
|
||||||
final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
||||||
|
|
||||||
@@ -609,7 +_,24 @@
|
@@ -609,8 +_,25 @@
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.tickTime = tickTime;
|
this.tickTime = tickTime;
|
||||||
this.server = server;
|
this.server = server;
|
||||||
- this.customSpawners = customSpawners;
|
- 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
|
+ // Purpur start - Allow toggling special MobSpawners per world
|
||||||
+ this.customSpawners = new ArrayList<>();
|
|
||||||
+ if (purpurConfig.phantomSpawning) {
|
+ if (purpurConfig.phantomSpawning) {
|
||||||
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
|
+ 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));
|
+ this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Allow toggling special MobSpawners per world
|
+ // Purpur end - Allow toggling special MobSpawners per world
|
||||||
this.serverLevelData = levelData;
|
|
||||||
ChunkGenerator chunkGenerator = levelStem.generator();
|
ChunkGenerator chunkGenerator = levelStem.generator();
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
this.serverLevelData.setWorld(this);
|
||||||
@@ -692,6 +_,7 @@
|
@@ -692,6 +_,7 @@
|
||||||
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
|
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
+ new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TNT));
|
+ new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TNT));
|
||||||
+ tntItem.setPickUpDelay(10);
|
+ 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);
|
+ serverWorld.addFreshEntity(tntItem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM);
|
||||||
+
|
+
|
||||||
+ this.playSound(net.minecraft.sounds.SoundEvents.SHEEP_SHEAR);
|
+ this.playSound(net.minecraft.sounds.SoundEvents.SHEEP_SHEAR);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
|
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
|
||||||
+ super.onHitBlock(blockHitResult);
|
+ super.onHitBlock(blockHitResult);
|
||||||
+
|
+
|
||||||
+ if (!this.level().isClientSide) {
|
+ if (!this.level().isClientSide()) {
|
||||||
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
|
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
|
||||||
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
|
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
|
+ 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()) {
|
+ 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;
|
+ this.wasCanceled = true;
|
||||||
+ return;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
|
+ 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();
|
+ 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()) {
|
+ 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;
|
+ this.wasCanceled = true;
|
||||||
+ return;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Add PreExplodeEvents
|
+ // Purpur end - Add PreExplodeEvents
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class CreditsCommand {
|
|||||||
for (ServerPlayer player : targets) {
|
for (ServerPlayer player : targets) {
|
||||||
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
|
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
|
||||||
player.connection.send(packet);
|
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);
|
sender.sendSuccess(output, false);
|
||||||
}
|
}
|
||||||
return targets.size();
|
return targets.size();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class DemoCommand {
|
|||||||
for (ServerPlayer player : targets) {
|
for (ServerPlayer player : targets) {
|
||||||
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0);
|
ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0);
|
||||||
player.connection.send(packet);
|
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);
|
sender.sendSuccess(output, false);
|
||||||
}
|
}
|
||||||
return targets.size();
|
return targets.size();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class PingCommand {
|
|||||||
|
|
||||||
private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
|
private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
|
||||||
for (ServerPlayer player : 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);
|
sender.sendSuccess(output, false);
|
||||||
}
|
}
|
||||||
return targets.size();
|
return targets.size();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class RamBarCommand {
|
|||||||
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.rambarCommandOutput,
|
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.rambarCommandOutput,
|
||||||
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
|
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
|
||||||
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
|
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
|
||||||
Placeholder.parsed("target", player.getGameProfile().getName()));
|
Placeholder.parsed("target", player.getGameProfile().name()));
|
||||||
|
|
||||||
sender.sendSuccess(output, false);
|
sender.sendSuccess(output, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class TPSBarCommand {
|
|||||||
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.tpsbarCommandOutput,
|
Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.tpsbarCommandOutput,
|
||||||
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
|
Placeholder.component("onoff", Component.translatable(result ? "options.on" : "options.off")
|
||||||
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
|
.color(result ? NamedTextColor.GREEN : NamedTextColor.RED)),
|
||||||
Placeholder.parsed("target", player.getGameProfile().getName()));
|
Placeholder.parsed("target", player.getGameProfile().name()));
|
||||||
|
|
||||||
sender.sendSuccess(output, false);
|
sender.sendSuccess(output, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class LookControllerWASD extends LookControl {
|
|||||||
(byte) Mth.floor(entity.getXRot() * 256.0F / 360.0F),
|
(byte) Mth.floor(entity.getXRot() * 256.0F / 360.0F),
|
||||||
entity.onGround
|
entity.onGround
|
||||||
);
|
);
|
||||||
((ServerLevel) entity.level()).getChunkSource().broadcast(entity, entityPacket);
|
((ServerLevel) entity.level()).getChunkSource().sendToTrackingPlayers(entity, entityPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOffsets(float yaw, float pitch) {
|
public void setOffsets(float yaw, float pitch) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
|
|||||||
this.handle = data;
|
this.handle = data;
|
||||||
this.blockStorage = blockStorage;
|
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)) {
|
try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(blockEntity.problemPath(), LOGGER)) {
|
||||||
ValueInput valueInput = TagValueInput.create(scopedCollector, RegistryAccess.EMPTY, customData);
|
ValueInput valueInput = TagValueInput.create(scopedCollector, RegistryAccess.EMPTY, customData);
|
||||||
@@ -106,11 +106,11 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
handle.occupant.entityData().copyTag().put("BukkitValues", this.persistentDataContainer.toTagCompound());
|
handle.occupant.entityData().copyTagWithEntityId().put("BukkitValues", this.persistentDataContainer.toTagCompound());
|
||||||
if(customName == null) {
|
if(customName == null) {
|
||||||
handle.occupant.entityData().copyTag().remove("CustomName");
|
handle.occupant.entityData().copyTagWithEntityId().remove("CustomName");
|
||||||
} else {
|
} else {
|
||||||
handle.occupant.entityData().copyTag().putString("CustomName", CraftChatMessage.toJSON(PaperAdventure.asVanilla(customName)));
|
handle.occupant.entityData().copyTagWithEntityId().putString("CustomName", CraftChatMessage.toJSON(PaperAdventure.asVanilla(customName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user