Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -8,92 +8,92 @@ import techreborn.init.ModBlocks;
|
|||
|
||||
public class MultiblockChecker {
|
||||
|
||||
public static final BlockPos ZERO_OFFSET = BlockPos.ORIGIN;
|
||||
public static final BlockPos ZERO_OFFSET = BlockPos.ORIGIN;
|
||||
|
||||
public static final int CASING_NORMAL = 0;
|
||||
public static final int CASING_REINFORCED = 1;
|
||||
public static final int CASING_ADVANCED = 2;
|
||||
public static final int CASING_NORMAL = 0;
|
||||
public static final int CASING_REINFORCED = 1;
|
||||
public static final int CASING_ADVANCED = 2;
|
||||
|
||||
private final World world;
|
||||
private final BlockPos downCenter;
|
||||
private final World world;
|
||||
private final BlockPos downCenter;
|
||||
|
||||
public MultiblockChecker(World world, BlockPos downCenter) {
|
||||
this.world = world;
|
||||
this.downCenter = downCenter;
|
||||
}
|
||||
public MultiblockChecker(World world, BlockPos downCenter) {
|
||||
this.world = world;
|
||||
this.downCenter = downCenter;
|
||||
}
|
||||
|
||||
public boolean checkCasing(int offX, int offY, int offZ, int type) {
|
||||
IBlockState block = getBlock(offX, offY, offZ);
|
||||
if(block.getBlock() == ModBlocks.MachineCasing) {
|
||||
if(block.getValue(BlockMachineCasing.METADATA) == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean checkCasing(int offX, int offY, int offZ, int type) {
|
||||
IBlockState block = getBlock(offX, offY, offZ);
|
||||
if (block.getBlock() == ModBlocks.MachineCasing) {
|
||||
if (block.getValue(BlockMachineCasing.METADATA) == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkAir(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.isAirBlock(pos);
|
||||
}
|
||||
public boolean checkAir(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.isAirBlock(pos);
|
||||
}
|
||||
|
||||
public IBlockState getBlock(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
public IBlockState getBlock(int offX, int offY, int offZ) {
|
||||
BlockPos pos = downCenter.add(offX, offY, offZ);
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
|
||||
public boolean checkRectY(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for(int x = -sizeX; x <= sizeX; x++) {
|
||||
for(int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if(!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean checkRectY(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for (int x = -sizeX; x <= sizeX; x++) {
|
||||
for (int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if (!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkRectZ(int sizeX, int sizeY, int casingType, BlockPos offset) {
|
||||
for(int x = -sizeX; x <= sizeX; x++) {
|
||||
for(int y = -sizeY; y <= sizeY; y++) {
|
||||
if(!checkCasing(x + offset.getX(), y + offset.getY(), offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean checkRectZ(int sizeX, int sizeY, int casingType, BlockPos offset) {
|
||||
for (int x = -sizeX; x <= sizeX; x++) {
|
||||
for (int y = -sizeY; y <= sizeY; y++) {
|
||||
if (!checkCasing(x + offset.getX(), y + offset.getY(), offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkRectX(int sizeZ, int sizeY, int casingType, BlockPos offset) {
|
||||
for(int z = -sizeZ; z <= sizeZ; z++) {
|
||||
for(int y = -sizeY; y <= sizeY; y++) {
|
||||
if(!checkCasing(offset.getX(), y + offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean checkRectX(int sizeZ, int sizeY, int casingType, BlockPos offset) {
|
||||
for (int z = -sizeZ; z <= sizeZ; z++) {
|
||||
for (int y = -sizeY; y <= sizeY; y++) {
|
||||
if (!checkCasing(offset.getX(), y + offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkRingY(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for(int x = -sizeX; x <= sizeX; x++) {
|
||||
for(int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if((x == sizeX || x == -sizeX) || (z == sizeZ || z == -sizeZ)) {
|
||||
if (!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean checkRingY(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for (int x = -sizeX; x <= sizeX; x++) {
|
||||
for (int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if ((x == sizeX || x == -sizeX) || (z == sizeZ || z == -sizeZ)) {
|
||||
if (!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkRingYHollow(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for(int x = -sizeX; x <= sizeX; x++) {
|
||||
for(int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if((x == sizeX || x == -sizeX) || (z == sizeZ || z == -sizeZ)) {
|
||||
if (!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
} else if (!checkAir(x + offset.getX(), offset.getY(), z + offset.getZ()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean checkRingYHollow(int sizeX, int sizeZ, int casingType, BlockPos offset) {
|
||||
for (int x = -sizeX; x <= sizeX; x++) {
|
||||
for (int z = -sizeZ; z <= sizeZ; z++) {
|
||||
if ((x == sizeX || x == -sizeX) || (z == sizeZ || z == -sizeZ)) {
|
||||
if (!checkCasing(x + offset.getX(), offset.getY(), z + offset.getZ(), casingType))
|
||||
return false;
|
||||
} else if (!checkAir(x + offset.getX(), offset.getY(), z + offset.getZ()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.tiles.multiblock;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.multiblock.IMultiblockPart;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
|
@ -27,8 +27,7 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.multiblocks.MultiBlockCasing;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider
|
||||
{
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider {
|
||||
|
||||
public static int euTick = 5;
|
||||
public int tickTime;
|
||||
|
@ -36,8 +35,7 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
|||
public RecipeCrafter crafter;
|
||||
public int capacity = 1000;
|
||||
|
||||
public TileBlastFurnace()
|
||||
{
|
||||
public TileBlastFurnace() {
|
||||
super(ConfigTechReborn.CentrifugeTier);
|
||||
// TODO configs
|
||||
int[] inputs = new int[2];
|
||||
|
@ -50,78 +48,65 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.BlastFurnace, 1);
|
||||
}
|
||||
|
||||
public int getHeat()
|
||||
{
|
||||
for (EnumFacing direction : EnumFacing.values())
|
||||
{
|
||||
public int getHeat() {
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||
if (tileEntity instanceof TileMachineCasing)
|
||||
{
|
||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if (((TileMachineCasing) tileEntity).isConnected()
|
||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled())
|
||||
{
|
||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
||||
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||
location.modifyPositionFromSide(direction, 1);
|
||||
int heat = 0;
|
||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
|
||||
.getBlock() == tileEntity.getBlockType())
|
||||
{
|
||||
.getBlock() == tileEntity.getBlockType()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (IMultiblockPart part : casing.connectedParts)
|
||||
{
|
||||
for (IMultiblockPart part : casing.connectedParts) {
|
||||
BlockMachineCasing casing1 = (BlockMachineCasing) worldObj.getBlockState(part.getPos())
|
||||
.getBlock();
|
||||
.getBlock();
|
||||
heat += casing1
|
||||
.getHeatFromState(part.getWorld().getBlockState(part.getWorldLocation().toBlockPos()));
|
||||
.getHeatFromState(part.getWorld().getBlockState(part.getWorldLocation().toBlockPos()));
|
||||
// TODO meta fix
|
||||
}
|
||||
|
||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
||||
.getBlock().getUnlocalizedName().equals("tile.lava")
|
||||
&& worldObj
|
||||
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
||||
.getBlock().getUnlocalizedName().equals("tile.lava"))
|
||||
{
|
||||
.getBlock().getUnlocalizedName().equals("tile.lava")
|
||||
&& worldObj
|
||||
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
||||
.getBlock().getUnlocalizedName().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
}
|
||||
return heat;
|
||||
|
@ -132,96 +117,81 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tickTime = tagCompound.getInteger("tickTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
writeUpdateToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public void writeUpdateToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void writeUpdateToNBT(NBTTagCompound tagCompound) {
|
||||
tagCompound.setInteger("tickTime", tickTime);
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
if (slotIndex >= 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
return slotIndex == 2 || slotIndex == 3;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale)
|
||||
{
|
||||
if (crafter.currentTickTime != 0)
|
||||
{
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,138 +19,138 @@ import techreborn.init.ModBlocks;
|
|||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileImplosionCompressor() {
|
||||
super(2);
|
||||
int[] inputs = new int[]{0, 1};
|
||||
int[] outputs = new int[]{2, 3};
|
||||
crafter = new RecipeCrafter(Reference.implosionCompressorRecipe, this, 2, 2, inventory, inputs, outputs);
|
||||
}
|
||||
public TileImplosionCompressor() {
|
||||
super(2);
|
||||
int[] inputs = new int[] { 0, 1 };
|
||||
int[] outputs = new int[] { 2, 3 };
|
||||
crafter = new RecipeCrafter(Reference.implosionCompressorRecipe, this, 2, 2, inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, getPos().down(3));
|
||||
}
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, getPos().down(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ImplosionCompressor, 1);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ImplosionCompressor, 1);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, new BlockPos(0, 2, 0));
|
||||
boolean chamber = multiblockChecker.checkRingYHollow(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
return down && chamber && up;
|
||||
}
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, new BlockPos(0, 2, 0));
|
||||
boolean chamber = multiblockChecker.checkRingYHollow(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
return down && chamber && up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] {0, 1, 2, 3};
|
||||
}
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] { 0, 1, 2, 3 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index == 2 || index == 3;
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index == 2 || index == 3;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return 64000;
|
||||
}
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return 64000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return 64;
|
||||
}
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.MEDIUM;
|
||||
}
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
}
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,18 +26,20 @@ import techreborn.config.ConfigTechReborn;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModFluids;
|
||||
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.*;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_NORMAL;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||
implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
public Tank tank = new Tank("TileGrinder", TANK_CAPACITY, this);
|
||||
public RecipeCrafter crafter;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
public TileIndustrialGrinder()
|
||||
{
|
||||
public TileIndustrialGrinder() {
|
||||
super(ConfigTechReborn.CentrifugeTier);
|
||||
// TODO configs
|
||||
|
||||
|
@ -53,52 +55,47 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IndustrialGrinder, 1);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if(multiblockChecker == null) {
|
||||
BlockPos pos = getPos().offset(getFacing().getOpposite(), 2).down();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, pos);
|
||||
}
|
||||
if (multiblockChecker == null) {
|
||||
BlockPos pos = getPos().offset(getFacing().getOpposite(), 2).down();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, pos);
|
||||
}
|
||||
|
||||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
|
@ -107,16 +104,14 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
|
@ -124,24 +119,20 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
/* IFluidHandler */
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate)
|
||||
{
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
|
@ -150,10 +141,8 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||
return null;
|
||||
}
|
||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||
|
@ -162,135 +151,120 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return fluid == FluidRegistry.WATER || fluid == ModFluids.fluidMercury || fluid == ModFluids.fluidSodiumpersulfate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
if (slotIndex >= 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
||||
{
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale)
|
||||
{
|
||||
if (crafter.currentTickTime != 0)
|
||||
{
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if(tankFluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tankFluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if(tankFluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
if(tankFluid.amount == recipeFluid.amount)
|
||||
tank.setFluid(null);
|
||||
else tankFluid.amount -= recipeFluid.amount;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tankFluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
if (tankFluid.amount == recipeFluid.amount)
|
||||
tank.setFluid(null);
|
||||
else
|
||||
tankFluid.amount -= recipeFluid.amount;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,20 +19,20 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.blocks.BlockMachineFrame;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModFluids;
|
||||
import techreborn.items.ItemDusts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.*;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_NORMAL;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, IListInfoProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(5, "Sawmill", 64, this);
|
||||
public Tank tank = new Tank("Sawmill", 16000, this);
|
||||
public Inventory inventory = new Inventory(5, "Sawmill", 64, this);
|
||||
public Tank tank = new Tank("Sawmill", 16000, this);
|
||||
|
||||
public int tickTime;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
@ -45,53 +45,53 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
public void update() {
|
||||
super.update();
|
||||
if (getMutliBlock()) {
|
||||
ItemStack wood = inventory.getStackInSlot(0);
|
||||
if(tickTime == 0) {
|
||||
if (wood != null) {
|
||||
for (int id : OreDictionary.getOreIDs(wood)) {
|
||||
String name = OreDictionary.getOreName(id);
|
||||
if(name.equals("logWood") &&
|
||||
canAddOutput(2, 10) &&
|
||||
canAddOutput(3, 5) &&
|
||||
canAddOutput(4, 3) &&
|
||||
canUseEnergy(128.0F) &&
|
||||
!tank.isEmpty() &&
|
||||
tank.getFluid().amount >= 1000) {
|
||||
if(--wood.stackSize == 0)
|
||||
setInventorySlotContents(0, null);
|
||||
tank.drain(1000, true);
|
||||
useEnergy(128.0F);
|
||||
tickTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(++tickTime > 100) {
|
||||
Random rnd = worldObj.rand;
|
||||
addOutput(2, new ItemStack(Blocks.PLANKS, 6 + rnd.nextInt(4)));
|
||||
if(rnd.nextInt(4) != 0) {
|
||||
ItemStack pulp = ItemDusts.getDustByName("sawDust", 2 + rnd.nextInt(3));
|
||||
addOutput(3, pulp);
|
||||
}
|
||||
if(rnd.nextInt(3) == 0) {
|
||||
ItemStack paper = new ItemStack(Items.PAPER, 1 + rnd.nextInt(2));
|
||||
addOutput(4, paper);
|
||||
}
|
||||
tickTime = 0;
|
||||
}
|
||||
}
|
||||
ItemStack wood = inventory.getStackInSlot(0);
|
||||
if (tickTime == 0) {
|
||||
if (wood != null) {
|
||||
for (int id : OreDictionary.getOreIDs(wood)) {
|
||||
String name = OreDictionary.getOreName(id);
|
||||
if (name.equals("logWood") &&
|
||||
canAddOutput(2, 10) &&
|
||||
canAddOutput(3, 5) &&
|
||||
canAddOutput(4, 3) &&
|
||||
canUseEnergy(128.0F) &&
|
||||
!tank.isEmpty() &&
|
||||
tank.getFluid().amount >= 1000) {
|
||||
if (--wood.stackSize == 0)
|
||||
setInventorySlotContents(0, null);
|
||||
tank.drain(1000, true);
|
||||
useEnergy(128.0F);
|
||||
tickTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (++tickTime > 100) {
|
||||
Random rnd = worldObj.rand;
|
||||
addOutput(2, new ItemStack(Blocks.PLANKS, 6 + rnd.nextInt(4)));
|
||||
if (rnd.nextInt(4) != 0) {
|
||||
ItemStack pulp = ItemDusts.getDustByName("sawDust", 2 + rnd.nextInt(3));
|
||||
addOutput(3, pulp);
|
||||
}
|
||||
if (rnd.nextInt(3) == 0) {
|
||||
ItemStack paper = new ItemStack(Items.PAPER, 1 + rnd.nextInt(2));
|
||||
addOutput(4, paper);
|
||||
}
|
||||
tickTime = 0;
|
||||
}
|
||||
}
|
||||
FluidUtils.drainContainers(this, inventory, 1, 4);
|
||||
}
|
||||
|
||||
public void addOutput(int slot, ItemStack stack) {
|
||||
if(getStackInSlot(slot) == null)
|
||||
setInventorySlotContents(slot, stack);
|
||||
getStackInSlot(slot).stackSize += stack.stackSize;
|
||||
}
|
||||
public void addOutput(int slot, ItemStack stack) {
|
||||
if (getStackInSlot(slot) == null)
|
||||
setInventorySlotContents(slot, stack);
|
||||
getStackInSlot(slot).stackSize += stack.stackSize;
|
||||
}
|
||||
|
||||
public boolean canAddOutput(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
return stack == null || getInventoryStackLimit() - stack.stackSize >= amount;
|
||||
}
|
||||
public boolean canAddOutput(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
return stack == null || getInventoryStackLimit() - stack.stackSize >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
|
@ -101,11 +101,11 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,14 +137,14 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
tickTime = tagCompound.getInteger("tickTime");
|
||||
tickTime = tagCompound.getInteger("tickTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
tagCompound.setInteger("tickTime", tickTime);
|
||||
tagCompound.setInteger("tickTime", tickTime);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
|
@ -189,23 +189,23 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[]{tank.getInfo()};
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] {0, 2, 3, 4, 5};
|
||||
}
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] { 0, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index >= 2;
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index >= 2;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (tickTime != 0) {
|
||||
|
|
|
@ -18,35 +18,35 @@ import techreborn.init.ModBlocks;
|
|||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileVacuumFreezer() {
|
||||
super(2);
|
||||
int[] inputs = new int[] {0};
|
||||
int[] outputs = new int[] {1};
|
||||
int[] inputs = new int[] { 0 };
|
||||
int[] outputs = new int[] { 1 };
|
||||
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, getPos().down());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if(getMultiBlock())
|
||||
crafter.updateEntity();
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(worldObj, getPos().down());
|
||||
}
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
return multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMultiBlock())
|
||||
crafter.updateEntity();
|
||||
}
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
return multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
|
@ -133,19 +133,19 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
return crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] {0, 1};
|
||||
}
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[] { 0, 1 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index == 1;
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue