Most of the Vacuum Freezer(Not working just yet)
This commit is contained in:
parent
219f2a0df7
commit
3114576e7b
13 changed files with 495 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
|
||||
public class VacuumFreezerRecipe extends BaseRecipe {
|
||||
|
||||
public VacuumFreezerRecipe(ItemStack input, ItemStack output, int tickTime, int euPerTick) {
|
||||
super(Reference.vacuumFreezerRecipe, tickTime, euPerTick);
|
||||
if (input != null)
|
||||
inputs.add(input);
|
||||
if (output != null)
|
||||
addOutput(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Vacuum Freezer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if(tile instanceof TileVacuumFreezer){
|
||||
return ((TileVacuumFreezer) tile).multiBlockStatus == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -4,9 +4,15 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.Core;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
|
||||
public class BlockVacuumFreezer extends BlockMachineBase {
|
||||
|
||||
|
@ -59,4 +65,21 @@ public class BlockVacuumFreezer extends BlockMachineBase {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileVacuumFreezer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
TileVacuumFreezer tileVacuumFreezer = (TileVacuumFreezer) world.getTileEntity(x, y, z);
|
||||
tileVacuumFreezer.multiBlockStatus = tileVacuumFreezer.checkMachine() ? 1 : 0;
|
||||
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int idsuID = 27;
|
||||
public static final int chargeBench = 28;
|
||||
public static final int fusionID = 29;
|
||||
public static final int vacuumFreezerID = 30;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
|
@ -119,6 +120,8 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == fusionID) {
|
||||
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(x, y, z), player);
|
||||
}else if (ID == vacuumFreezerID) {
|
||||
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(x, y, z), player);
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,6 +206,8 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(x, y, z));
|
||||
}else if (ID == fusionID) {
|
||||
return new GuiFusionReactor(player, (TileEntityFusionController) world.getTileEntity(x, y, z));
|
||||
}else if (ID == vacuumFreezerID) {
|
||||
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(x, y, z));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
|
||||
public class ContainerVacuumFreezer extends ContainerCrafting {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
TileVacuumFreezer tile;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int tickTime;
|
||||
public int machineStatus;
|
||||
|
||||
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter,
|
||||
EntityPlayer player) {
|
||||
super(tileAlloysmelter.crafter);
|
||||
tile = tileAlloysmelter;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 56, 34));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.machineStatus != tile.multiBlockStatus) {
|
||||
icrafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 3) {
|
||||
machineStatus = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
64
src/main/java/techreborn/client/gui/GuiVacuumFreezer.java
Normal file
64
src/main/java/techreborn/client/gui/GuiVacuumFreezer.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
import techreborn.client.container.ContainerVacuumFreezer;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
|
||||
public class GuiVacuumFreezer extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
|
||||
|
||||
TileVacuumFreezer crafter;
|
||||
ContainerVacuumFreezer containerVacuumFreezer;
|
||||
|
||||
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter) {
|
||||
super(new ContainerVacuumFreezer(tilealloysmelter, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
crafter = tilealloysmelter;
|
||||
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
j = crafter.getProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = crafter.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
|
||||
if (containerVacuumFreezer.machineStatus == 0) {
|
||||
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.alloysmelter.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.vacuumFreezer")
|
||||
public class MTVacuumFreezer extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient input, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input);
|
||||
|
||||
VacuumFreezerRecipe r = new VacuumFreezerRecipe(oInput1, MinetweakerCompat.toStack(output), ticktime, euTick);
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return Reference.vacuumFreezerRecipe;
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ public class MinetweakerCompat implements ICompatModule {
|
|||
MineTweakerAPI.registerClass(MTIndustrialSawmill.class);
|
||||
MineTweakerAPI.registerClass(MTPlateCuttingMachine.class);
|
||||
MineTweakerAPI.registerClass(MTFusionReactor.class);
|
||||
MineTweakerAPI.registerClass(MTVacuumFreezer.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.compat.nei;
|
|||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
||||
import techreborn.compat.nei.recipes.*;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
|
@ -73,5 +74,9 @@ public class NEIConfig implements IConfigureNEI {
|
|||
API.registerUsageHandler(fustionReacorRecipeHandler);
|
||||
API.registerRecipeHandler(fustionReacorRecipeHandler);
|
||||
|
||||
VacuumFreezerRecipeHandler vacuumFreezerRecipe = new VacuumFreezerRecipeHandler();
|
||||
API.registerUsageHandler(vacuumFreezerRecipe);
|
||||
API.registerRecipeHandler(vacuumFreezerRecipe);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package techreborn.compat.nei.recipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
import techreborn.client.gui.GuiVacuumFreezer;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
public class VacuumFreezerRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
||||
|
||||
@Override
|
||||
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
||||
int offset = 4;
|
||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 34 - offset, false);
|
||||
input.add(pStack);
|
||||
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset, false);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return Reference.vacuumFreezerRecipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "techreborn:textures/gui/vacuum_freezer.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiVacuumFreezer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
||||
new Rectangle(75, 20, 25, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
|
||||
}
|
||||
}
|
|
@ -203,6 +203,7 @@ public class ModBlocks {
|
|||
|
||||
VacuumFreezer = new BlockVacuumFreezer(Material.rock);
|
||||
GameRegistry.registerBlock(VacuumFreezer, "vacuumfreezer");
|
||||
GameRegistry.registerTileEntity(TileVacuumFreezer.class, "TileVacuumFreezerTR");
|
||||
|
||||
PlasmaGenerator = new BlockPlasmaGenerator(Material.rock);
|
||||
GameRegistry.registerBlock(PlasmaGenerator, "plasmagenerator");
|
||||
|
|
|
@ -331,6 +331,9 @@ public class
|
|||
'N', "ingotCupronickel",
|
||||
'C', "ingotCopper");
|
||||
|
||||
|
||||
RecipeHandler.addRecipe(new VacuumFreezerRecipe(ItemIngots.getIngotByName("hotTungstensteel"), ItemIngots.getIngotByName("tungstensteel"), 440, 128));
|
||||
RecipeHandler.addRecipe(new VacuumFreezerRecipe(ItemCells.getCellByName("water"), ItemCells.getCellByName("cell"), 60, 128));
|
||||
}
|
||||
|
||||
static void addSmeltingRecipes() {
|
||||
|
|
|
@ -15,4 +15,5 @@ public class Reference {
|
|||
public static String industrialSawmillRecipe = StatCollector.translateToLocal("techreborn.recipe.industrialsawmill");
|
||||
public static String latheRecipe = StatCollector.translateToLocal("techreborn.recipe.lathe");
|
||||
public static String plateCuttingMachineRecipe = StatCollector.translateToLocal("techreborn.recipe.platecuttingmachine");
|
||||
public static String vacuumFreezerRecipe = StatCollector.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||
}
|
||||
|
|
208
src/main/java/techreborn/tiles/TileVacuumFreezer.java
Normal file
208
src/main/java/techreborn/tiles/TileVacuumFreezer.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.powerSystem.TilePowerAcceptor;
|
||||
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable, IInventory {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64);
|
||||
public RecipeCrafter crafter;
|
||||
public int multiBlockStatus = 0;
|
||||
|
||||
public TileVacuumFreezer() {
|
||||
super(2);
|
||||
//Input slots
|
||||
int[] inputs = new int[1];
|
||||
inputs[0] = 0;
|
||||
int[] outputs = new int[1];
|
||||
outputs[0] = 0;
|
||||
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
|
||||
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
multiBlockStatus = checkMachine() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ForgeDirection direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ForgeDirection direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getFacing() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(short facing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
inventory.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
return inventory.decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean checkMachine() {
|
||||
int xDir = ForgeDirection.UP.offsetX * 2;
|
||||
int yDir = ForgeDirection.UP.offsetY * 2;
|
||||
int zDir = ForgeDirection.UP.offsetZ * 2;
|
||||
for (int i = -1; i < 2; i++) {
|
||||
for (int j = -1; j < 2; j++) {
|
||||
for (int k = -1; k < 2; k++) {
|
||||
if ((i != 0) || (j != 0) || (k != 0)) {
|
||||
if (worldObj.getBlock(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != ModBlocks.MachineCasing) {
|
||||
return false;
|
||||
}
|
||||
if (worldObj.getBlockMetadata(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 1 : 2)) {
|
||||
return false;
|
||||
}
|
||||
} else if (worldObj.getBlockMetadata(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue