-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...lied_energistics/providers/virtualdisk/actions/preferredstorage/PreferredStoragePair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.preferredstorage; | ||
|
||
import net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.Pair; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class PreferredStoragePair extends Pair<PreferredStorageRequest, PreferredStorageResponse> { | ||
public PreferredStoragePair(PreferredStorageRequest request, CompletableFuture<PreferredStorageResponse> responseFuture) { | ||
super(request, responseFuture); | ||
} | ||
|
||
public PreferredStoragePair(PreferredStorageRequest request) { | ||
super(request); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...d_energistics/providers/virtualdisk/actions/preferredstorage/PreferredStorageRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.preferredstorage; | ||
|
||
import appeng.api.stacks.AEKey; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.Request; | ||
|
||
public class PreferredStorageRequest extends Request { | ||
private AEKey data; | ||
|
||
public PreferredStorageRequest(AEKey data) { | ||
this.data = data; | ||
} | ||
|
||
public PreferredStorageRequest(byte[] bytes, AEKey data) throws Exception { | ||
super(bytes); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
protected void saveData(CompoundTag compoundTag) { | ||
compoundTag.put("what", data.toTagGeneric()); | ||
} | ||
|
||
@Override | ||
protected void loadData(CompoundTag compoundTag) { | ||
data = AEKey.fromTagGeneric(compoundTag.getCompound("what")); | ||
} | ||
|
||
public AEKey getWhat() { | ||
return data; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
..._energistics/providers/virtualdisk/actions/preferredstorage/PreferredStorageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.preferredstorage; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
import net.nussi.dedicated_applied_energistics.providers.virtualdisk.actions.Response; | ||
|
||
public class PreferredStorageResponse extends Response { | ||
private boolean data; | ||
|
||
public PreferredStorageResponse(String id, boolean success, boolean data) { | ||
super(id, success); | ||
this.data = data; | ||
} | ||
|
||
public PreferredStorageResponse(byte[] bytes) throws Exception { | ||
super(bytes); | ||
} | ||
|
||
@Override | ||
protected void saveData(CompoundTag compoundTag) { | ||
compoundTag.putBoolean("data", data); | ||
} | ||
|
||
@Override | ||
protected void loadData(CompoundTag compoundTag) { | ||
data = compoundTag.getBoolean("data"); | ||
} | ||
|
||
public boolean getData() { | ||
return data; | ||
} | ||
} |