mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
66 lines
1.9 KiB
Java
66 lines
1.9 KiB
Java
package com.hbm.blocks.machine;
|
|
|
|
import com.hbm.blocks.ModBlocks;
|
|
import com.hbm.lib.RefStrings;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.world.World;
|
|
|
|
public class FactoryHatch extends Block {
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconFront;
|
|
|
|
public FactoryHatch(Material p_i45394_1_) {
|
|
super(p_i45394_1_);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_furnace" : ":factory_advanced_furnace"));
|
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_hull" : ":factory_advanced_hull"));
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(int side, int metadata) {
|
|
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
|
}
|
|
|
|
@Override
|
|
public void onBlockAdded(World world, int x, int y, int z) {
|
|
super.onBlockAdded(world, x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
|
|
|
if(i == 0)
|
|
{
|
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
|
}
|
|
if(i == 1)
|
|
{
|
|
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
|
}
|
|
if(i == 2)
|
|
{
|
|
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
|
}
|
|
if(i == 3)
|
|
{
|
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
|
}
|
|
}
|
|
|
|
}
|