Improved item rendering

This commit is contained in:
LemADEC 2016-01-14 01:20:16 +01:00
parent 65a0ee442a
commit 5b2a02f6b7
12 changed files with 158 additions and 36 deletions

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -36,7 +37,8 @@ public class BlockLaserMedium extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0 || side == 1) {
return iconBuffer[8];
}
@ -44,6 +46,15 @@ public class BlockLaserMedium extends BlockContainer {
return iconBuffer[Math.min(metadata, 7)];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[8];
}
return iconBuffer[6];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLaserMedium();

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -48,7 +49,8 @@ public class BlockLaserTreeFarm extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
}
@ -61,6 +63,17 @@ public class BlockLaserTreeFarm extends BlockContainer {
return null;
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
}
if (side == 1) {
return iconBuffer[ICON_TOP];
}
return iconBuffer[ICON_PLANTINGLOWPOWER];
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityLaserTreeFarm();

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -44,7 +45,8 @@ public class BlockMiningLaser extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
}
@ -57,6 +59,17 @@ public class BlockMiningLaser extends BlockContainer {
return null;
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
}
if (side == 1) {
return iconBuffer[ICON_TOP];
}
return iconBuffer[ICON_SCANNINGLOWPOWER];
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMiningLaser();

View file

@ -11,6 +11,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -33,7 +34,8 @@ public class BlockCloakingCore extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata < iconBuffer.length) {
return iconBuffer[metadata];
}
@ -41,6 +43,11 @@ public class BlockCloakingCore extends BlockContainer {
return null;
}
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[1];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityCloakingCore();

View file

@ -30,8 +30,8 @@ public class BlockMonitor extends BlockContainer {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int meta = world.getBlockMetadata(x, y, z);
return side == meta ? iconFront : iconSide;
int metadata = world.getBlockMetadata(x, y, z);
return side == metadata ? iconFront : iconSide;
}
@Override

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -41,7 +42,8 @@ public class BlockRadar extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -59,6 +61,18 @@ public class BlockRadar extends BlockContainer {
return iconBuffer[ICON_SIDE_INACTIVE];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
// return iconBuffer[ICON_SIDE_ACTIVATED];
return iconBuffer[ICON_SIDE_ACTIVATED_SCAN];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityRadar();

View file

@ -6,6 +6,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockEnanReactorCore extends BlockAbstractContainer {
@ -36,16 +37,25 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
}
@Override
public IIcon getIcon(int side, int meta) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0 || side == 1) {
return iconBuffer[16];
}
if (meta >= 0 && meta < 16) {
return iconBuffer[meta];
if (metadata >= 0 && metadata < 16) {
return iconBuffer[metadata];
}
return iconBuffer[0];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[16];
}
return iconBuffer[7];
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer[16] = par1IconRegister.registerIcon("warpdrive:energy/enanReactorCoreTopBottom");

View file

@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockEnanReactorLaser extends BlockAbstractContainer {
@ -41,12 +42,26 @@ public class BlockEnanReactorLaser extends BlockAbstractContainer {
}
@Override
public IIcon getIcon(int side, int meta) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0 || side == 1) {
return iconBuffer[0];
}
if (isActive(side, meta)) {
if (isActive(side, metadata)) {
return iconBuffer[2];
}
return iconBuffer[1];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[0];
}
if (side == 4) {
return iconBuffer[2];
}

View file

@ -51,12 +51,13 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {// TODO
@Override
public IIcon getIcon(int side, int metadata) {
return iconBuffer[1];
if (side == 4) {
return iconBuffer[1];
} else {
return iconBuffer[0];
}
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {

View file

@ -10,13 +10,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
public class BlockLift extends BlockContainer
{
private IIcon[] iconBuffer;
public BlockLift() {
super(Material.rock);
setHardness(0.5F);
@ -24,7 +25,7 @@ public class BlockLift extends BlockContainer
setCreativeTab(WarpDrive.creativeTabWarpDrive);
this.setBlockName("warpdrive.movement.Lift");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[6];
@ -35,9 +36,10 @@ public class BlockLift extends BlockContainer
iconBuffer[4] = par1IconRegister.registerIcon("warpdrive:movement/liftUpOut");
iconBuffer[5] = par1IconRegister.registerIcon("warpdrive:movement/liftUpIn");
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata > 2) {
return iconBuffer[0];
}
@ -50,34 +52,43 @@ public class BlockLift extends BlockContainer
return iconBuffer[6 - metadata];
}
}
return iconBuffer[metadata];
}
@Override
public IIcon getIcon(int side, int metadata) {
if (metadata > 2) {
return iconBuffer[0];
}
if (side == 1) {
return iconBuffer[3 + 1];
} else if (side == 0) {
if (metadata == 0) {
return iconBuffer[3];
} else {
return iconBuffer[6 - 1];
}
}
return iconBuffer[1];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLift();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -50,7 +51,8 @@ public class BlockShipController extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -68,6 +70,17 @@ public class BlockShipController extends BlockContainer {
return null;
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
return iconBuffer[ICON_SIDE_ACTIVATED + 5];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipController();

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
@ -37,7 +38,8 @@ public class BlockShipCore extends BlockContainer {
}
@Override
public IIcon getIcon(int side, int metadata) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
@ -55,6 +57,18 @@ public class BlockShipCore extends BlockContainer {
return null;
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return iconBuffer[ICON_BOTTOM];
} else if (side == 1) {
return iconBuffer[ICON_TOP];
}
// return iconBuffer[ICON_SIDE_ACTIVATED];
return iconBuffer[ICON_SIDE_HEATED];
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipCore();