Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand All @@ -25,15 +26,18 @@ public boolean renderInWorld(final BlockFluidInterface block, final IBlockAccess
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

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;

Expand All @@ -13,6 +16,7 @@
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;
Expand All @@ -25,6 +29,12 @@

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);
Expand All @@ -39,6 +49,38 @@ protected RenderBlockFluidInterface getRenderer() {
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) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading