mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add a simple tool for generating custom machine multi block structure code, as manually filling in these structural codes is really exhausting, especially when the structure is large.
44 lines
1.6 KiB
Java
44 lines
1.6 KiB
Java
package com.hbm.blocks.machine;
|
|
|
|
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 BlockCMAnchor extends Block {
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconFront;
|
|
|
|
public BlockCMAnchor() {
|
|
super(Material.iron);
|
|
}
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":cm_terminal_front");
|
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cm_terminal_side");
|
|
}
|
|
|
|
@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 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);
|
|
}
|
|
}
|