mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47:43 +01:00
it compiles \o/
This commit is contained in:
@@ -81,7 +81,7 @@
|
||||
return this.isInWater() || flag;
|
||||
}
|
||||
|
||||
- void updateInWaterStateAndDoWaterCurrentPushing() {
|
||||
- public void updateInWaterStateAndDoWaterCurrentPushing() {
|
||||
+ public void updateInWaterStateAndDoWaterCurrentPushing() { // Purpur - Movement options for armor stands - package-private -> public - TODO: use AT file
|
||||
if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) {
|
||||
this.wasTouchingWater = false;
|
||||
@@ -98,16 +98,12 @@
|
||||
} catch (Throwable var7) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var7, "Saving entity NBT");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being saved");
|
||||
@@ -2557,6 +_,13 @@
|
||||
@@ -2557,6 +_,9 @@
|
||||
}
|
||||
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start - Fire immune API
|
||||
+ if (input.contains("Purpur.FireImmune")) {
|
||||
+ immuneToFire = input.getBoolean("Purpur.FireImmune").orElse(null);
|
||||
+ }
|
||||
+ // Purpur end - Fire immune API
|
||||
+ immuneToFire = input.read("Purpur.FireImmune", com.mojang.serialization.Codec.BOOL).orElse(null); // Purpur - Fire immune API
|
||||
+
|
||||
} catch (Throwable var7) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(var7, "Loading entity NBT");
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/SpawnerBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SpawnerBlock.java
|
||||
@@ -38,6 +_,59 @@
|
||||
@@ -14,6 +_,7 @@
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class SpawnerBlock extends BaseEntityBlock {
|
||||
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
|
||||
public static final MapCodec<SpawnerBlock> CODEC = simpleCodec(SpawnerBlock::new);
|
||||
|
||||
@Override
|
||||
@@ -38,6 +_,62 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +21,10 @@
|
||||
+ net.minecraft.world.level.SpawnData nextSpawnData = blockEntity instanceof SpawnerBlockEntity spawnerBlock ? spawnerBlock.getSpawner().nextSpawnData : null;
|
||||
+ java.util.Optional<net.minecraft.world.entity.EntityType<?>> type = java.util.Optional.empty();
|
||||
+ if (nextSpawnData != null) {
|
||||
+ type = net.minecraft.world.entity.EntityType.by(nextSpawnData.getEntityToSpawn());
|
||||
+ try (net.minecraft.util.ProblemReporter.ScopedCollector scopedCollector = new net.minecraft.util.ProblemReporter.ScopedCollector(blockEntity.problemPath(), LOGGER)) {
|
||||
+ net.minecraft.world.level.storage.ValueInput valueInput = net.minecraft.world.level.storage.TagValueInput.create(scopedCollector, player.level().registryAccess(), nextSpawnData.entityToSpawn());
|
||||
+ type = net.minecraft.world.entity.EntityType.by(valueInput);
|
||||
+ }
|
||||
+ net.minecraft.nbt.CompoundTag spawnDataTag = new net.minecraft.nbt.CompoundTag();
|
||||
+ spawnDataTag.storeNullable("SpawnData", net.minecraft.world.level.SpawnData.CODEC, nextSpawnData);
|
||||
+ item.set(net.minecraft.core.component.DataComponents.CUSTOM_DATA, net.minecraft.world.item.component.CustomData.EMPTY.update(compoundTag -> compoundTag.put("Purpur.SpawnData", spawnDataTag)));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Paper end - read persistent data container
|
||||
+
|
||||
+
|
||||
+ this.persistentLore = tag.read("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC).orElse(null); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
+ this.persistentLore = input.read("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC).orElse(null); // Purpur - Persistent BlockEntity Lore and DisplayName
|
||||
+
|
||||
}
|
||||
|
||||
|
||||
@@ -35,26 +35,29 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -306,6 +_,24 @@
|
||||
@@ -306,6 +_,27 @@
|
||||
// CraftBukkit - this
|
||||
return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, level, 2, string, component, level.getServer(), player); // Paper - Fix commands from signs not firing command events
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Signs allow color codes
|
||||
+ public ClientboundBlockEntityDataPacket getTranslatedUpdatePacket(boolean filtered, boolean front) {
|
||||
+ final CompoundTag nbt = new CompoundTag();
|
||||
+ this.saveAdditional(nbt, this.getLevel().registryAccess());
|
||||
+ final Component[] lines = front ? frontText.getMessages(filtered) : backText.getMessages(filtered);
|
||||
+ final String side = front ? "front_text" : "back_text";
|
||||
+ for (int i = 0; i < 4; i++) {
|
||||
+ final var component = io.papermc.paper.adventure.PaperAdventure.asAdventure(lines[i]);
|
||||
+ final String line = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
||||
+ final CompoundTag sideNbt = nbt.getCompoundOrEmpty(side);
|
||||
+ final net.minecraft.nbt.ListTag messagesNbt = sideNbt.getListOrEmpty("messages");
|
||||
+ messagesNbt.set(i, net.minecraft.nbt.StringTag.valueOf(line));
|
||||
+ try (net.minecraft.util.ProblemReporter.ScopedCollector scopedCollector = new net.minecraft.util.ProblemReporter.ScopedCollector(this.problemPath(), LOGGER)) {
|
||||
+ net.minecraft.world.level.storage.TagValueOutput tagValueOutput = net.minecraft.world.level.storage.TagValueOutput.createWithContext(scopedCollector, this.getLevel().registryAccess());
|
||||
+ this.saveAdditional(tagValueOutput);
|
||||
+
|
||||
+ final Component[] lines = front ? frontText.getMessages(filtered) : backText.getMessages(filtered);
|
||||
+ final String side = front ? "front_text" : "back_text";
|
||||
+ for (int i = 0; i < 4; i++) {
|
||||
+ final net.kyori.adventure.text.Component component = io.papermc.paper.adventure.PaperAdventure.asAdventure(lines[i]);
|
||||
+ final String line = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
||||
+ net.minecraft.world.level.storage.ValueOutput sideNbt = tagValueOutput.child(side);
|
||||
+ net.minecraft.world.level.storage.ValueOutput.TypedOutputList<String> messagesNbt = sideNbt.list("messages", com.mojang.serialization.Codec.STRING);
|
||||
+ messagesNbt.add(line);
|
||||
+ }
|
||||
+ tagValueOutput.putString("PurpurEditor", "true");
|
||||
+ return ClientboundBlockEntityDataPacket.create(this, (blockEntity, registryAccess) -> tagValueOutput.buildResult());
|
||||
+ }
|
||||
+ nbt.putString("PurpurEditor", "true");
|
||||
+ return ClientboundBlockEntityDataPacket.create(this, (blockEntity, registryAccess) -> nbt);
|
||||
+ }
|
||||
+ // Purpur end - Signs allow color codes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user