Change Laser Relay size & bounding box a bit

This commit is contained in:
Ellpeck 2015-12-01 20:38:45 +01:00
parent 00766c48d8
commit f8eaeb493f
2 changed files with 48 additions and 22 deletions

View file

@ -22,6 +22,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOrBlock{
@ -34,6 +35,31 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr
this.setStepSound(soundTypeStone);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
int meta = world.getBlockMetadata(x, y, z);
float pixel = 1F/16F;
if(meta == 0){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel);
}
else if(meta == 1){
this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 2){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F);
}
else if(meta == 3){
this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 4){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 5){
this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
}
@Override
public boolean renderAsNormalBlock(){
return false;

View file

@ -29,30 +29,30 @@ public class RenderLaserRelay extends RenderTileEntity{
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
this.bindTexture(resLoc);
if(theModel.doesRotate()){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta == 0){
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glTranslatef(0F, -2F, 0F);
}
if(meta == 3){
else if(meta == 3){
GL11.glRotatef(-90, 1F, 0F, 0F);
GL11.glTranslatef(0F, -1F, 1F);
}
if(meta == 2){
else if(meta == 2){
GL11.glRotatef(90, 1F, 0F, 0F);
GL11.glTranslatef(0F, -1F, -1F);
}
if(meta == 4){
else if(meta == 4){
GL11.glRotatef(90, 0F, 0F, 1F);
GL11.glTranslatef(1F, -1F, 0F);
}
if(meta == 5){
else if(meta == 5){
GL11.glRotatef(90, 0F, 0F, -1F);
GL11.glTranslatef(-1F, -1F, 0F);
}
}
GL11.glScalef(0.85F, 0.85F, 0.85F);
GL11.glTranslatef(0F, 0.2657F, 0F);
theModel.render(0.0625F);
GL11.glPopMatrix();
}