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

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -48,7 +49,8 @@ public class BlockLaserTreeFarm extends BlockContainer {
} }
@Override @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) { if (side == 0) {
return iconBuffer[ICON_BOTTOM]; return iconBuffer[ICON_BOTTOM];
} }
@ -61,6 +63,17 @@ public class BlockLaserTreeFarm extends BlockContainer {
return null; 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 @Override
public TileEntity createNewTileEntity(World world, int i) { public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityLaserTreeFarm(); return new TileEntityLaserTreeFarm();

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -44,7 +45,8 @@ public class BlockMiningLaser extends BlockContainer {
} }
@Override @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) { if (side == 0) {
return iconBuffer[ICON_BOTTOM]; return iconBuffer[ICON_BOTTOM];
} }
@ -57,6 +59,17 @@ public class BlockMiningLaser extends BlockContainer {
return null; 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 @Override
public TileEntity createNewTileEntity(World world, int i) { public TileEntity createNewTileEntity(World world, int i) {
return new TileEntityMiningLaser(); return new TileEntityMiningLaser();

View file

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

View file

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

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -41,7 +42,8 @@ public class BlockRadar extends BlockContainer {
} }
@Override @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) { if (side == 0) {
return iconBuffer[ICON_BOTTOM]; return iconBuffer[ICON_BOTTOM];
} else if (side == 1) { } else if (side == 1) {
@ -59,6 +61,18 @@ public class BlockRadar extends BlockContainer {
return iconBuffer[ICON_SIDE_INACTIVE]; 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 @Override
public TileEntity createNewTileEntity(World var1, int i) { public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityRadar(); 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.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockEnanReactorCore extends BlockAbstractContainer { public class BlockEnanReactorCore extends BlockAbstractContainer {
@ -36,16 +37,25 @@ public class BlockEnanReactorCore extends BlockAbstractContainer {
} }
@Override @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) { if (side == 0 || side == 1) {
return iconBuffer[16]; return iconBuffer[16];
} }
if (meta >= 0 && meta < 16) { if (metadata >= 0 && metadata < 16) {
return iconBuffer[meta]; return iconBuffer[metadata];
} }
return iconBuffer[0]; return iconBuffer[0];
} }
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
return iconBuffer[16];
}
return iconBuffer[7];
}
@Override @Override
public void registerBlockIcons(IIconRegister par1IconRegister) { public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer[16] = par1IconRegister.registerIcon("warpdrive:energy/enanReactorCoreTopBottom"); 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.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockEnanReactorLaser extends BlockAbstractContainer { public class BlockEnanReactorLaser extends BlockAbstractContainer {
@ -41,12 +42,26 @@ public class BlockEnanReactorLaser extends BlockAbstractContainer {
} }
@Override @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) { if (side == 0 || side == 1) {
return iconBuffer[0]; 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]; return iconBuffer[2];
} }

View file

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

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -37,7 +38,8 @@ public class BlockLift extends BlockContainer
} }
@Override @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) { if (metadata > 2) {
return iconBuffer[0]; return iconBuffer[0];
} }
@ -54,30 +56,39 @@ public class BlockLift extends BlockContainer
return iconBuffer[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 @Override
public TileEntity createNewTileEntity(World var1, int i) { public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityLift(); return new TileEntityLift();
} }
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override @Override
public int quantityDropped(Random par1Random) { public int quantityDropped(Random par1Random) {
return 1; return 1;
} }
/**
* Returns the ID of the items to drop on destruction.
*/
@Override @Override
public Item getItemDropped(int par1, Random par2Random, int par3) { public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this); return Item.getItemFromBlock(this);
} }
/**
* Called upon block activation (right click on the block.)
*/
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) { if (world.isRemote) {

View file

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

View file

@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -37,7 +38,8 @@ public class BlockShipCore extends BlockContainer {
} }
@Override @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) { if (side == 0) {
return iconBuffer[ICON_BOTTOM]; return iconBuffer[ICON_BOTTOM];
} else if (side == 1) { } else if (side == 1) {
@ -55,6 +57,18 @@ public class BlockShipCore extends BlockContainer {
return null; 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 @Override
public TileEntity createNewTileEntity(World var1, int i) { public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityShipCore(); return new TileEntityShipCore();