Skip to content

Commit 4072317

Browse files
authored
Move all model properties to a central class (#3499)
1 parent 89071b4 commit 4072317

39 files changed

Lines changed: 235 additions & 165 deletions

src/generated/resources/assets/gtceu/models/block/machine/configurable_maintenance_hatch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"side"
99
],
1010
"variants": {
11-
"maintenance_taped=false": {
11+
"taped=false": {
1212
"model": {
1313
"parent": "gtceu:block/machine/part/configurable_maintenance_hatch",
1414
"textures": {
@@ -18,7 +18,7 @@
1818
}
1919
}
2020
},
21-
"maintenance_taped=true": {
21+
"taped=true": {
2222
"model": {
2323
"parent": "gtceu:block/machine/part/configurable_maintenance_hatch",
2424
"textures": {

src/generated/resources/assets/gtceu/models/block/machine/maintenance_hatch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"side"
99
],
1010
"variants": {
11-
"maintenance_taped=false": {
11+
"taped=false": {
1212
"model": {
1313
"parent": "gtceu:block/machine/part/maintenance_hatch",
1414
"textures": {
@@ -18,7 +18,7 @@
1818
}
1919
}
2020
},
21-
"maintenance_taped=true": {
21+
"taped=true": {
2222
"model": {
2323
"parent": "gtceu:block/machine/part/maintenance_hatch",
2424
"textures": {

src/main/java/com/gregtechceu/gtceu/api/blockentity/IPaintable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.gregtechceu.gtceu.api.blockentity;
22

3+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
4+
35
import net.minecraft.world.level.block.state.properties.BooleanProperty;
46

57
public interface IPaintable {
68

7-
BooleanProperty IS_PAINTED_PROPERTY = BooleanProperty.create("is_painted");
9+
BooleanProperty IS_PAINTED_PROPERTY = GTMachineModelProperties.IS_PAINTED;
810
int UNPAINTED_COLOR = 0xffffffff;
911

1012
/**

src/main/java/com/gregtechceu/gtceu/api/capability/IControllable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.gregtechceu.gtceu.api.capability;
22

3+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
4+
35
import net.minecraft.world.level.block.state.properties.BooleanProperty;
46

57
public interface IControllable {
68

7-
BooleanProperty WORKING_ENABLED_PROPERTY = BooleanProperty.create("working_enabled");
9+
BooleanProperty WORKING_ENABLED_PROPERTY = GTMachineModelProperties.IS_WORKING_ENABLED;
810

911
/**
1012
* @return true if the controllable is allowed to work

src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComponentHatch.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.gregtechceu.gtceu.api.capability;
22

3+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
4+
35
import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture;
46

57
import net.minecraft.world.level.block.state.properties.BooleanProperty;
68

79
public interface IHPCAComponentHatch {
810

9-
BooleanProperty HPCA_PART_DAMAGED_PROPERTY = BooleanProperty.create("hpca_part_damaged");
11+
BooleanProperty HPCA_PART_DAMAGED_PROPERTY = GTMachineModelProperties.IS_HPCA_PART_DAMAGED;
1012

1113
/**
1214
* How much EU/t this component needs for the multi to just be idle.

src/main/java/com/gregtechceu/gtceu/api/capability/IWorkable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.gregtechceu.gtceu.api.capability;
22

3+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
4+
35
import net.minecraft.world.level.block.state.properties.BooleanProperty;
46

57
/**
68
* For machines which have progress and can work
79
*/
810
public interface IWorkable extends IControllable {
911

10-
BooleanProperty ACTIVE_PROPERTY = BooleanProperty.create("active");
12+
BooleanProperty ACTIVE_PROPERTY = GTMachineModelProperties.IS_ACTIVE;
1113

1214
/**
1315
* @return current progress of machine

src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.gregtechceu.gtceu.api.item.tool.IToolGridHighlight;
2020
import com.gregtechceu.gtceu.api.machine.feature.*;
2121
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart;
22+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
2223
import com.gregtechceu.gtceu.api.machine.trait.MachineTrait;
2324
import com.gregtechceu.gtceu.api.misc.IOFilteredInvWrapper;
2425
import com.gregtechceu.gtceu.api.misc.IOFluidHandlerList;
@@ -192,8 +193,8 @@ public void setPaintingColor(int color) {
192193
this.onPaintingColorChanged(color);
193194

194195
MachineRenderState renderState = getRenderState();
195-
if (renderState.hasProperty(IS_PAINTED_PROPERTY)) {
196-
setRenderState(renderState.setValue(IS_PAINTED_PROPERTY, this.isPainted()));
196+
if (renderState.hasProperty(GTMachineModelProperties.IS_PAINTED)) {
197+
setRenderState(renderState.setValue(GTMachineModelProperties.IS_PAINTED, this.isPainted()));
197198
}
198199
}
199200

@@ -225,11 +226,10 @@ public void onLoad() {
225226
coverContainer.onLoad();
226227

227228
// update the painted model property if the machine is painted
228-
if (this.isPainted()) {
229-
MachineRenderState renderState = getRenderState();
230-
if (renderState.hasProperty(IS_PAINTED_PROPERTY) && !renderState.getValue(IS_PAINTED_PROPERTY)) {
231-
setRenderState(renderState.setValue(IS_PAINTED_PROPERTY, true));
232-
}
229+
MachineRenderState renderState = getRenderState();
230+
if (renderState.hasProperty(GTMachineModelProperties.IS_PAINTED) &&
231+
this.isPainted() != renderState.getValue(GTMachineModelProperties.IS_PAINTED)) {
232+
setRenderState(renderState.setValue(GTMachineModelProperties.IS_PAINTED, this.isPainted()));
233233
}
234234
}
235235

src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExhaustVentMachine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.gregtechceu.gtceu.api.machine.feature;
22

33
import com.gregtechceu.gtceu.GTCEu;
4+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
45
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
56
import com.gregtechceu.gtceu.common.data.GTDamageTypes;
67
import com.gregtechceu.gtceu.config.ConfigHolder;
@@ -29,8 +30,7 @@
2930
*/
3031
public interface IExhaustVentMachine extends IMachineFeature {
3132

32-
EnumProperty<RelativeDirection> VENT_DIRECTION_PROPERTY = EnumProperty.create("steam_vent",
33-
RelativeDirection.class);
33+
EnumProperty<RelativeDirection> VENT_DIRECTION_PROPERTY = GTMachineModelProperties.VENT_DIRECTION;
3434

3535
/**
3636
* @return the direction the vent faces

src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMaintenanceMachine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.gregtechceu.gtceu.api.gui.GuiTextures;
55
import com.gregtechceu.gtceu.api.gui.fancy.IFancyTooltip;
66
import com.gregtechceu.gtceu.api.gui.fancy.TooltipsPanel;
7+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
78
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
89
import com.gregtechceu.gtceu.config.ConfigHolder;
910

@@ -16,7 +17,7 @@
1617

1718
public interface IMaintenanceMachine extends IMultiPart {
1819

19-
BooleanProperty MAINTENANCE_TAPED_PROPERTY = BooleanProperty.create("maintenance_taped");
20+
BooleanProperty MAINTENANCE_TAPED_PROPERTY = GTMachineModelProperties.IS_TAPED;
2021
int MINIMUM_MAINTENANCE_TIME = 3456000; // 48 real-life hours = 3456000 ticks
2122
byte ALL_PROBLEMS = 0;
2223
byte NO_PROBLEMS = 0b111111;

src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine;
55
import com.gregtechceu.gtceu.api.machine.feature.IMachineFeature;
66
import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine;
7+
import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties;
78
import com.gregtechceu.gtceu.api.pattern.BlockPattern;
89
import com.gregtechceu.gtceu.api.pattern.MultiblockState;
910
import com.gregtechceu.gtceu.client.renderer.MultiblockInWorldPreviewRenderer;
@@ -29,7 +30,7 @@
2930

3031
public interface IMultiController extends IMachineFeature, IInteractedMachine {
3132

32-
BooleanProperty IS_FORMED_PROPERTY = BooleanProperty.create("is_formed");
33+
BooleanProperty IS_FORMED_PROPERTY = GTMachineModelProperties.IS_FORMED;
3334

3435
@Override
3536
default MultiblockControllerMachine self() {

0 commit comments

Comments
 (0)