Skip to content

Commit

Permalink
fix dyson crash
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Oct 23, 2023
1 parent 479f9fb commit 943e133
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- fix Dyson Sphere Casing recipe
- fix lang issues
- add Atomic Casing recipe
- fix dyson crash on fabric

0.0.2.a:
- fix fabric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ public interface IDysonSystem {

void tick();

void setDirty();
void setChanged();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void tick(ServerLevel level) {
}

timeNeededMaintenance++;
this.system.setDirty();
this.system.setChanged();
return;
}

Expand All @@ -59,13 +59,13 @@ public float getCollapseChance() {
public void needsMaintenance() {
this.needsMaintenance = true;
this.timeNeededMaintenance++;
this.system.setDirty();
this.system.setChanged();
}

public void fixMaintenance() {
this.needsMaintenance = false;
this.timeNeededMaintenance = 0;
this.system.setDirty();
this.system.setChanged();
}

public void setCollapsed() {
Expand All @@ -75,7 +75,7 @@ public void setCollapsed() {

private boolean calculateTime(int timeSinceLastTick) {
setTimeActive(timeSinceLastTick + getTimeActive());
this.system.setDirty();
this.system.setChanged();
var value = getTimeActive() - MINIMUM_MAINTENANCE_TIME;
if (value > 0) {
setTimeActive(value);
Expand All @@ -86,7 +86,7 @@ private boolean calculateTime(int timeSinceLastTick) {

public void setControllerPos(BlockPos controllerPos) {
this.controllerPos = controllerPos;
this.system.setDirty();
this.system.setChanged();
}

public void save(CompoundTag tag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public void tick() {
}
}

@Override
public void setChanged() {
this.setDirty();
}

public void load(CompoundTag arg) {
if (arg.contains("dysonSphere", Tag.TAG_COMPOUND)) {
this.currentActiveSunBlock = DysonSphere.load(arg.getCompound("dysonSphere"), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public static void init(RegistrateLangProvider provider) {
provider.add("metaitem.planet_id_circuit.id", "Currently selected planet: ");
provider.add("metaitem.planet_id_circuit.station", "To in-orbit space station (ID: %s)");

// materials

// machines
provider.add("gcys.machine.satellite_jammer.jammed", "Jammed %s");
provider.add("gcys.machine.satellite_jammer.position", "At %s");
Expand All @@ -71,6 +69,7 @@ public static void init(RegistrateLangProvider provider) {
provider.add("key.startRocket", "Start RocketEntity");
provider.add("key.categories.gcys", "Gregicality Space");

// GUIs
provider.add("menu.gcys.dyson_sphere.needs_maintenance", "DYSON SPHERE REQUIRES MAINTENANCE");
provider.add("menu.gcys.dyson_sphere.time_since_needed_maintenance", "Time since last maintenance: %s seconds");
provider.add("menu.gcys.dyson_sphere.implosion_chance", "Chance of implosion: %.2f%%");
Expand Down

0 comments on commit 943e133

Please sign in to comment.