Format
This commit is contained in:
parent
6e0ec1d861
commit
4ac26ac086
137 changed files with 10339 additions and 7322 deletions
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -19,115 +17,146 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBlastFurnace extends BlockContainer {
|
||||
|
||||
public class BlockBlastFurnace extends BlockContainer{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockBlastFurnace(Material material)
|
||||
|
||||
public BlockBlastFurnace(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.blastfurnace");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileBlastFurnace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||
if(world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ) instanceof TileMachineCasing){
|
||||
TileMachineCasing casing = (TileMachineCasing) world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ);
|
||||
if(casing.getMultiblockController() != null && casing.getMultiblockController().isAssembled()){
|
||||
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileBlastFurnace();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (world.getTileEntity(x + direction.offsetX, y
|
||||
+ direction.offsetY, z + direction.offsetZ) instanceof TileMachineCasing)
|
||||
{
|
||||
TileMachineCasing casing = (TileMachineCasing) world
|
||||
.getTileEntity(x + direction.offsetX, y
|
||||
+ direction.offsetY, z + direction.offsetZ);
|
||||
if (casing.getMultiblockController() != null
|
||||
&& casing.getMultiblockController().isAssembled())
|
||||
{
|
||||
player.openGui(Core.INSTANCE,
|
||||
GuiHandler.blastFurnaceID, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon
|
||||
.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
if(!world.isRemote) {
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
}
|
||||
|
||||
byte b = 3;
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j()) {
|
||||
b = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j()) {
|
||||
b = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j()) {
|
||||
b = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j()) {
|
||||
b = 4;
|
||||
}
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
}
|
||||
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
byte b = 3;
|
||||
|
||||
if(l == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(l == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(l == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(l == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -16,104 +14,131 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCentrifuge extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockCentrifuge() {
|
||||
super(Material.piston);
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileCentrifuge();
|
||||
}
|
||||
public BlockCentrifuge()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/industrial_grinder_top_on");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileCentrifuge();
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon
|
||||
.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
|
||||
this.iconTop = icon
|
||||
.registerIcon("techreborn:machine/industrial_grinder_top_on");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
}
|
||||
|
||||
if(!world.isRemote) {
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
byte b = 3;
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j()) {
|
||||
b = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j()) {
|
||||
b = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j()) {
|
||||
b = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j()) {
|
||||
b = 4;
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
}
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
byte b = 3;
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
if(l == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(l == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(l == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(l == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -15,67 +15,79 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
||||
|
||||
public class BlockMachineCasing extends BlockMultiblockBase {
|
||||
|
||||
public static final String[] types = new String[] {"Standard", "Reinforced", "Advanced"};
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockMachineCasing(Material material)
|
||||
public static final String[] types = new String[]
|
||||
{ "Standard", "Reinforced", "Advanced" };
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockMachineCasing(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.machineCasing");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
//TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
// TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "machine/casing" + types[i]);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "machine/casing" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileMachineCasing();
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileMachineCasing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,61 +18,71 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockOre extends Block {
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", "Sphalerite",
|
||||
"Tungston", "Sheldonite", "Olivine", "Sodalite", "Copper", "Tin", "Lead", "Silver"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar",
|
||||
"Sphalerite", "Tungston", "Sheldonite", "Olivine", "Sodalite",
|
||||
"Copper", "Tin", "Lead", "Silver" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockOre(Material material) {
|
||||
super(material);
|
||||
setBlockName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(1f);
|
||||
}
|
||||
public BlockOre(Material material)
|
||||
{
|
||||
super(material);
|
||||
setBlockName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
//TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
// TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore"
|
||||
+ types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -12,47 +10,57 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuantumChest extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
|
||||
public BlockQuantumChest() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockQuantumChest()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumChest();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileQuantumChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x,
|
||||
y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/quantum_chest");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/quantum_chest");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta) {
|
||||
//TODO chest rotation
|
||||
if (currentSide == 1) {
|
||||
return top;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta)
|
||||
{
|
||||
// TODO chest rotation
|
||||
if (currentSide == 1)
|
||||
{
|
||||
return top;
|
||||
} else
|
||||
{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -12,45 +10,56 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuantumTank extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
|
||||
public BlockQuantumTank() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockQuantumTank()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumTank();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileQuantumTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x,
|
||||
y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta) {
|
||||
if (currentSide == 1) {
|
||||
return top;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta)
|
||||
{
|
||||
if (currentSide == 1)
|
||||
{
|
||||
return top;
|
||||
} else
|
||||
{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -17,106 +15,132 @@ import techreborn.Core;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockRollingMachine extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockRollingMachine(Material material) {
|
||||
super(material.piston);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.rollingmachine");
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockRollingMachine(Material material)
|
||||
{
|
||||
super(material.piston);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.rollingmachine");
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileRollingMachine();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileRollingMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/rollingmachine_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world,
|
||||
x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconTop = icon
|
||||
.registerIcon("techreborn:machine/rollingmachine_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if(!world.isRemote) {
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
byte b = 3;
|
||||
}
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j()) {
|
||||
b = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j()) {
|
||||
b = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j()) {
|
||||
b = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j()) {
|
||||
b = 4;
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
}
|
||||
byte b = 3;
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
if(l == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(l == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(l == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(l == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,60 +18,70 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockStorage extends Block {
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire", "Chrome", "Electrum", "Tungsten",
|
||||
"Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire",
|
||||
"Chrome", "Electrum", "Tungsten", "Lead", "Zinc", "Brass", "Steel",
|
||||
"Platinum", "Nickel", "Invar", };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockStorage(Material material) {
|
||||
super(material);
|
||||
setBlockName("techreborn.storage");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockStorage(Material material)
|
||||
{
|
||||
super(material);
|
||||
setBlockName("techreborn.storage");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "storage/storage" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "storage/storage" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -18,113 +18,137 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockThermalGenerator extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockThermalGenerator() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/ThermalGenerator_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
public BlockThermalGenerator()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconTop = icon
|
||||
.registerIcon("techreborn:machine/ThermalGenerator_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if(!world.isRemote) {
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
byte b = 3;
|
||||
}
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j()) {
|
||||
b = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j()) {
|
||||
b = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j()) {
|
||||
b = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j()) {
|
||||
b = 4;
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
}
|
||||
byte b = 3;
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
if(l == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(l == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(l == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(l == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileThermalGenerator();
|
||||
}
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
//TODO change when added crafting
|
||||
return Item.getItemFromBlock(Blocks.furnace);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileThermalGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world,
|
||||
x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
|
||||
int p_149650_3_)
|
||||
{
|
||||
// TODO change when added crafting
|
||||
return Item.getItemFromBlock(Blocks.furnace);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue