Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
52cd430
Replace ldlib sync data system with new data sync system (#3491)
gustovafing Dec 23, 2025
19ad605
Fix sync lists being immutable (#4371)
gustovafing Dec 25, 2025
ea57226
[8.0] Fix some tests (#4407)
TarLaboratories Jan 2, 2026
78f6435
Fix sync transformer sets, add better error logging and mark renderst…
jurrejelle Jan 8, 2026
6d3d10a
Full refactor of MetaMachine to merge MetaMachine and MetaMachineBloc…
gustovafing Jan 8, 2026
1be721d
Fix solar test + spotless on 1.20.1-v8.0.0 (#4450)
zetrock1 Jan 9, 2026
ebf4c07
merge 1.20.1 into 1.20.1-v8
gustovafing Jan 25, 2026
6014780
Update 1.20 1v8 to latest (#4496)
TechLord22 Jan 25, 2026
a8d3162
Start of new machine trait system (#4479)
gustovafing Jan 26, 2026
5ecfe6d
Clean up sync API & fix issues relating to generic type erasure (#4489)
gustovafing Jan 31, 2026
6b4e0d7
Remove TOP support (#4523)
gustovafing Jan 31, 2026
ac13f5a
Fix ChargerMachine is null after placing (#4460)
zetrock1 Feb 4, 2026
1667e5b
Remove some unnecessary forge capabilities, and move cleanroom behavi…
gustovafing Feb 4, 2026
2093e81
fix gametests (#4550)
gustovafing Feb 4, 2026
d9832a6
change sync logging (#4556)
gustovafing Feb 5, 2026
cf54762
Refactor machine auto output behaviour (#4551)
gustovafing Feb 6, 2026
0c36ee3
Remove unchecked casts in TagPrefix (#4559)
TechLord22 Feb 8, 2026
c5c84e9
remove IMachineLife interface (#4569)
gustovafing Feb 8, 2026
963d514
Fix child sync objects not being saved (#4585)
gustovafing Feb 9, 2026
013ba88
Fix pattern buffer test (#4562)
jurrejelle Feb 9, 2026
b487d6b
Remove IMachineModifyDrops interface (#4582)
gustovafing Feb 9, 2026
4ba1585
Revert "Fix child sync objects not being saved" (#4589)
gustovafing Feb 9, 2026
5a736a6
remove clearInventory method from metamachine (#4581)
gustovafing Feb 12, 2026
c44f29e
Remove IInteractedMachine (#4568)
gustovafing Feb 12, 2026
4db4ad0
Migration docs for all machine stuff so far (#4591)
gustovafing Feb 12, 2026
f2c7989
Remove IParallelHatch and IObjectHolder (#4609)
YoungOnionMC Feb 12, 2026
ed6cddb
Port HPCA to trait (#4580)
gustovafing Feb 12, 2026
792284b
Remove IMultiController & IRotorHolderMachine (#4590)
gustovafing Feb 12, 2026
1596884
fix merge issue (#4615)
gustovafing Feb 13, 2026
0166030
Add explodable machine trait (#4567)
gustovafing Feb 14, 2026
1f88363
Update v8 to latest 1.20.1 (#4629)
gustovafing Feb 14, 2026
5318e92
Merge branch '1.20.1' into 1.20.1-v8.0.0
gustovafing Feb 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ dependencies {
modCompileOnly(forge.bundles.rei)
modCompileOnly(forge.emi)

// WAILA-likes
modCompileOnly(forge.theoneprobe)
// Jade (WAILA)
modCompileOnly(forge.jade)

// Curios
Expand Down
61 changes: 61 additions & 0 deletions docs/content/Development/Data-Sync-System/Annotations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "Annotations"
---

# Annotations
The following annotations define the sync/save behaviour for an `ISyncManaged` object.

### `@SaveField`

The `@SaveField` annotation defines a field that should be saved to the server. `nbtKey` is optional, the key will default to the field name.
```java
@SaveField(nbtKey="nbtKeyToSaveTo")
public int mySaveInt = 10;
```

### `@SyncToClient`

The `@SyncToClient` annotation defines a field with a value that should be synced to clients.

!!! warning
Client sync fields **do not** automatically detect changes. When changing a client sync field, call `ISyncManaged.getSyncDataHolder().markClientSyncFieldDirty(FIELD_NAME)`
```java
@SaveField(nbtKey="nbtKeyToSaveTo")
@SyncToClient
public int mySaveAndSyncInt = 10;

@SyncToClient
@RerenderOnChanged
public long mySyncRerenderLong = 10000L;

public void serverTick() {
int newIntValue = getNewIntValue();
long newLongValue = getNewLongValue();
if (mySaveAndSyncInt != newIntValue) {
mySaveAndSyncInt = newIntValue;
getSyncDataHolder().markClientSyncFieldDirty("mySaveAndSyncInt");
}
if (mySyncRerenderLong != newLongValue) {
mySyncRerenderLong = newLongValue;
getSyncDataHolder().markClientSyncFieldDirty("mySyncRerenderLong");
}
}
```

### `@ClientFieldChangeListener` and `@RerenderOnChanged`

The `@ClientFieldChangeListener` annotation defines a method to be called on the client when a client sync field has changed value;

Annotating a `@SyncToClient` field with `@RerenderOnChanged` will cause clients to rerender the block entity when this field changes.

```java
@SyncToClient
@SaveField
@RerenderOnChanged
public boolean isWorkingEnabled = true;

@ClientFieldChangeListener(fieldName="isWorkingEnabled")
public void isWorkingChanged() {
setRenderState(getRenderState().setValue(GTMachineModelProperties.IS_WORKING_ENABLED, isWorkingEnabled));
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "Migrating from LDLib SyncData"
---
# Migrating from LDLib SyncData

### Simple example

This simple example covers the majority of use cases when adding sync/save fields to a standard machine, machine trait or cover.

#### With LDLib:
```java
class CustomMachine extends SimpleTieredMachine {
protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CustomMachine.class,
SimpleTieredMachine.MANAGED_FIELD_HOLDER);

@Override
public ManagedFieldHolder getFieldHolder() {
return MANAGED_FIELD_HOLDER;
}

@Getter
@Persisted
@DescSynced
@RequireRerender
protected int customIntValue;

@Persisted(key = "customNBTKey")
protected String customStringValue;

public void setCustomIntValue(int newValue) {
this.customIntValue = newValue;
}
}
```

#### New System:
```java
class CustomMachine extends SimpleTieredMachine {
@Getter
@SaveField
@SyncToClient
protected int customIntValue;

@SaveField(nbtKey = "customNBTKey")
protected String customStringValue;

public void setCustomIntValue(int newValue) {
this.customIntValue = newValue;
////// IMPORTANT: markClientSyncFieldDirty must be called to update client synced fields.
getSyncDataHolder().markClientSyncFieldDirty("customIntValue");
}
}

```

### General migration guidelines

- Remove all `ManagedFieldHolder` fields.
- Replace `FieldManagedStorage` fields with `SyncDataHolder` fields.
- Replace `IEnhancedManaged` objects with `ISyncManaged`.
- Replace `IAsyncAutoSyncBlockEntity`, `IAutoPersistBlockEntity`, `IAutoSyncBlockEntity` and `IManagedBlockEntity` by extending `ManagedSyncBlockEntity`.

### Annotations

!!! warning
Client sync fields **do not** automatically detect changes. When changing a client sync field, call `ISyncManaged.syncDataHolder.markClientSyncFieldDirty(FIELD_NAME)`

- `@DescSynced` -> `@SyncToClient`
- `@RequireRerender` -> `@RerenderOnChanged`
- `@Persisted` -> `@SaveField`
- `@UpdateListener` -> `@ClientFieldChangeListener` on listener method.
- `@DropSaved` - Removed, make machines implement `IDropSaveMachine` instead
- `@ReadOnlyManaged` and `@LazyManaged` See usage docs for instructions on complex sync objects

### Other changes

- `saveCustomPersistedData` & `loadCustomPersistedData` methods, and serialization of custom data types - See `ValueTransformer<T>` and `ValueTransformers` classes.
103 changes: 103 additions & 0 deletions docs/content/Development/Data-Sync-System/Usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: "Usage"
---

## Usage

### Registering classes with the sync system

At the core of the system is the interface `ISyncManaged`, which represents a class that to be synchronised with the client or saved.
All block entities which should be synchronised or saved must extend the abstract class `ManagedSyncBlockEntity`.

!!! warning
Block entities that inherit `ManagedSyncBlockEntity` must call `ManagedSyncBlockEntity::updateTick`***every tick*** within their ticker, or they will not be saved.

```java
class MySyncObject implements ISyncManaged {
// Any class that directly implements ISyncManaged must have the following:
@Getter
protected final SyncDataHolder syncDataHolder = new SyncDataHolder(this);


/**
* Function called when the SyncDataHolder requests a rerender
*/
void scheduleRenderUpdate();

/**
* Function called to notify the server that this object has been updated and must be synced to clients
*/
void markAsChanged();
}
```

### Registering fields to be managed by the system
See [Annotations](Annotations.md)

### Type compatibility
The following field types are supported by default:
- Any class implementing `ISyncManaged`
- Any class implementing `INBTSerializable<Tag>`
- All primitive types
- If `T`, `K` are supported types:
- `T[]`
- `Set<T>`
- `List<T>`,
- `Map<T, K>`
- `String`
- `ItemStack`
- `FluidStack`
- `UUID`
- `BlockPos`
- `CompoundTag`
- `GTRecipe`
- `GTRecipeType`
- `MachineRenderState`
- `Material`
- `Component`

### Adding support for additional types

The `ValueTransformer<T>` abstract class defines how a value of type `T` should be serialized.

To add support for an additional type, call `ValueTransformers.registerTransformer(Class<T> cls, ValueTransformer<T> transformer)` or `ValueTransformers.registerTransformerSupplier(Class<T> cls, Supplier<ValueTransformer<T>> func)`

Additionally, fields can be explicitly directed to use a specific value transformer:
```java
/**
* Example from HullMachine.java. This example shows serialization of an AE2 class which may or may not be loaded at runtime.
*/

@SaveField(nbtKey = "grid_node")
private final Object gridNodeHost;

private static class GridNodeHostTransformer implements ValueTransformer<Object> {

@Override
public Tag serializeNBT(Object value, TransformerContext<Object> context) {
if (GTCEu.Mods.isAE2Loaded() &&
(context.currentValue()) instanceof IGridConnectedBlockEntity connectedBlockEntity) {
var compound = new CompoundTag();
connectedBlockEntity.getMainNode().saveToNBT(compound);
return compound;
}
return new CompoundTag();
}

@Override
public @Nullable Object deserializeNBT(Tag tag, TransformerContext<Object> context) {
if (GTCEu.Mods.isAE2Loaded() &&
context.currentValue() instanceof IGridConnectedBlockEntity connectedBlockEntity &&
tag instanceof CompoundTag c) {
connectedBlockEntity.getMainNode().loadFromNBT(c);
}
return null;
}
}

static {
ClassSyncData.getClassData(HullMachine.class).setCustomTransformerForField("gridNodeHost",
new GridNodeHostTransformer());
}

```
12 changes: 12 additions & 0 deletions docs/content/Development/Data-Sync-System/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Data Sync/Save system "
---

# Data Sync/Save System

For serialising data to saves and synchronising with clients, a custom data sync system based on Java Annotations is used.

- See [Usage](Usage.md) for a guide on using the system
- See [Annotations](Annotations.md) for a list of annotations provided by the system
- See [Migrating From LDLib SyncData](Migrating-From-LDLib-SyncData.md) for instructions on how to migrate from the LDLib SyncData system, which was used in versions 7.x and lower.

5 changes: 0 additions & 5 deletions docs/content/Development/SyncData/.pages

This file was deleted.

6 changes: 0 additions & 6 deletions docs/content/Development/SyncData/Annotations/.pages

This file was deleted.

6 changes: 0 additions & 6 deletions docs/content/Development/SyncData/Annotations/DescSynced.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/content/Development/SyncData/Annotations/Persisted.md

This file was deleted.

This file was deleted.

This file was deleted.

50 changes: 0 additions & 50 deletions docs/content/Development/SyncData/Using-SyncData.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/content/Development/SyncData/index.md

This file was deleted.

Loading