Added basic rotation to machines
This commit is contained in:
parent
0aa7927e28
commit
4d8dd1ea4a
4 changed files with 314 additions and 70 deletions
|
@ -2,6 +2,7 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
@ -20,11 +21,15 @@ import techreborn.tiles.TileBlastFurnace;
|
||||||
import techreborn.tiles.TileMachineCasing;
|
import techreborn.tiles.TileMachineCasing;
|
||||||
|
|
||||||
public class BlockBlastFurnace extends BlockContainer{
|
public class BlockBlastFurnace extends BlockContainer{
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon front;
|
private IIcon iconFront;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon other;
|
private IIcon iconTop;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconBottom;
|
||||||
|
|
||||||
public BlockBlastFurnace(Material material)
|
public BlockBlastFurnace(Material material)
|
||||||
{
|
{
|
||||||
|
@ -57,18 +62,72 @@ public class BlockBlastFurnace extends BlockContainer{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
public void registerBlockIcons(IIconRegister icon) {
|
||||||
front = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
|
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||||
other = 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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(int currentSide, int meta) {
|
|
||||||
if (currentSide == 3) {
|
|
||||||
return front;
|
|
||||||
} else {
|
|
||||||
return other;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.client.GuiHandler;
|
import techreborn.client.GuiHandler;
|
||||||
|
@ -15,11 +19,15 @@ import techreborn.tiles.TileCentrifuge;
|
||||||
|
|
||||||
public class BlockCentrifuge extends BlockContainer {
|
public class BlockCentrifuge extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon top;
|
private IIcon iconFront;
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon other;
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconTop;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconBottom;
|
||||||
|
|
||||||
public BlockCentrifuge() {
|
public BlockCentrifuge() {
|
||||||
super(Material.piston);
|
super(Material.piston);
|
||||||
setHardness(2F);
|
setHardness(2F);
|
||||||
|
@ -37,22 +45,75 @@ public class BlockCentrifuge extends BlockContainer {
|
||||||
return true;
|
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
|
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
|
||||||
top = icon.registerIcon("techreborn:machine/industrial_grinder_top_on");
|
|
||||||
other = icon.registerIcon("techreborn:machine/machine_side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(int currentSide, int meta) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
if (currentSide == 1) {
|
|
||||||
return top;
|
super.onBlockAdded(world, x, y, z);
|
||||||
} else {
|
this.setDefaultDirection(world, x, y, z);
|
||||||
return other;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.client.GuiHandler;
|
import techreborn.client.GuiHandler;
|
||||||
|
@ -16,10 +20,14 @@ import techreborn.tiles.TileRollingMachine;
|
||||||
|
|
||||||
public class BlockRollingMachine extends BlockContainer {
|
public class BlockRollingMachine extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon top;
|
private IIcon iconFront;
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon other;
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconTop;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconBottom;
|
||||||
|
|
||||||
public BlockRollingMachine(Material material) {
|
public BlockRollingMachine(Material material) {
|
||||||
super(material.piston);
|
super(material.piston);
|
||||||
|
@ -39,22 +47,76 @@ public class BlockRollingMachine extends BlockContainer {
|
||||||
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
|
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
|
||||||
return true;
|
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
|
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
|
||||||
top = icon.registerIcon("techreborn:machine/rollingmachine_top");
|
|
||||||
other = icon.registerIcon("techreborn:machine/machine_side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(int currentSide, int meta) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
if (currentSide == 1) {
|
|
||||||
return top;
|
super.onBlockAdded(world, x, y, z);
|
||||||
} else {
|
this.setDefaultDirection(world, x, y, z);
|
||||||
return other;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,18 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.client.GuiHandler;
|
import techreborn.client.GuiHandler;
|
||||||
|
@ -20,32 +24,90 @@ import java.util.Random;
|
||||||
|
|
||||||
public class BlockThermalGenerator extends BlockContainer {
|
public class BlockThermalGenerator extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon top;
|
private IIcon iconFront;
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon other;
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconTop;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private IIcon iconBottom;
|
||||||
|
|
||||||
public BlockThermalGenerator() {
|
public BlockThermalGenerator() {
|
||||||
super(Material.piston);
|
super(Material.piston);
|
||||||
setHardness(2f);
|
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) {
|
||||||
|
|
||||||
@Override
|
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
|
||||||
top = icon.registerIcon("techreborn:machine/ThermalGenerator_top");
|
|
||||||
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(int currentSide, int meta) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
if (currentSide == 1) {
|
|
||||||
return top;
|
super.onBlockAdded(world, x, y, z);
|
||||||
} else {
|
this.setDefaultDirection(world, x, y, z);
|
||||||
return other;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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
|
@Override
|
||||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
|
|
Loading…
Reference in a new issue