Skip to content

Commit

Permalink
Add unique OrientedOverlayRenderers for multiblocks (#1630)
Browse files Browse the repository at this point in the history
* Add unique OrientedOverlayRenderers for multiblocks machines and generators
* Add new texture locations
* Move front render up the hierarchy to be able to apply to more multiblocks
* Re-add accidentally removed override

* Made frontOverlay final
Co-authored-by: LAGIdiot <bordel.muj@gmail.com>
  • Loading branch information
ALongStringOfNumbers authored May 31, 2021
1 parent 7ce6abd commit 486d5c3
Show file tree
Hide file tree
Showing 45 changed files with 161 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import gregtech.api.multiblock.IPatternCenterPredicate;
import gregtech.api.multiblock.PatternMatchContext;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.api.util.GTUtility;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
Expand All @@ -22,6 +24,7 @@
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nonnull;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Predicate;
Expand Down Expand Up @@ -72,6 +75,15 @@ public boolean shouldRenderOverlay(IMultiblockPart sourcePart) {
return true;
}

/**
* Override this method to change the Controller overlay
* @return The overlay to render on the Multiblock Controller
*/
@Nonnull
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.MULTIBLOCK_WORKABLE_OVERLAY;
}

public int getLightValueForPart(IMultiblockPart sourcePart) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import gregtech.api.multiblock.PatternMatchContext;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.api.util.GTUtility;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
Expand All @@ -26,7 +24,6 @@
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;

import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -161,13 +158,4 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation,
super.renderMetaTileEntity(renderState, translation, pipeline);
this.getFrontOverlay().render(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive());
}

/**
* Override this method to change the Controller overlay
* @return The overlay to render on the Multiblock Controller
*/
@Nonnull
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.MULTIBLOCK_WORKABLE_OVERLAY;
}
}
15 changes: 15 additions & 0 deletions src/main/java/gregtech/api/render/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ public class Textures {
public static OrientedOverlayRenderer PRIMITIVE_BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/primitive_blast_furnace", FRONT);
public static OrientedOverlayRenderer COKE_OVEN_OVERLAY = new OrientedOverlayRenderer("machines/coke_oven", FRONT);
public static OrientedOverlayRenderer MULTIBLOCK_WORKABLE_OVERLAY = new OrientedOverlayRenderer("machines/multiblock_workable", FRONT);
public static OrientedOverlayRenderer BLAST_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/blast_furnace", FRONT);
public static OrientedOverlayRenderer IMPLOSION_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("multiblock/implosion_compressor", FRONT);
public static OrientedOverlayRenderer MULTI_FURNACE_OVERLAY = new OrientedOverlayRenderer("multiblock/multi_furnace", FRONT);
public static OrientedOverlayRenderer PYROLYSE_OVEN_OVERLAY = new OrientedOverlayRenderer("multiblock/pyrolyse_oven", FRONT);
public static OrientedOverlayRenderer VACUUM_FREEZER_OVERLAY = new OrientedOverlayRenderer("multiblock/vacuum_freezer", FRONT);
public static OrientedOverlayRenderer DISTILLATION_TOWER_OVERLAY = new OrientedOverlayRenderer("multiblock/distillation_tower", FRONT);
public static OrientedOverlayRenderer CRACKING_UNIT_OVERLAY = new OrientedOverlayRenderer("multiblock/cracking_unit", FRONT);
public static OrientedOverlayRenderer DIESEL_ENGINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/diesel_engine", FRONT);
public static OrientedOverlayRenderer LARGE_STEAM_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_steam_turbine", FRONT);
public static OrientedOverlayRenderer LARGE_GAS_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_gas_turbine", FRONT);
public static OrientedOverlayRenderer LARGE_PLASMA_TURBINE_OVERLAY = new OrientedOverlayRenderer("multiblock/generator/large_plasma_turbine", FRONT);
public static OrientedOverlayRenderer LARGE_BRONZE_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_bronze_boiler", FRONT);
public static OrientedOverlayRenderer LARGE_STEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_steel_boiler", FRONT);
public static OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_titanium_boiler", FRONT);
public static OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_tungstensteel_boiler", FRONT);
public static LargeTurbineRenderer LARGE_TURBINE_ROTOR_RENDERER = new LargeTurbineRenderer();

public static OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer("machines/alloy_smelter", FRONT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.recipes.recipes.FuelRecipe;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.SimpleCubeRenderer;
import gregtech.api.render.Textures;
import gregtech.api.util.GTUtility;
Expand Down Expand Up @@ -54,6 +55,7 @@
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
Expand All @@ -74,28 +76,28 @@ public enum BoilerType {
MetaBlocks.BOILER_FIREBOX_CASING.getState(FireboxCasingType.BRONZE_FIREBOX),
MetaBlocks.BOILER_CASING.getState(BoilerCasingType.BRONZE_PIPE),
Textures.BRONZE_PLATED_BRICKS,
Textures.BRONZE_FIREBOX, Textures.BRONZE_FIREBOX_ACTIVE),
Textures.BRONZE_FIREBOX, Textures.BRONZE_FIREBOX_ACTIVE, Textures.LARGE_BRONZE_BOILER),

STEEL(1600, 1.6f, 30, 800,
MetaBlocks.METAL_CASING.getState(MetalCasingType.STEEL_SOLID),
MetaBlocks.BOILER_FIREBOX_CASING.getState(FireboxCasingType.STEEL_FIREBOX),
MetaBlocks.BOILER_CASING.getState(BoilerCasingType.STEEL_PIPE),
Textures.SOLID_STEEL_CASING,
Textures.STEEL_FIREBOX, Textures.STEEL_FIREBOX_ACTIVE),
Textures.STEEL_FIREBOX, Textures.STEEL_FIREBOX_ACTIVE, Textures.LARGE_STEEL_BOILER),

