mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-12 00:07:29 +00:00
Add colored interfaces textures (#466)
This commit is contained in:
1 parent
3c6a5d8933
commit
47300b8980
50 files changed
+55
-9
No files matched your search
@@ -9,6 +9,7 @@ import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.block.BlockFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
@@ -25,15 +26,18 @@ public class RenderBlockFluidInterface extends BaseBlockRender<BlockFluidInterfa
|
||||
final TileInterface ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if (ti != null && ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon side = FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon();
|
||||
info.setTemporaryRenderIcons(
|
||||
FCPartsTexture.BlockInterfaceAlternate.getIcon(),
|
||||
block.getIcon(0, 0),
|
||||
side,
|
||||
side,
|
||||
side,
|
||||
side);
|
||||
if (ti != null) {
|
||||
final AEColor color = ti.getProxy().getColor();
|
||||
if (ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon face = color == AEColor.Transparent ? block.getIcon(0, 0)
|
||||
: block.getColoredTexture(0, color);
|
||||
final IIcon alternate = color == AEColor.Transparent ? FCPartsTexture.BlockInterfaceAlternate.getIcon()
|
||||
: block.getColoredTexture(1, color);
|
||||
final IIcon side = color == AEColor.Transparent
|
||||
? FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon()
|
||||
: block.getColoredTexture(2, color);
|
||||
info.setTemporaryRenderIcons(alternate, face, side, side, side, side);
|
||||
}
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
|
||||
@@ -4,7 +4,10 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -13,6 +16,7 @@ import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -25,6 +29,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFluidInterface extends FCBaseBlock {
|
||||
|
||||
private static final String[] COLORED_TEXTURES = { "fluid_interface", "fluid_interface_a",
|
||||
"fluid_interface_arrow" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] coloredTextures;
|
||||
|
||||
public BlockFluidInterface() {
|
||||
super(Material.iron, NameConst.BLOCK_FLUID_INTERFACE);
|
||||
setFullBlock(true);
|
||||
@@ -39,6 +49,38 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
return new RenderBlockFluidInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister iconRegistry) {
|
||||
super.registerBlockIcons(iconRegistry);
|
||||
this.coloredTextures = new IIcon[COLORED_TEXTURES.length][AEColor.VALUES.length];
|
||||
|
||||
for (final AEColor color : AEColor.VALID_COLORS) {
|
||||
for (int id = 0; id < COLORED_TEXTURES.length; id++) {
|
||||
this.coloredTextures[id][color.ordinal()] = iconRegistry
|
||||
.registerIcon("ae2fc:interface/" + COLORED_TEXTURES[id] + "_" + color.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getColoredTexture(final int id, final AEColor color) {
|
||||
return this.coloredTextures[id][color.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileInterface tile = this.getTileEntity(world, x, y, z);
|
||||
if (tile != null && tile.getForward() == ForgeDirection.UNKNOWN) {
|
||||
final AEColor color = tile.getProxy().getColor();
|
||||
if (color != AEColor.Transparent) {
|
||||
return this.getColoredTexture(0, color);
|
||||
}
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
|
||||
final int facing, final float hitX, final float hitY, final float hitZ) {
|
||||
|
||||
Reference in new issue
Block a user