mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 03:49:31 +00:00
Add buffer textures
This commit is contained in:
1 parent
4b16659e6c
commit
efbbffde76
5 files changed
+24
-12
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -3,6 +3,7 @@ package crazypants.enderio.machine.buffer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -16,6 +17,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -35,10 +37,13 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
res.init();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
private static final String[] textureNames = new String[] { "blockBufferItem", "blockBufferPower", "blockBufferOmni", "blockBufferCreative" };
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] textures;
|
||||
|
||||
private BlockBuffer() {
|
||||
super(ModObject.blockBuffer, TileBuffer.class);
|
||||
setBlockTextureName("enderio:blockBuffer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,22 +76,27 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
protected int getGuiId() {
|
||||
return GuiHandler.GUI_ID_BUFFER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iIconRegister) {
|
||||
super.registerBlockIcons(iIconRegister);
|
||||
textures = new IIcon[textureNames.length];
|
||||
for (int i = 0; i < textureNames.length; i++) {
|
||||
textures[i] = iIconRegister.registerIcon("enderio:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMachineFrontIconKey(boolean active) {
|
||||
return this.textureName;
|
||||
return getSideIconKey(active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackIconKey(boolean active) {
|
||||
return getMachineFrontIconKey(active);
|
||||
public IIcon getIcon(int blockSide, int blockMeta) {
|
||||
return blockSide > 1 ? textures[blockMeta] : super.getIcon(blockSide, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSideIconKey(boolean active) {
|
||||
return getMachineFrontIconKey(active);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
@@ -94,6 +104,8 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
TileBuffer tef = (TileBuffer) te;
|
||||
if(tef.getSourceBlock() != null) {
|
||||
return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata());
|
||||
} else if (blockSide > 1){
|
||||
return textures[world.getBlockMetadata(x, y, z)];
|
||||
}
|
||||
}
|
||||
return super.getIcon(world, x, y, z, blockSide);
|
||||
|
||||
Reference in new issue
Block a user