TITANIUM(3700, 3.0f, 31, 2000,
MetaBlocks.METAL_CASING.getState(MetalCasingType.TITANIUM_STABLE),
MetaBlocks.BOILER_FIREBOX_CASING.getState(FireboxCasingType.TITANIUM_FIREBOX),
MetaBlocks.BOILER_CASING.getState(BoilerCasingType.TITANIUM_PIPE),
Textures.STABLE_TITANIUM_CASING,
Textures.TITANIUM_FIREBOX, Textures.TITANIUM_FIREBOX_ACTIVE),
Textures.TITANIUM_FIREBOX, Textures.TITANIUM_FIREBOX_ACTIVE, Textures.LARGE_TITANIUM_BOILER),

TUNGSTENSTEEL(7800, 5.4f, 32, 4000,
MetaBlocks.METAL_CASING.getState(MetalCasingType.TUNGSTENSTEEL_ROBUST),
MetaBlocks.BOILER_FIREBOX_CASING.getState(FireboxCasingType.TUNGSTENSTEEL_FIREBOX),
MetaBlocks.BOILER_CASING.getState(BoilerCasingType.TUNGSTENSTEEL_PIPE),
Textures.ROBUST_TUNGSTENSTEEL_CASING,
Textures.TUNGSTENSTEEL_FIREBOX, Textures.TUNGSTENSTEEL_FIREBOX_ACTIVE);
Textures.TUNGSTENSTEEL_FIREBOX, Textures.TUNGSTENSTEEL_FIREBOX_ACTIVE, Textures.LARGE_TUNGSTENSTEEL_BOILER);

