Code formatter take 2
This commit is contained in:
parent
33985f1a31
commit
5eed5b161d
450 changed files with 32768 additions and 26684 deletions
|
@ -11,53 +11,61 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileAesu;
|
||||
|
||||
public class BlockAESU extends BlockMachineBase implements IRotationTexture {
|
||||
public class BlockAESU extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
|
||||
public BlockAESU(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.aesu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileAesu();
|
||||
}
|
||||
public BlockAESU(Material material)
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.aesu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@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.aesuID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileAesu();
|
||||
}
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
@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.aesuID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff() {
|
||||
return prefix + "aesu_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
return prefix + "aesu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn() {
|
||||
return prefix + "aesu_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
return prefix + "aesu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide() {
|
||||
return prefix + "aesu_side";
|
||||
}
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
return prefix + "aesu_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop() {
|
||||
return prefix + "aesu_top";
|
||||
}
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
return prefix + "aesu_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom() {
|
||||
return prefix + "aesu_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
return prefix + "aesu_bottom";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterators;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
|
@ -25,279 +28,344 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import reborncore.common.blocks.IRotationTexture;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterators;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockBatBox extends BaseTileBlock implements IRotationTexture , ITexturedBlock {
|
||||
public class BlockBatBox extends BaseTileBlock implements IRotationTexture, ITexturedBlock
|
||||
{
|
||||
|
||||
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
protected final String prefix = "techreborn:blocks/machine/storage/";
|
||||
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
protected final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
public BlockBatBox() {
|
||||
super(Material.rock);
|
||||
setUnlocalizedName("techreborn.batBox");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
}
|
||||
public BlockBatBox()
|
||||
{
|
||||
super(Material.rock);
|
||||
setUnlocalizedName("techreborn.batBox");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.batboxID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
|
||||
ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.batboxID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState() {
|
||||
FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
this.setDefaultFacing(worldIn, pos, state);
|
||||
}
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
this.setDefaultFacing(worldIn, pos, state);
|
||||
}
|
||||
|
||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) {
|
||||
if (!worldIn.isRemote) {
|
||||
IBlockState sate = worldIn.getBlockState(pos.north());
|
||||
Block block = sate.getBlock();
|
||||
IBlockState state1 = worldIn.getBlockState(pos.south());
|
||||
Block block1 = state1.getBlock();
|
||||
IBlockState state2 = worldIn.getBlockState(pos.west());
|
||||
Block block2 = state2.getBlock();
|
||||
IBlockState state3 = worldIn.getBlockState(pos.east());
|
||||
Block block3 = state3.getBlock();
|
||||
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
|
||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
IBlockState sate = worldIn.getBlockState(pos.north());
|
||||
Block block = sate.getBlock();
|
||||
IBlockState state1 = worldIn.getBlockState(pos.south());
|
||||
Block block1 = state1.getBlock();
|
||||
IBlockState state2 = worldIn.getBlockState(pos.west());
|
||||
Block block2 = state2.getBlock();
|
||||
IBlockState state3 = worldIn.getBlockState(pos.east());
|
||||
Block block3 = state3.getBlock();
|
||||
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
|
||||
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1)) {
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state)) {
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2)) {
|
||||
enumfacing = EnumFacing.EAST;
|
||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2)) {
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
|
||||
{
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state))
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2))
|
||||
{
|
||||
enumfacing = EnumFacing.EAST;
|
||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2))
|
||||
{
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||
}
|
||||
}
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
||||
if(placer.rotationPitch < -50){
|
||||
facing = EnumFacing.DOWN;
|
||||
} else if (placer.rotationPitch > 50){
|
||||
facing = EnumFacing.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
dropInventory(worldIn, pos);
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||
ItemStack stack)
|
||||
{
|
||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
||||
if (placer.rotationPitch < -50)
|
||||
{
|
||||
facing = EnumFacing.DOWN;
|
||||
} else if (placer.rotationPitch > 50)
|
||||
{
|
||||
facing = EnumFacing.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
protected void dropInventory(World world, BlockPos pos) {
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos);
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
if(tileEntity == null){
|
||||
return;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
return;
|
||||
}
|
||||
protected void dropInventory(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
if (tileEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
|
||||
if(itemStack == null){
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase || ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
for (ItemStack itemStack : items){
|
||||
Random rand = new Random();
|
||||
if (itemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, itemStack.copy());
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
if (itemStack.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileBatBox();
|
||||
}
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int facingInt = getSideFromEnum(state.getValue(FACING));
|
||||
return facingInt;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileBatBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean active = false;
|
||||
EnumFacing facing = getSideFromint(meta);
|
||||
return this.getDefaultState().withProperty(FACING, facing);
|
||||
}
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int facingInt = getSideFromEnum(state.getValue(FACING));
|
||||
return facingInt;
|
||||
}
|
||||
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos){
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
boolean active = false;
|
||||
EnumFacing facing = getSideFromint(meta);
|
||||
return this.getDefaultState().withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
public EnumFacing getSideFromint(int i){
|
||||
if(i == 0){
|
||||
return EnumFacing.NORTH;
|
||||
} else if(i == 1){
|
||||
return EnumFacing.SOUTH;
|
||||
}else if(i == 2){
|
||||
return EnumFacing.EAST;
|
||||
}else if(i == 3){
|
||||
return EnumFacing.WEST;
|
||||
}else if(i == 4){
|
||||
return EnumFacing.UP;
|
||||
}else if(i == 5){
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos)
|
||||
{
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public int getSideFromEnum(EnumFacing facing){
|
||||
if(facing == EnumFacing.NORTH){
|
||||
return 0;
|
||||
} else if(facing == EnumFacing.SOUTH){
|
||||
return 1;
|
||||
}else if(facing == EnumFacing.EAST){
|
||||
return 2;
|
||||
}else if(facing == EnumFacing.WEST){
|
||||
return 3;
|
||||
}else if(facing == EnumFacing.UP){
|
||||
return 4;
|
||||
}else if(facing == EnumFacing.DOWN){
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public EnumFacing getSideFromint(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
return EnumFacing.NORTH;
|
||||
} else if (i == 1)
|
||||
{
|
||||
return EnumFacing.SOUTH;
|
||||
} else if (i == 2)
|
||||
{
|
||||
return EnumFacing.EAST;
|
||||
} else if (i == 3)
|
||||
{
|
||||
return EnumFacing.WEST;
|
||||
} else if (i == 4)
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
} else if (i == 5)
|
||||
{
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
}
|
||||
public int getSideFromEnum(EnumFacing facing)
|
||||
{
|
||||
if (facing == EnumFacing.NORTH)
|
||||
{
|
||||
return 0;
|
||||
} else if (facing == EnumFacing.SOUTH)
|
||||
{
|
||||
return 1;
|
||||
} else if (facing == EnumFacing.EAST)
|
||||
{
|
||||
return 2;
|
||||
} else if (facing == EnumFacing.WEST)
|
||||
{
|
||||
return 3;
|
||||
} else if (facing == EnumFacing.UP)
|
||||
{
|
||||
return 4;
|
||||
} else if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff() {
|
||||
return prefix + "batbox_front";
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn() {
|
||||
return prefix + "batbox_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
return prefix + "batbox_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide() {
|
||||
return prefix + "batbox_side";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
return prefix + "batbox_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop() {
|
||||
return prefix + "batbox_top";
|
||||
}
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
return prefix + "batbox_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom() {
|
||||
return prefix + "batbox_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
return prefix + "batbox_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
if(this instanceof IRotationTexture){
|
||||
IRotationTexture rotationTexture = (IRotationTexture) this;
|
||||
if(getFacing(blockState) == facing){
|
||||
return rotationTexture.getFrontOff();
|
||||
}
|
||||
if(facing == EnumFacing.UP){
|
||||
return rotationTexture.getTop();
|
||||
}
|
||||
if(facing == EnumFacing.DOWN){
|
||||
return rotationTexture.getBottom();
|
||||
}
|
||||
return rotationTexture.getSide();
|
||||
}
|
||||
return "techreborn:blocks/machine/machine_side";
|
||||
}
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
return prefix + "batbox_bottom";
|
||||
}
|
||||
|
||||
public EnumFacing getFacing(IBlockState state){
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing)
|
||||
{
|
||||
if (this instanceof IRotationTexture)
|
||||
{
|
||||
IRotationTexture rotationTexture = (IRotationTexture) this;
|
||||
if (getFacing(blockState) == facing)
|
||||
{
|
||||
return rotationTexture.getFrontOff();
|
||||
}
|
||||
if (facing == EnumFacing.UP)
|
||||
{
|
||||
return rotationTexture.getTop();
|
||||
}
|
||||
if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
return rotationTexture.getBottom();
|
||||
}
|
||||
return rotationTexture.getSide();
|
||||
}
|
||||
return "techreborn:blocks/machine/machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return 6;
|
||||
}
|
||||
public EnumFacing getFacing(IBlockState state)
|
||||
{
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
|
||||
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {
|
||||
ALL;
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public EnumFacing[] facings() {
|
||||
return new EnumFacing[]{EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.UP, EnumFacing.DOWN};
|
||||
}
|
||||
public enum Facings implements Predicate<EnumFacing>,Iterable<EnumFacing>
|
||||
{
|
||||
ALL;
|
||||
|
||||
public EnumFacing random(Random rand) {
|
||||
EnumFacing[] aenumfacing = this.facings();
|
||||
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
||||
}
|
||||
public EnumFacing[] facings()
|
||||
{
|
||||
return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST,
|
||||
EnumFacing.UP, EnumFacing.DOWN };
|
||||
}
|
||||
|
||||
public boolean apply(EnumFacing p_apply_1_) {
|
||||
return p_apply_1_ != null;
|
||||
}
|
||||
public EnumFacing random(Random rand)
|
||||
{
|
||||
EnumFacing[] aenumfacing = this.facings();
|
||||
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
||||
}
|
||||
|
||||
public Iterator<EnumFacing> iterator() {
|
||||
return Iterators.forArray(this.facings());
|
||||
}
|
||||
}
|
||||
public boolean apply(EnumFacing p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != null;
|
||||
}
|
||||
|
||||
public Iterator<EnumFacing> iterator()
|
||||
{
|
||||
return Iterators.forArray(this.facings());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,61 +14,66 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
|
||||
public class BlockIDSU extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
public class BlockIDSU extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
public BlockIDSU(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.idsu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public BlockIDSU(Material material)
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.idsu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileIDSU(5, 2048, 100000000);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileIDSU(5, 2048, 100000000);
|
||||
}
|
||||
|
||||
@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.idsuID, 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.idsuID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
if (tile instanceof TileIDSU)
|
||||
{
|
||||
((TileIDSU) tile).ownerUdid = player.getUniqueID().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
if (tile instanceof TileIDSU) {
|
||||
((TileIDSU) tile).ownerUdid = player.getUniqueID().toString();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
return prefix + "idsu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
return prefix + "idsu_side";
|
||||
}
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
return prefix + "idsu_top";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "idsu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "idsu_side" ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "idsu_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "idsu_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
return prefix + "idsu_bottom";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,51 +11,55 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
public class BlockLESU extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
public class BlockLESU extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
public BlockLESU(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.lesu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public BlockLESU(Material material)
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.lesu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileLesu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileLesu();
|
||||
}
|
||||
@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.lesuID, 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.lesuID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_front";
|
||||
}
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "lesu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "lesu_side" ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "lesu_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "lesu_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_bottom";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,60 +13,70 @@ import reborncore.common.blocks.IAdvancedRotationTexture;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.lesu.TileLesuStorage;
|
||||
|
||||
public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
|
||||
public BlockLESUStorage(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.lesustorage");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
public BlockLESUStorage(Material material)
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.lesustorage");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).rebuildNetwork();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage)
|
||||
{
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).rebuildNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).removeFromNetwork();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage)
|
||||
{
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).removeFromNetwork();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileLesuStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileLesuStorage();
|
||||
}
|
||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
return block == (Block) this;
|
||||
}
|
||||
|
||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
||||
return block == (Block) this;
|
||||
}
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "lesu_block" ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,41 +8,49 @@ import techreborn.tiles.storage.TileMFE;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockMFE extends BlockBatBox {
|
||||
public class BlockMFE extends BlockBatBox
|
||||
{
|
||||
|
||||
public BlockMFE() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.mfe");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public BlockMFE()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.mfe");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileMFE();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileMFE();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff() {
|
||||
return prefix + "mfe_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
return prefix + "mfe_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn() {
|
||||
return prefix + "mfe_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
return prefix + "mfe_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide() {
|
||||
return prefix + "mfe_side";
|
||||
}
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
return prefix + "mfe_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop() {
|
||||
return prefix + "mfe_top";
|
||||
}
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
return prefix + "mfe_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom() {
|
||||
return prefix + "mfe_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
return prefix + "mfe_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,41 +8,49 @@ import techreborn.tiles.storage.TileMFSU;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockMFSU extends BlockBatBox {
|
||||
public class BlockMFSU extends BlockBatBox
|
||||
{
|
||||
|
||||
public BlockMFSU() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.mfsu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public BlockMFSU()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("techreborn.mfsu");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileMFSU();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileMFSU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff() {
|
||||
return prefix + "mfsu_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
return prefix + "mfsu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn() {
|
||||
return prefix + "mfsu_front";
|
||||
}
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
return prefix + "mfsu_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide() {
|
||||
return prefix + "mfsu_side";
|
||||
}
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
return prefix + "mfsu_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop() {
|
||||
return prefix + "mfsu_top";
|
||||
}
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
return prefix + "mfsu_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom() {
|
||||
return prefix + "mfsu_bottom";
|
||||
}
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
return prefix + "mfsu_bottom";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue