This commit is contained in:
Gig 2015-04-28 16:18:32 +01:00
parent 1bfa830f13
commit 30ceed031c
11 changed files with 107 additions and 528 deletions

View file

@ -21,7 +21,7 @@ import techreborn.tiles.TileMachineCasing;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAlloySmelter extends BlockContainer {
public class BlockAlloySmelter extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -35,9 +35,7 @@ public class BlockAlloySmelter extends BlockContainer {
public BlockAlloySmelter(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.alloysmelter");
setHardness(2F);
}
@Override
@ -77,73 +75,4 @@ public class BlockAlloySmelter extends BlockContainer {
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -20,7 +20,7 @@ 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 BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -34,9 +34,7 @@ public class BlockBlastFurnace extends BlockContainer {
public BlockBlastFurnace(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.blastfurnace");
setHardness(2F);
}
@Override
@ -90,73 +88,4 @@ public class BlockBlastFurnace extends BlockContainer {
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -17,7 +17,7 @@ import techreborn.tiles.TileCentrifuge;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCentrifuge extends BlockContainer {
public class BlockCentrifuge extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -72,73 +72,4 @@ public class BlockCentrifuge extends BlockContainer {
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockGrinder extends BlockContainer{
public class BlockGrinder extends BlockMachineBase{
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -29,9 +29,7 @@ public class BlockGrinder extends BlockContainer{
public BlockGrinder(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.grinder");
setHardness(2F);
}
@Override
@ -60,73 +58,4 @@ public class BlockGrinder extends BlockContainer{
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockImplosionCompressor extends BlockContainer{
public class BlockImplosionCompressor extends BlockMachineBase{
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -29,9 +29,7 @@ public class BlockImplosionCompressor extends BlockContainer{
public BlockImplosionCompressor(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.implosioncompressor");
setHardness(2F);
}
@Override
@ -60,73 +58,4 @@ public class BlockImplosionCompressor extends BlockContainer{
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -0,0 +1,97 @@
package techreborn.blocks;
import techreborn.client.TechRebornCreativeTab;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockMachineBase extends BlockContainer{
public BlockMachineBase(Material material)
{
super(Material.rock);
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(2f);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{
return null;
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockMatterFabricator extends BlockContainer{
public class BlockMatterFabricator extends BlockMachineBase{
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -29,9 +29,7 @@ public class BlockMatterFabricator extends BlockContainer{
public BlockMatterFabricator(Material material)
{
super(material);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.matterfabricator");
setHardness(2F);
}
@Override
@ -60,73 +58,4 @@ public class BlockMatterFabricator extends BlockContainer{
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
}

View file

@ -13,7 +13,7 @@ import techreborn.tiles.TileQuantumChest;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumChest extends BlockContainer {
public class BlockQuantumChest extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon top;

View file

@ -13,7 +13,7 @@ import techreborn.tiles.TileQuantumTank;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumTank extends BlockContainer {
public class BlockQuantumTank extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon top;

View file

@ -18,7 +18,7 @@ import techreborn.tiles.TileRollingMachine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockRollingMachine extends BlockContainer {
public class BlockRollingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -32,9 +32,7 @@ public class BlockRollingMachine extends BlockContainer {
public BlockRollingMachine(Material material)
{
super(material.rock);
setCreativeTab(TechRebornCreativeTab.instance);
setBlockName("techreborn.rollingmachine");
setHardness(2f);
}
@Override

View file

@ -21,7 +21,7 @@ import techreborn.tiles.TileThermalGenerator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockThermalGenerator extends BlockContainer {
public class BlockThermalGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@ -59,96 +59,4 @@ public class BlockThermalGenerator extends BlockContainer {
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
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);
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;
}
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);
}
}
@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);
}
}