mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
even more assemfac stuff
This commit is contained in:
parent
c28d268a57
commit
a68cad7704
@ -15,6 +15,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class GUIAssemfac extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assemfac.png");
|
||||
private static ResourceLocation chemfac = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_chemfac.png");
|
||||
private TileEntityMachineAssemfac assemfac;
|
||||
|
||||
public GUIAssemfac(InventoryPlayer invPlayer, TileEntityMachineAssemfac tedf) {
|
||||
@ -28,6 +29,25 @@ public class GUIAssemfac extends GuiInfoContainer {
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
|
||||
if(assemfac.maxProgress[i] > 0) {
|
||||
int progress = assemfac.progress[i] * 16 / assemfac.maxProgress[i];
|
||||
|
||||
if(progress > 0) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int x = guiLeft + 234;
|
||||
int y = guiTop + 13 + 16 * i;
|
||||
GL11.glColorMask(true, true, true, false);
|
||||
this.drawGradientRect(x, y, x + progress + 1, y + 16, -2130706433, -2130706433);
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,6 +59,14 @@ public class GUIAssemfac extends GuiInfoContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(chemfac);
|
||||
|
||||
int p = (int) (assemfac.power * 52 / assemfac.getMaxPower());
|
||||
drawTexturedModalRect(guiLeft + 234, guiTop + 216 - p, 0, 219 - p, 16, p);
|
||||
|
||||
if(assemfac.power > 0)
|
||||
drawTexturedModalRect(guiLeft + 238, guiTop + 150, 0, 219, 9, 12);
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LMENU))
|
||||
for(int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
Slot s = this.inventorySlots.getSlot(i);
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.recipes.AssemblerRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemAssemblyTemplate;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
@ -110,7 +111,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa
|
||||
|
||||
List<AStack> recipe = AssemblerRecipes.getRecipeFromTempate(slots[template]);
|
||||
ItemStack output = AssemblerRecipes.getOutputFromTempate(slots[template]);
|
||||
int time = AssemblerRecipes.time.get(output);
|
||||
int time = ItemAssemblyTemplate.getProcessTime(slots[template]);
|
||||
|
||||
this.maxProgress[index] = time * this.speed / 100;
|
||||
|
||||
@ -141,6 +142,16 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public abstract int getRecipeCount();
|
||||
public abstract int getTemplateIndex(int index);
|
||||
|
||||
|
||||
@ -3,9 +3,14 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -14,12 +19,19 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase {
|
||||
|
||||
public AssemblerArm[] arms;
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank steam;
|
||||
|
||||
public TileEntityMachineAssemfac() {
|
||||
super(14 * 8 + 4 + 1); //8 assembler groups with 14 slots, 4 upgrade slots, 1 battery slot
|
||||
|
||||
arms = new AssemblerArm[6];
|
||||
for(int i = 0; i < arms.length; i++) {
|
||||
arms[i] = new AssemblerArm(i % 3 == 1 ? 1 : 0); //the second of every group of three becomes a welder
|
||||
}
|
||||
|
||||
water = new FluidTank(Fluids.WATER, 64_000, 0);
|
||||
steam = new FluidTank(Fluids.SPENTSTEAM, 64_000, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,15 +45,54 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.speed = 100;
|
||||
this.consumption = 100;
|
||||
|
||||
UpgradeManager.eval(slots, 1, 4);
|
||||
|
||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6);
|
||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||
|
||||
this.speed -= speedLevel * 15;
|
||||
this.consumption += speedLevel * 300;
|
||||
this.speed += powerLevel * 5;
|
||||
this.consumption -= powerLevel * 30;
|
||||
this.speed /= (overLevel + 1);
|
||||
this.consumption *= (overLevel + 1);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setIntArray("progress", this.progress);
|
||||
data.setIntArray("maxProgress", this.maxProgress);
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
|
||||
water.writeToNBT(data, "w");
|
||||
steam.writeToNBT(data, "s");
|
||||
|
||||
this.networkPack(data, 150);
|
||||
|
||||
} else {
|
||||
|
||||
if(isProgressing) {
|
||||
for(AssemblerArm arm : arms) {
|
||||
for(AssemblerArm arm : arms) {
|
||||
arm.updateInterp();
|
||||
if(isProgressing) {
|
||||
arm.updateArm();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getIntArray("progress");
|
||||
this.maxProgress = nbt.getIntArray("maxProgress");
|
||||
this.isProgressing = nbt.getBoolean("isProgressing");
|
||||
|
||||
water.readFromNBT(nbt, "w");
|
||||
steam.readFromNBT(nbt, "s");
|
||||
}
|
||||
|
||||
public static class AssemblerArm {
|
||||
public double[] angles = new double[4];
|
||||
@ -76,7 +127,6 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase {
|
||||
}
|
||||
|
||||
public void updateArm() {
|
||||
updateInterp();
|
||||
|
||||
if(actionDelay > 0) {
|
||||
actionDelay--;
|
||||
@ -214,18 +264,6 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 10_000_000;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user