Skip to content

Commit

Permalink
Added a model fallback to be used when (Neo)Forge cannot supply the c…
Browse files Browse the repository at this point in the history
…orrect ModelData during quad or particle requests (see neoforged/NeoForge#1629)
  • Loading branch information
ZeroNoRyouki committed Oct 27, 2024
1 parent 835bfc6 commit c17f9f8
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ public void build() {
"powerportfe_assembled_output", "powerportfe_assembled_output_connected");
this.addIoPort(Content.Blocks.ENERGIZER_COMPUTERPORT.get(), "computerport_assembled_disconnected",
"computerport_assembled_connected");

this.setFallbackModelData(Content.Blocks.ENERGIZER_CASING.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public FluidizerGlassModelBuilder() {

@Override
public void build() {

this.addGlass(Content.Blocks.FLUIDIZER_GLASS.get());
this.setFallbackModelData(Content.Blocks.FLUIDIZER_GLASS.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public void build() {
this.addIoPort(Content.Blocks.FLUIDIZER_SOLIDINJECTOR.get(), "solidinjector_connected");
this.addIoPort(Content.Blocks.FLUIDIZER_FLUIDINJECTOR.get(), "fluidinjector_connected");
this.addIoPort(Content.Blocks.FLUIDIZER_OUTPUTPORT.get(), "outputport_connected");

this.setFallbackModelData(Content.Blocks.FLUIDIZER_OUTPUTPORT.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ public void build() {
this.addCasing(Content.Blocks.FLUIDIZER_CASING.get());
this.addController(Content.Blocks.FLUIDIZER_CONTROLLER.get());
this.addIoPort(Content.Blocks.FLUIDIZER_POWERPORT.get());

this.setFallbackModelData(Content.Blocks.FLUIDIZER_CASING.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public Basic() {

@Override
public void build() {

this.addGlass(Content.Blocks.REACTOR_GLASS_BASIC.get());
this.setFallbackModelData(Content.Blocks.REACTOR_GLASS_BASIC.get());
}
}

Expand All @@ -48,7 +50,9 @@ public Reinforced() {

@Override
public void build() {

this.addGlass(Content.Blocks.REACTOR_GLASS_REINFORCED.get());
this.setFallbackModelData(Content.Blocks.REACTOR_GLASS_REINFORCED.get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void build() {
"accessport_solid_in_connected",
"accessport_solid_out",
"accessport_solid_out_connected");

this.setFallbackModelData(Content.Blocks.REACTOR_CASING_BASIC.get());
}
}

Expand Down Expand Up @@ -89,6 +91,8 @@ public void build() {
"fluidport_mekanism_passive_cold_connected",
"fluidport_mekanism_passive_hot",
"fluidport_mekanism_passive_hot_connected");

this.setFallbackModelData(Content.Blocks.REACTOR_CASING_REINFORCED.get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public ReprocessorGlassModelBuilder() {

@Override
public void build() {

this.addGlass(Content.Blocks.REPROCESSOR_GLASS.get());
this.setFallbackModelData(Content.Blocks.REPROCESSOR_GLASS.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ public void build() {

this.addIoPort(Content.Blocks.REPROCESSOR_COLLECTOR.get());
this.addIoPort(Content.Blocks.REPROCESSOR_WASTEINJECTOR.get(), "wasteinjector_connected");

this.setFallbackModelData(Content.Blocks.REPROCESSOR_COLLECTOR.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ public void build() {
this.addIoPort(Content.Blocks.REPROCESSOR_POWERPORT.get());
this.addIoPort(Content.Blocks.REPROCESSOR_FLUIDINJECTOR.get(), "fluidinjector_connected");
this.addIoPort(Content.Blocks.REPROCESSOR_OUTPUTPORT.get(), "outputport_connected");

this.setFallbackModelData(Content.Blocks.REPROCESSOR_CASING.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public Basic() {

@Override
public void build() {

this.addGlass(Content.Blocks.TURBINE_GLASS_BASIC.get());
this.setFallbackModelData(Content.Blocks.TURBINE_GLASS_BASIC.get());
}
}

Expand All @@ -48,7 +50,9 @@ public Reinforced() {

@Override
public void build() {

this.addGlass(Content.Blocks.TURBINE_GLASS_REINFORCED.get());
this.setFallbackModelData(Content.Blocks.TURBINE_GLASS_REINFORCED.get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void build() {
"fluidport_forge_passive_cold_connected",
"fluidport_forge_passive_hot",
"fluidport_forge_passive_hot_connected");

this.setFallbackModelData(Content.Blocks.TURBINE_CASING_BASIC.get());
}
}

Expand Down Expand Up @@ -82,6 +84,8 @@ public void build() {
"fluidport_forge_passive_cold_connected",
"fluidport_forge_passive_hot",
"fluidport_forge_passive_hot_connected");

this.setFallbackModelData(Content.Blocks.TURBINE_CASING_REINFORCED.get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void build() {

this.addBlade(Content.Blocks.TURBINE_ROTORBLADE_BASIC.get());
this.addShaft(Content.Blocks.TURBINE_ROTORSHAFT_BASIC.get());
this.setFallbackModelData(Content.Blocks.TURBINE_ROTORSHAFT_BASIC.get());
}
}

Expand All @@ -71,6 +72,7 @@ public void build() {

this.addBlade(Content.Blocks.TURBINE_ROTORBLADE_REINFORCED.get());
this.addShaft(Content.Blocks.TURBINE_ROTORSHAFT_REINFORCED.get());
this.setFallbackModelData(Content.Blocks.TURBINE_ROTORSHAFT_REINFORCED.get());
}
}

Expand Down Expand Up @@ -106,7 +108,7 @@ private <E extends Enum<E> & StringRepresentable> void addRotorComponent(Turbine

final var blockId = BuiltInRegistries.BLOCK.getKey(component);
final var originalModel = componentModelResourceLocation(blockId, defaultProperty);
final ModelResourceLocation[] additionalModels = new ModelResourceLocation[properties.length - 1+1];
final ModelResourceLocation[] additionalModels = new ModelResourceLocation[properties.length];

Arrays.setAll(additionalModels, idx -> componentModelResourceLocation(blockId, properties[idx]));
this.addBlock(component.getPartType().getByteHashCode(), originalModel, true, additionalModels);
Expand Down

0 comments on commit c17f9f8

Please sign in to comment.