public final int baseSteamOutput;
public final float fuelConsumptionMultiplier;
Expand All @@ -107,7 +109,14 @@ public enum BoilerType {
public final ICubeRenderer solidCasingRenderer;
public final SimpleCubeRenderer fireboxIdleRenderer;
public final SimpleCubeRenderer firefoxActiveRenderer;

public final OrientedOverlayRenderer frontOverlay;

/**
* @deprecated use {@link BoilerType#BoilerType(int, float, int, int, IBlockState, IBlockState, IBlockState, ICubeRenderer, SimpleCubeRenderer, SimpleCubeRenderer, OrientedOverlayRenderer)}
* Deprecated for use due to new constructor accepting a front overlay texture
* Left in place for compatibility with addon mods
*/
@Deprecated
BoilerType(int baseSteamOutput, float fuelConsumptionMultiplier, int temperatureEffBuff, int maxTemperature, IBlockState casingState, IBlockState fireboxState, IBlockState pipeState,
ICubeRenderer solidCasingRenderer, SimpleCubeRenderer fireboxIdleRenderer, SimpleCubeRenderer firefoxActiveRenderer) {
this.baseSteamOutput = baseSteamOutput;
Expand All @@ -120,6 +129,22 @@ public enum BoilerType {
this.solidCasingRenderer = solidCasingRenderer;
this.fireboxIdleRenderer = fireboxIdleRenderer;
this.firefoxActiveRenderer = firefoxActiveRenderer;
this.frontOverlay = Textures.MULTIBLOCK_WORKABLE_OVERLAY;
}

BoilerType(int baseSteamOutput, float fuelConsumptionMultiplier, int temperatureEffBuff, int maxTemperature, IBlockState casingState, IBlockState fireboxState, IBlockState pipeState,
ICubeRenderer solidCasingRenderer, SimpleCubeRenderer fireboxIdleRenderer, SimpleCubeRenderer firefoxActiveRenderer, OrientedOverlayRenderer frontOverlay) {
this.baseSteamOutput = baseSteamOutput;
this.fuelConsumptionMultiplier = fuelConsumptionMultiplier;
this.temperatureEffBuff = temperatureEffBuff;
this.maxTemperature = maxTemperature;
this.casingState = casingState;
this.fireboxState = fireboxState;
this.pipeState = pipeState;
this.solidCasingRenderer = solidCasingRenderer;
this.fireboxIdleRenderer = fireboxIdleRenderer;
this.firefoxActiveRenderer = firefoxActiveRenderer;
this.frontOverlay = frontOverlay;
}
}

Expand Down Expand Up @@ -419,7 +444,13 @@ protected BlockPattern createStructurePattern() {
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
Textures.MULTIBLOCK_WORKABLE_OVERLAY.render(renderState, translation, pipeline, getFrontFacing(), isActive);
this.getFrontOverlay().render(renderState, translation, pipeline, getFrontFacing(), isActive);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return boilerType.frontOverlay;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import gregtech.api.multiblock.FactoryBlockPattern;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMetalCasing;
import gregtech.common.blocks.BlockWireCoil.CoilType;
import gregtech.common.blocks.MetaBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;

import javax.annotation.Nonnull;

public class MetaTileEntityCrackingUnit extends RecipeMapMultiblockController {

private static final MultiblockAbility<?>[] ALLOWED_ABILITIES = {
Expand Down Expand Up @@ -59,4 +62,10 @@ protected IBlockState getCoilState() {
protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.STAINLESS_CLEAN);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.CRACKING_UNIT_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import gregtech.api.multiblock.PatternMatchContext;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType;
import gregtech.common.blocks.MetaBlocks;
Expand All @@ -20,6 +21,7 @@
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.fluids.FluidStack;

import javax.annotation.Nonnull;
import java.util.List;
import java.util.function.Predicate;

Expand Down Expand Up @@ -80,4 +82,9 @@ protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(MetalCasingType.STAINLESS_CLEAN);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.DISTILLATION_TOWER_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType;
import gregtech.common.blocks.BlockWireCoil;
Expand All @@ -22,6 +23,7 @@
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;

import javax.annotation.Nonnull;
import java.util.List;
import java.util.function.Predicate;

Expand Down Expand Up @@ -106,4 +108,9 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.HEAT_PROOF_CASING;
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.BLAST_FURNACE_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import gregtech.api.multiblock.FactoryBlockPattern;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType;
import gregtech.common.blocks.MetaBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;

import javax.annotation.Nonnull;

public class MetaTileEntityImplosionCompressor extends RecipeMapMultiblockController {

private static final MultiblockAbility<?>[] ALLOWED_ABILITIES = {
Expand Down Expand Up @@ -54,4 +57,9 @@ protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(MetalCasingType.STEEL_SOLID);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.IMPLOSION_COMPRESSOR_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.util.text.*;
import net.minecraftforge.items.*;

import javax.annotation.Nonnull;
import java.util.*;

public class MetaTileEntityMultiFurnace extends RecipeMapMultiblockController {
Expand Down Expand Up @@ -86,6 +87,12 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.HEAT_PROOF_CASING;
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.MULTI_FURNACE_OVERLAY;
}

protected class MultiFurnaceWorkable extends MultiblockRecipeLogic {

public MultiFurnaceWorkable(RecipeMapMultiblockController tileEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import gregtech.api.multiblock.FactoryBlockPattern;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMachineCasing.MachineCasingType;
import gregtech.common.blocks.BlockWireCoil.CoilType;
import gregtech.common.blocks.MetaBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;

import javax.annotation.Nonnull;

public class MetaTileEntityPyrolyseOven extends RecipeMapMultiblockController {

private static final MultiblockAbility<?>[] ALLOWED_ABILITIES = {
Expand Down Expand Up @@ -56,4 +59,9 @@ protected IBlockState getCasingState() {
return MetaBlocks.MACHINE_CASING.getState(MachineCasingType.ULV);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.PYROLYSE_OVEN_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import gregtech.api.multiblock.FactoryBlockPattern;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.render.ICubeRenderer;
import gregtech.api.render.OrientedOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType;
import gregtech.common.blocks.MetaBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;

import javax.annotation.Nonnull;

public class MetaTileEntityVacuumFreezer extends RecipeMapMultiblockController {

private static final MultiblockAbility<?>[] ALLOWED_ABILITIES = {
Expand Down Expand Up @@ -55,4 +58,9 @@ protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(MetalCasingType.ALUMINIUM_FROSTPROOF);
}

@Nonnull
@Override
protected OrientedOverlayRenderer getFrontOverlay() {
return Textures.VACUUM_FREEZER_OVERLAY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase;
import gregtech.api.multiblock.PatternMatchContext;
import gregtech.api.recipes.machines.FuelRecipeMap;
import gregtech.api.render.Textures;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
Expand Down Expand Up @@ -98,7 +97,7 @@ protected boolean checkStructureComponents(List<IMultiblockPart> parts, Map<Mult
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
Textures.MULTIBLOCK_WORKABLE_OVERLAY.render(renderState, translation, pipeline, getFrontFacing(),
this.getFrontOverlay().render(renderState, translation, pipeline, getFrontFacing(),
isStructureFormed() && workableHandler.isActive());
}
}
Loading

0 comments on commit 486d5c3

Please sign in to comment.