Added XP Solidifier Textures

This commit is contained in:
Ellpeck 2015-07-16 02:09:00 +02:00
parent c82dc1f148
commit 1465fab3d0
4 changed files with 22 additions and 18 deletions

View file

@ -42,12 +42,12 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if (rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if (rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if (rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
if (rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
} }
@Override @Override
@ -57,7 +57,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon; if(side == 1 || side == 0) return this.topIcon;
if(side == 3) return this.frontIcon; if(side == 3) return this.frontIcon;
return this.blockIcon; return this.blockIcon;
} }
@ -65,7 +65,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
@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 meta = world.getBlockMetadata(x, y, z);
if(side == 1) return this.topIcon; if(side == 1 || side == 0) return this.topIcon;
if(side == meta+2) return this.frontIcon; if(side == meta+2) return this.frontIcon;
return this.blockIcon; return this.blockIcon;
} }
@ -73,16 +73,17 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){ public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Top");
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front"); this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Front");
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z); TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z);
if (solidifier != null) player.openGui(ActuallyAdditions.instance, GuiHandler.XP_SOLIDIFIER_ID, world, x, y, z); if(solidifier != null)
player.openGui(ActuallyAdditions.instance, GuiHandler.XP_SOLIDIFIER_ID, world, x, y, z);
return true; return true;
} }
return true; return true;
@ -94,14 +95,16 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityXPSolidifier){ if(tile instanceof TileEntityXPSolidifier){
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)tile; TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)tile;
if(solidifier.amount > 0){
int stacks = solidifier.amount/64; int stacks = solidifier.amount/64;
int rest = solidifier.amount % 64; int rest = solidifier.amount%64;
for(int i = 0; i < stacks; i++){ for(int i = 0; i < stacks; i++){
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, 64, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())); this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, 64, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()));
} }
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, rest, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())); this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, rest, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()));
solidifier.amount = 0; solidifier.amount = 0;
} }
}
super.breakBlock(world, x, y, z, block, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@ -117,6 +120,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
entityItem.motionZ = world.rand.nextGaussian()*factor; entityItem.motionZ = world.rand.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
@Override @Override
public String getName(){ public String getName(){
return "blockXPSolidifier"; return "blockXPSolidifier";
@ -146,7 +150,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
BlockUtil.addInformation(theBlock, list, 2, ""); BlockUtil.addInformation(theBlock, list, 2, "");
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B