mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
my balls are heavy
This commit is contained in:
parent
0be198d21f
commit
0a1822ff10
@ -4,6 +4,7 @@ import com.hbm.blocks.BlockDummyable;
|
|||||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
|
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -19,6 +20,11 @@ public class MachineChemicalPlant extends BlockDummyable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
|
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
|
||||||
@Override public int getOffset() { return 1; }
|
@Override public int getOffset() { return 1; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
||||||
|
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
|
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
|
||||||
|
|
||||||
@ -36,6 +37,13 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
|||||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower);
|
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int x, int y, int button) {
|
||||||
|
super.mouseClicked(x, y, button);
|
||||||
|
|
||||||
|
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, "", 0, this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName());
|
String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName());
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
|
import com.hbm.inventory.recipes.loader.GenericRecipes;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIScreenRecipeSelector extends GuiScreen {
|
||||||
|
|
||||||
|
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_recipe_selector.png");
|
||||||
|
|
||||||
|
protected int xSize = 176;
|
||||||
|
protected int ySize = 132;
|
||||||
|
protected int guiLeft;
|
||||||
|
protected int guiTop;
|
||||||
|
|
||||||
|
protected GuiScreen previousScreen;
|
||||||
|
|
||||||
|
public static void openSelector(GenericRecipes recipeSet, IControlReceiver tile, String selection, int index, GuiScreen previousScreen) {
|
||||||
|
FMLCommonHandler.instance().showGuiScreen(new GUIScreenRecipeSelector(recipeSet, tile, selection, index, previousScreen));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GUIScreenRecipeSelector(GenericRecipes recipeSet, IControlReceiver tile, String selection, int index, GuiScreen previousScreen) {
|
||||||
|
this.previousScreen = previousScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.guiLeft = (this.width - this.xSize) / 2;
|
||||||
|
this.guiTop = (this.height - this.ySize) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
|
this.drawDefaultBackground();
|
||||||
|
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char typedChar, int keyCode) {
|
||||||
|
if(keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||||
|
FMLCommonHandler.instance().showGuiScreen(previousScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean doesGuiPauseGame() { return false; }
|
||||||
|
}
|
||||||
@ -11,6 +11,8 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
public class ChemicalPlantRecipes extends GenericRecipes<GenericRecipe> {
|
public class ChemicalPlantRecipes extends GenericRecipes<GenericRecipe> {
|
||||||
|
|
||||||
|
public static final ChemicalPlantRecipes INSTANCE = new ChemicalPlantRecipes();
|
||||||
|
|
||||||
@Override public int inputItemLimit() { return 3; }
|
@Override public int inputItemLimit() { return 3; }
|
||||||
@Override public int inputFluidLimit() { return 3; }
|
@Override public int inputFluidLimit() { return 3; }
|
||||||
@Override public int outputItemLimit() { return 3; }
|
@Override public int outputItemLimit() { return 3; }
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public abstract class SerializableRecipe {
|
|||||||
recipeHandlers.add(new PedestalRecipes());
|
recipeHandlers.add(new PedestalRecipes());
|
||||||
|
|
||||||
//GENERIC
|
//GENERIC
|
||||||
recipeHandlers.add(new ChemicalPlantRecipes());
|
recipeHandlers.add(ChemicalPlantRecipes.INSTANCE);
|
||||||
|
|
||||||
recipeHandlers.add(new MatDistribution());
|
recipeHandlers.add(new MatDistribution());
|
||||||
recipeHandlers.add(new CustomMachineRecipes());
|
recipeHandlers.add(new CustomMachineRecipes());
|
||||||
|
|||||||
55
src/main/java/com/hbm/module/ModuleMachineChemplant.java
Normal file
55
src/main/java/com/hbm/module/ModuleMachineChemplant.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package com.hbm.module;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
|
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||||
|
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||||
|
|
||||||
|
import api.hbm.energymk2.IEnergyHandlerMK2;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option 1: Make a base class with weird arbitrary overrides to define shit like slots for multi machines like the chemfac
|
||||||
|
* Option 2: Make an easy to define module which can be used by whatever needs it, hypothetically allowing a mixed recipe machine.
|
||||||
|
* In the hudson bay, you know how we do it.
|
||||||
|
* @author hbm
|
||||||
|
*/
|
||||||
|
public class ModuleMachineChemplant {
|
||||||
|
|
||||||
|
public int index;
|
||||||
|
public IEnergyHandlerMK2 battery;
|
||||||
|
public ItemStack[] slots;
|
||||||
|
public int[] inputSlots = new int[3];
|
||||||
|
public int[] outputSlots = new int[3];
|
||||||
|
public FluidTank[] inputTanks = new FluidTank[3];
|
||||||
|
public FluidTank[] outputTanks = new FluidTank[3];
|
||||||
|
|
||||||
|
public String recipe;
|
||||||
|
public float progress;
|
||||||
|
|
||||||
|
public ModuleMachineChemplant(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) {
|
||||||
|
this.index = index;
|
||||||
|
this.battery = battery;
|
||||||
|
this.slots = slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canProcess() {
|
||||||
|
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
|
||||||
|
if(recipe == null) return false;
|
||||||
|
if(battery.getPower() < recipe.power) return false;
|
||||||
|
|
||||||
|
//TBI
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetProgress() { this.progress = 0F; }
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleMachineChemplant iInput(int a, int b, int c) { inputSlots[0] = a; inputSlots[1] = b; inputSlots[2] = c; return this; }
|
||||||
|
public ModuleMachineChemplant iOutput(int a, int b, int c) { outputSlots[0] = a; outputSlots[1] = b; outputSlots[2] = c; return this; }
|
||||||
|
public ModuleMachineChemplant fInput(FluidTank a, FluidTank b, FluidTank c) { inputTanks[0] = a; inputTanks[1] = b; inputTanks[2] = c; return this; }
|
||||||
|
public ModuleMachineChemplant fOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; }
|
||||||
|
}
|
||||||
@ -149,7 +149,7 @@ public class ItemRenderAmat extends ItemRenderWeaponBase {
|
|||||||
@Override
|
@Override
|
||||||
public void setupThirdPerson(ItemStack stack) {
|
public void setupThirdPerson(ItemStack stack) {
|
||||||
super.setupThirdPerson(stack);
|
super.setupThirdPerson(stack);
|
||||||
double scale = 1.5D;
|
double scale = 1.25D;
|
||||||
GL11.glScaled(scale, scale, scale);
|
GL11.glScaled(scale, scale, scale);
|
||||||
GL11.glTranslated(0, 0.5, 6.75);
|
GL11.glTranslated(0, 0.5, 6.75);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -341,6 +341,7 @@ public class TileMappings {
|
|||||||
put(TileEntityMachineAssembler.class, "tileentity_assembly_machine");
|
put(TileEntityMachineAssembler.class, "tileentity_assembly_machine");
|
||||||
put(TileEntityMachineAssemfac.class, "tileentity_assemfac");
|
put(TileEntityMachineAssemfac.class, "tileentity_assemfac");
|
||||||
put(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
|
put(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
|
||||||
|
put(TileEntityMachineChemicalPlant.class, "tileentity_chemicalplant");
|
||||||
put(TileEntityMachineChemfac.class, "tileentity_chemfac");
|
put(TileEntityMachineChemfac.class, "tileentity_chemfac");
|
||||||
|
|
||||||
put(TileEntityMachineOilWell.class, "tileentity_derrick");
|
put(TileEntityMachineOilWell.class, "tileentity_derrick");
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManagerNT;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -11,6 +12,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
|||||||
import com.hbm.inventory.gui.GUIMachineChemicalPlant;
|
import com.hbm.inventory.gui.GUIMachineChemicalPlant;
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
|
import com.hbm.module.ModuleMachineChemplant;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
@ -24,10 +26,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IGUIProvider {
|
public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider {
|
||||||
|
|
||||||
public FluidTank[] inputTanks;
|
public FluidTank[] inputTanks;
|
||||||
public FluidTank[] outputTanks;
|
public FluidTank[] outputTanks;
|
||||||
@ -37,6 +41,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
|||||||
public int progress;
|
public int progress;
|
||||||
public int maxProgress;
|
public int maxProgress;
|
||||||
|
|
||||||
|
public ModuleMachineChemplant chemplantModule;
|
||||||
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
||||||
|
|
||||||
public TileEntityMachineChemicalPlant() {
|
public TileEntityMachineChemicalPlant() {
|
||||||
@ -48,6 +53,9 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
|||||||
this.inputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
this.inputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
||||||
this.outputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
this.outputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.chemplantModule = new ModuleMachineChemplant(0, this, slots)
|
||||||
|
.iInput(4, 5, 6).iOutput(7, 8, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,6 +100,28 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
|||||||
this.maxProgress = buf.readInt();
|
this.maxProgress = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
this.inputTanks[i].readFromNBT(nbt, "i" + i);
|
||||||
|
this.outputTanks[i].readFromNBT(nbt, "o" + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.chemplantModule.fInput(inputTanks[0], inputTanks[1], inputTanks[2]).fOutput(outputTanks[0], outputTanks[1], outputTanks[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
this.inputTanks[i].writeToNBT(nbt, "i" + i);
|
||||||
|
this.outputTanks[i].writeToNBT(nbt, "o" + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override public long getPower() { return power; }
|
@Override public long getPower() { return power; }
|
||||||
@Override public void setPower(long power) { this.power = power; }
|
@Override public void setPower(long power) { this.power = power; }
|
||||||
@Override public long getMaxPower() { return maxPower; }
|
@Override public long getMaxPower() { return maxPower; }
|
||||||
@ -103,6 +133,27 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
|||||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineChemicalPlant(player.inventory, this); }
|
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineChemicalPlant(player.inventory, this); }
|
||||||
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineChemicalPlant(player.inventory, this); }
|
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineChemicalPlant(player.inventory, this); }
|
||||||
|
|
||||||
|
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receiveControl(NBTTagCompound data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AxisAlignedBB bb = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
|
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 3, zCoord + 2);
|
||||||
|
return bb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public double getMaxRenderDistanceSquared() {
|
||||||
|
return 65536.0D;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
||||||
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
Loading…
x
Reference in New Issue
Block a user