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