Fix blockentity saving
This commit is contained in:
parent
6d78029af2
commit
26808f0ce8
@ -255,9 +255,9 @@ public class BlockEntityBatteryBank extends BlockEntityMattery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("battery_bank", battery_container.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -336,9 +336,9 @@ public class BlockEntityBlackHole extends BlockEntity {
|
||||
|
||||
// disk io
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag tag) {
|
||||
writeBlackHoleData(tag);
|
||||
return super.save(tag);
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
writeBlackHoleData(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,9 +71,9 @@ public class BlockEntityCargoCrate extends BlockEntityMattery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("slots", container.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,9 +62,9 @@ public class BlockEntityDriveRack extends BlockEntityMatteryPowered {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("drives", drives.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,9 +120,9 @@ public class BlockEntityDriveViewer extends BlockEntityMatteryPowered {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("drive_slot", drive_slot.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,16 +100,15 @@ public class BlockEntityEnergyCounter extends BlockEntityMattery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
nbt.putString("passed", passed.toString());
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("passed", passed.serializeNBT());
|
||||
var list = new ListTag();
|
||||
nbt.put("history", list);
|
||||
nbt.putInt("history_tick", history_tick);
|
||||
|
||||
for (var num : history)
|
||||
list.add(StringTag.valueOf(num.toString()));
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
@ -186,11 +186,11 @@ public class BlockEntityMatterBottler extends BlockEntityMatteryPowered implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("work_slots", work_slots.serializeNBT());
|
||||
nbt.putBoolean("work_flow", work_flow);
|
||||
nbt.put("matter_capability", matter.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -180,9 +180,9 @@ public class BlockEntityMatterCapacitorBank extends BlockEntityMattery implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("matter_container", matter_container.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,11 +76,10 @@ public class BlockEntityMatterDecomposer extends BlockEntityMatteryWorker implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("work_slots", item_container.serializeNBT());
|
||||
nbt.put("matter_capability", matter.serializeNBT());
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +203,8 @@ public class BlockEntityMatterPanel extends BlockEntityMattery implements IMatte
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
ListTag list = new ListTag();
|
||||
|
||||
for (MatterTask task : tasks.values()) {
|
||||
@ -211,8 +212,6 @@ public class BlockEntityMatterPanel extends BlockEntityMattery implements IMatte
|
||||
}
|
||||
|
||||
nbt.put("tasks", list);
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,11 +207,11 @@ public class BlockEntityMatterReplicator extends BlockEntityMatteryWorker implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("regular_slots", regular_slots.serializeNBT());
|
||||
nbt.put("reserved_slots", reserved_slots.serializeNBT());
|
||||
nbt.put("matter_capability", matter.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,9 +127,9 @@ public class BlockEntityMatterScanner extends BlockEntityMatteryWorker implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("work_slots", input_slot.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,14 +152,14 @@ public abstract class BlockEntityMattery extends BlockEntity implements MenuProv
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
|
||||
if (display_name != null)
|
||||
nbt.putString("Name", Component.Serializer.toJson(display_name));
|
||||
|
||||
nbt.putByte("redstone", (byte) redstone_setting.ordinal());
|
||||
nbt.putByte("redstone_signal", (byte) redstone_signal);
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
public void load(CompoundTag nbt) {
|
||||
|
@ -111,13 +111,13 @@ abstract public class BlockEntityMatteryPowered extends BlockEntityMattery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
|
||||
if (energy != null)
|
||||
nbt.put("energy_cap", energy.serializeNBT());
|
||||
|
||||
nbt.put("battery_container", battery_container.serializeNBT());
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
public void load(CompoundTag nbt) {
|
||||
|
@ -86,9 +86,9 @@ public class BlockEntityPatternStorage extends BlockEntityMattery implements IMa
|
||||
private MatterGrid grid;
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.put("patterns", patterns.serializeNBT());
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,14 +48,13 @@ abstract public class BlockEntityMatteryWorker extends BlockEntityMatteryPowered
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
public void saveAdditional(CompoundTag nbt) {
|
||||
super.saveAdditional(nbt);
|
||||
nbt.putDouble("work_ticks", work_ticks);
|
||||
|
||||
if (current_job != null) {
|
||||
nbt.put("current_job", current_job.serializeNBT());
|
||||
}
|
||||
|
||||
return super.save(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,14 +152,14 @@ public class MatterHandlerCapability implements IMatterHandler, INBTSerializable
|
||||
@Override
|
||||
public CompoundTag serializeNBT() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putString("stored", stored.toString());
|
||||
tag.putString("max_storage", max_storage.toString());
|
||||
tag.put("stored", stored.serializeNBT());
|
||||
tag.put("max_storage", max_storage.serializeNBT());
|
||||
|
||||
if (max_receive != null)
|
||||
tag.putString("max_receive", max_receive.toString());
|
||||
tag.put("max_receive", max_receive.serializeNBT());
|
||||
|
||||
if (max_extract != null)
|
||||
tag.putString("max_extract", max_extract.toString());
|
||||
tag.put("max_extract", max_extract.serializeNBT());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user