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 26, 2024
1 parent b2a4686 commit fdf8659
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import it.zerono.mods.extremereactors.ExtremeReactors;
import it.zerono.mods.extremereactors.gamecontent.multiblock.energizer.EnergizerPartType;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import it.zerono.mods.zerocore.lib.client.model.multiblock.CuboidPartVariantsModelBuilder;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -83,6 +84,8 @@ protected void build() {
this.addBlockWithVariants(modelToReplaceIdGetter, variantModelIdGetter, EnergizerPartType.ComputerPort,
"computerport", "computerport_assembled_disconnected",
"computerport_assembled_connected");

this.setFallbackModelData(EnergizerPartType.Casing.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public FluidizerGlassModelBuilder() {
for (final BlockFacingsProperty facing : BlockFacingsProperty.values()) {
this.addVariant(FluidizerPartType.Glass.ordinal(), getBlockStateRL(facing));
}

this.setFallbackModelData(FluidizerPartType.Glass.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import it.zerono.mods.extremereactors.ExtremeReactors;
import it.zerono.mods.extremereactors.gamecontent.multiblock.fluidizer.FluidizerPartType;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import it.zerono.mods.zerocore.lib.client.model.multiblock.CuboidPartVariantsModelBuilder;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -79,6 +80,8 @@ protected void build() {
"fluidinjector", "fluidinjector_connected");
this.addBlockWithVariants(modelToReplaceIdGetter, variantModelIdGetter, FluidizerPartType.OutputPort,
"outputport", "outputport_connected");

this.setFallbackModelData(FluidizerPartType.Casing.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public ReactorGlassModelBuilder(final IMultiblockReactorVariant variant) {
for (final BlockFacingsProperty facing : BlockFacingsProperty.values()) {
this.addVariant(ReactorPartType.Glass.ordinal(), getBlockStateRL(variant, facing));
}

this.setFallbackModelData(ReactorPartType.Glass.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import it.zerono.mods.extremereactors.gamecontent.multiblock.reactor.IReactorPartType;
import it.zerono.mods.extremereactors.gamecontent.multiblock.reactor.ReactorPartType;
import it.zerono.mods.extremereactors.gamecontent.multiblock.reactor.variant.ReactorVariant;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import it.zerono.mods.zerocore.lib.data.ResourceLocationBuilder;

import java.util.Set;
Expand Down Expand Up @@ -115,5 +116,7 @@ private ReactorModelBuilder(ReactorVariant variant, ResourceLocationBuilder root
"redstoneport_on");

this.addBlockWithVariants(ReactorPartType.ChargingPortFE, variant, isPartCompatible, "chargingportfe");

this.setFallbackModelData(ReactorPartType.Casing.ordinal(), BlockFacingsProperty.None.ordinal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public ReprocessorGlassModelBuilder() {
for (final BlockFacingsProperty facing : BlockFacingsProperty.values()) {
this.addVariant(ReprocessorPartType.Glass.ordinal(), getBlockStateRL(facing));
}

this.setFallbackModelData(ReprocessorPartType.Glass.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import it.zerono.mods.extremereactors.ExtremeReactors;
import it.zerono.mods.extremereactors.gamecontent.multiblock.reprocessor.ReprocessorPartType;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;

Expand All @@ -44,5 +45,7 @@ protected void build() {
"wasteinjector", "wasteinjector_connected");
this.addBlockWithVariants(modelToReplaceIdGetter, variantModelIdGetter, ReprocessorPartType.Collector,
"collector");

this.setFallbackModelData(ReprocessorPartType.WasteInjector.ordinal(), BlockFacingsProperty.None.ordinal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import it.zerono.mods.extremereactors.ExtremeReactors;
import it.zerono.mods.extremereactors.gamecontent.multiblock.reprocessor.ReprocessorPartType;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import it.zerono.mods.zerocore.lib.client.model.multiblock.CuboidPartVariantsModelBuilder;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -79,6 +80,8 @@ protected void build() {
"fluidinjector", "fluidinjector_connected");
this.addBlockWithVariants(modelToReplaceIdGetter, variantModelIdGetter, ReprocessorPartType.OutputPort,
"outputport", "outputport_connected");

this.setFallbackModelData(ReprocessorPartType.Casing.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public TurbineGlassModelBuilder(final IMultiblockTurbineVariant variant) {
for (final BlockFacingsProperty facing : BlockFacingsProperty.values()) {
this.addVariant(TurbinePartType.Glass.ordinal(), getBlockStateRL(variant, facing));
}

this.setFallbackModelData(TurbinePartType.Glass.ordinal(), BlockFacingsProperty.None.ordinal());
}

//region internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import it.zerono.mods.extremereactors.gamecontent.multiblock.common.client.model.AbstractMultiblockModelBuilder;
import it.zerono.mods.extremereactors.gamecontent.multiblock.turbine.TurbinePartType;
import it.zerono.mods.extremereactors.gamecontent.multiblock.turbine.variant.TurbineVariant;
import it.zerono.mods.zerocore.lib.block.property.BlockFacingsProperty;
import it.zerono.mods.zerocore.lib.data.ResourceLocationBuilder;

import java.util.function.Predicate;
Expand Down Expand Up @@ -93,5 +94,7 @@ private TurbineModelBuilder(TurbineVariant variant, ResourceLocationBuilder root
"redstoneport_on");

this.addBlockWithVariants(TurbinePartType.ChargingPortFE, variant, isPartCompatible, "chargingportfe");

this.setFallbackModelData(TurbinePartType.Casing.ordinal(), BlockFacingsProperty.None.ordinal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public TurbineRotorModelBuilder(final IMultiblockTurbineVariant variant) {
for (final RotorShaftState state : RotorShaftState.VALUES) {
this.addVariant(TurbinePartType.RotorShaft.ordinal(), getBlockStateRL(variant, state));
}

this.setFallbackModelData(TurbinePartType.RotorShaft.ordinal(), RotorShaftState.Y_NOBLADES.ordinal());
}

public static ResourceLocation getBlockStateRL(final IMultiblockTurbineVariant variant, final RotorBladeState blockStateVariant) {
Expand Down

0 comments on commit fdf8659

Please sign in to comment.