Updated fluid generators GUI. Closes #1097
This commit is contained in:
parent
37d8b8641f
commit
dfaef8a6c2
12 changed files with 92 additions and 184 deletions
|
@ -89,7 +89,7 @@ public class Core {
|
||||||
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
||||||
event.getModMetadata().version = ModInfo.MOD_VERSION;
|
event.getModMetadata().version = ModInfo.MOD_VERSION;
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
// FMLCommonHandler.instance().bus().register(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
configDir = new File(new File(event.getModConfigurationDirectory(), "teamreborn"), "techreborn");
|
configDir = new File(new File(event.getModConfigurationDirectory(), "teamreborn"), "techreborn");
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class GuiDieselGenerator extends GuiBase {
|
||||||
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||||
drawSlot(10, 35, layer);
|
drawSlot(25, 35, layer);
|
||||||
drawSlot(10, 55, layer);
|
drawSlot(25, 55, layer);
|
||||||
this.builder.drawJEIButton(this, 150, 4, layer);
|
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class GuiDieselGenerator extends GuiBase {
|
||||||
|
|
||||||
this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||||
this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||||
this.builder.drawTank(this, 29, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer);
|
this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,51 +24,36 @@
|
||||||
|
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.text.translation.I18n;
|
|
||||||
import techreborn.tiles.generator.TileGasTurbine;
|
import techreborn.tiles.generator.TileGasTurbine;
|
||||||
|
|
||||||
public class GuiGasTurbine extends GuiContainer {
|
public class GuiGasTurbine extends GuiBase {
|
||||||
|
|
||||||
// TODO: use semifluid generator texture
|
TileGasTurbine tile;
|
||||||
private static final ResourceLocation texture = new ResourceLocation("techreborn",
|
|
||||||
"textures/gui/thermal_generator.png");
|
|
||||||
|
|
||||||
TileGasTurbine gasTurbine;
|
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine tile) {
|
||||||
|
super(player, tile, tile.createContainer(player));
|
||||||
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine gasTurbine) {
|
this.tile = tile;
|
||||||
super(gasTurbine.createContainer(player));
|
|
||||||
this.xSize = 176;
|
|
||||||
this.ySize = 167;
|
|
||||||
this.gasTurbine = gasTurbine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
this.mc.getTextureManager().bindTexture(GuiGasTurbine.texture);
|
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||||
final int k = (this.width - this.xSize) / 2;
|
drawSlot(25, 35, layer);
|
||||||
final int l = (this.height - this.ySize) / 2;
|
drawSlot(25, 55, layer);
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||||
final String name = "Gas Turbine";
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6,
|
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||||
4210752);
|
|
||||||
this.fontRenderer.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||||
this.fontRenderer.drawString("Liquid Amount", 10, 20, 16448255);
|
this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer);
|
||||||
this.fontRenderer.drawString(this.gasTurbine.tank.getFluidAmount() + "", 10, 30, 16448255);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
||||||
this.renderHoveredToolTip(mouseX, mouseY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,53 +24,36 @@
|
||||||
|
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.text.translation.I18n;
|
|
||||||
import reborncore.client.RenderUtil;
|
|
||||||
import techreborn.tiles.generator.TileSemiFluidGenerator;
|
import techreborn.tiles.generator.TileSemiFluidGenerator;
|
||||||
|
|
||||||
public class GuiSemifluidGenerator extends GuiContainer {
|
public class GuiSemifluidGenerator extends GuiBase {
|
||||||
|
|
||||||
// TODO: use semifluid generator texture
|
TileSemiFluidGenerator tile;
|
||||||
private static final ResourceLocation texture = new ResourceLocation("techreborn",
|
|
||||||
"textures/gui/semifluid_generator.png");
|
|
||||||
|
|
||||||
TileSemiFluidGenerator semifluidGenerator;
|
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemiFluidGenerator tile) {
|
||||||
|
super(player, tile, tile.createContainer(player));
|
||||||
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemiFluidGenerator semifluidGenerator) {
|
this.tile = tile;
|
||||||
super(semifluidGenerator.createContainer(player));
|
|
||||||
this.xSize = 176;
|
|
||||||
this.ySize = 167;
|
|
||||||
this.semifluidGenerator = semifluidGenerator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
this.mc.getTextureManager().bindTexture(GuiSemifluidGenerator.texture);
|
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||||
final int k = (this.width - this.xSize) / 2;
|
drawSlot(25, 35, layer);
|
||||||
final int l = (this.height - this.ySize) / 2;
|
drawSlot(25, 55, layer);
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||||
RenderUtil.renderGuiTank(this.semifluidGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||||
final String name = "Semifluid Generator";
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6,
|
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||||
4210752);
|
|
||||||
this.fontRenderer.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||||
this.fontRenderer.drawString("Liquid Amount", 10, 20, 16448255);
|
this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer);
|
||||||
this.fontRenderer.drawString(this.semifluidGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
||||||
this.renderHoveredToolTip(mouseX, mouseY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,54 +24,36 @@
|
||||||
|
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.text.translation.I18n;
|
|
||||||
import reborncore.client.RenderUtil;
|
|
||||||
import techreborn.tiles.generator.TileThermalGenerator;
|
import techreborn.tiles.generator.TileThermalGenerator;
|
||||||
|
|
||||||
public class GuiThermalGenerator extends GuiContainer {
|
public class GuiThermalGenerator extends GuiBase {
|
||||||
|
|
||||||
private static final ResourceLocation texture = new ResourceLocation("techreborn",
|
TileThermalGenerator tile;
|
||||||
"textures/gui/thermal_generator.png");
|
|
||||||
|
|
||||||
TileThermalGenerator thermalGenerator;
|
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator tile) {
|
||||||
|
super(player, tile, tile.createContainer(player));
|
||||||
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator thermalGenerator) {
|
this.tile = tile;
|
||||||
super(thermalGenerator.createContainer(player));
|
|
||||||
this.xSize = 176;
|
|
||||||
this.ySize = 167;
|
|
||||||
this.thermalGenerator = thermalGenerator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
this.mc.getTextureManager().bindTexture(GuiThermalGenerator.texture);
|
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||||
final int k = (this.width - this.xSize) / 2;
|
drawSlot(25, 35, layer);
|
||||||
final int l = (this.height - this.ySize) / 2;
|
drawSlot(25, 55, layer);
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||||
RenderUtil.renderGuiTank(this.thermalGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||||
final String name = I18n.translateToLocal("tile.techreborn:thermal_generator.name");
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6,
|
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||||
4210752);
|
|
||||||
this.fontRenderer.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||||
this.fontRenderer.drawString("Liquid Amount", 10, 20, 16448255);
|
this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer);
|
||||||
this.fontRenderer.drawString(this.thermalGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
|
|
||||||
this.fontRenderer.drawString(this.thermalGenerator.getEnergy() + "", 10, 40, 16448255);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
||||||
this.renderHoveredToolTip(mouseX, mouseY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,13 +261,10 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
||||||
registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING,
|
registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING,
|
||||||
VanillaRecipeCategoryUid.FUEL);
|
VanillaRecipeCategoryUid.FUEL);
|
||||||
|
|
||||||
registry.addRecipeClickArea(GuiSemifluidGenerator.class, 79, 34, 18, 18,
|
registry.addRecipeClickArea(GuiSemifluidGenerator.class, 150, 4, 18, 18, EFluidGenerator.SEMIFLUID.getRecipeID());
|
||||||
EFluidGenerator.SEMIFLUID.getRecipeID());
|
|
||||||
registry.addRecipeClickArea(GuiDieselGenerator.class, 150, 4, 18, 18, EFluidGenerator.DIESEL.getRecipeID());
|
registry.addRecipeClickArea(GuiDieselGenerator.class, 150, 4, 18, 18, EFluidGenerator.DIESEL.getRecipeID());
|
||||||
registry.addRecipeClickArea(GuiGasTurbine.class, 79, 34, 18, 18,
|
registry.addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID());
|
||||||
EFluidGenerator.GAS.getRecipeID());
|
registry.addRecipeClickArea(GuiThermalGenerator.class, 150, 4, 18, 18, EFluidGenerator.THERMAL.getRecipeID());
|
||||||
registry.addRecipeClickArea(GuiThermalGenerator.class, 79, 34, 18, 18,
|
|
||||||
EFluidGenerator.THERMAL.getRecipeID());
|
|
||||||
|
|
||||||
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IRON_FURNACE), VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL);
|
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IRON_FURNACE), VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL);
|
||||||
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IRON_ALLOY_FURNACE), RecipeCategoryUids.ALLOY_SMELTER, VanillaRecipeCategoryUid.FUEL);
|
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IRON_ALLOY_FURNACE), RecipeCategoryUids.ALLOY_SMELTER, VanillaRecipeCategoryUid.FUEL);
|
||||||
|
|
|
@ -32,26 +32,12 @@ import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import reborncore.common.powerSystem.PowerSystem;
|
||||||
import techreborn.api.generator.FluidGeneratorRecipe;
|
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class FluidGeneratorRecipeWrapper extends BlankRecipeWrapper {
|
public class FluidGeneratorRecipeWrapper extends BlankRecipeWrapper {
|
||||||
|
|
||||||
private static final DecimalFormat formatter;
|
|
||||||
|
|
||||||
static {
|
|
||||||
formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US);
|
|
||||||
DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
|
|
||||||
|
|
||||||
symbols.setGroupingSeparator(' ');
|
|
||||||
formatter.setDecimalFormatSymbols(symbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int FLUID_GENERATOR_STORAGE = 100_000;
|
private static final int FLUID_GENERATOR_STORAGE = 100_000;
|
||||||
|
|
||||||
private final FluidGeneratorRecipe baseRecipe;
|
private final FluidGeneratorRecipe baseRecipe;
|
||||||
|
@ -76,8 +62,9 @@ public class FluidGeneratorRecipeWrapper extends BlankRecipeWrapper {
|
||||||
|
|
||||||
energyProduced.draw(minecraft, 73, 26);
|
energyProduced.draw(minecraft, 73, 26);
|
||||||
|
|
||||||
minecraft.fontRenderer.drawString(formatter.format(baseRecipe.getEnergyPerMb() * 1000) + " EU", 70, 13,
|
minecraft.fontRenderer
|
||||||
0x444444);
|
.drawString(PowerSystem.getLocaliszedPowerFormattedNoSuffix(baseRecipe.getEnergyPerMb() * 1000) + " "
|
||||||
|
+ PowerSystem.getDisplayPower().abbreviation, 70, 13, 0x444444);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
|
@ -71,9 +70,9 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update() {
|
||||||
this.ticksSinceLastChange++;
|
|
||||||
super.update();
|
super.update();
|
||||||
|
this.ticksSinceLastChange++;
|
||||||
|
|
||||||
// Check cells input slot 2 time per second
|
// Check cells input slot 2 time per second
|
||||||
if (this.ticksSinceLastChange >= 10) {
|
if (this.ticksSinceLastChange >= 10) {
|
||||||
|
@ -83,7 +82,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
||||||
}
|
}
|
||||||
this.ticksSinceLastChange = 0;
|
this.ticksSinceLastChange = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tank.getFluidAmount() > 0) {
|
if (this.tank.getFluidAmount() > 0) {
|
||||||
if (this.currentRecipe == null || !this.currentRecipe.getFluid().equals(this.tank.getFluidType()))
|
if (this.currentRecipe == null || !this.currentRecipe.getFluid().equals(this.tank.getFluidType()))
|
||||||
this.currentRecipe = this.getRecipes().getRecipeForFluid(this.tank.getFluidType()).orElse(null);
|
this.currentRecipe = this.getRecipes().getRecipeForFluid(this.tank.getFluidType()).orElse(null);
|
||||||
|
@ -101,7 +100,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isRemote) {
|
if (!this.world.isRemote) {
|
||||||
if (this.world.getTotalWorldTime() - this.lastOutput < 30 && !this.isActive())
|
if (this.world.getTotalWorldTime() - this.lastOutput < 30 && !this.isActive())
|
||||||
this.world.setBlockState(this.getPos(), this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
|
this.world.setBlockState(this.getPos(), this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory().hotbar()
|
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory().hotbar()
|
||||||
.addInventory().tile(this).slot(0, 10, 35).outputSlot(1, 10, 55).syncEnergyValue()
|
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||||
.addInventory().create();
|
.addInventory().create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
return new ContainerBuilder("gasturbine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
return new ContainerBuilder("gasturbine").player(player.inventory).inventory().hotbar()
|
||||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||||
.addInventory().create();
|
.addInventory().create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,16 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC
|
||||||
public double getBaseMaxPower() {
|
public double getBaseMaxPower() {
|
||||||
return maxEnergy;
|
return maxEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getBaseMaxOutput() {
|
||||||
|
return maxOutput;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory().hotbar()
|
||||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||||
.addInventory().create();
|
.addInventory().create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,36 +61,6 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
||||||
return new ItemStack(ModBlocks.THERMAL_GENERATOR, 1);
|
return new ItemStack(ModBlocks.THERMAL_GENERATOR, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOn = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity() {
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if (!this.world.isRemote) {
|
|
||||||
boolean didRun = false;
|
|
||||||
if (this.acceptFluid() && FluidUtils.drainContainers(this.tank, this.inventory, 0, 1))
|
|
||||||
this.syncWithAll();
|
|
||||||
for (final EnumFacing direction : EnumFacing.values()) {
|
|
||||||
if (this.world
|
|
||||||
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
|
|
||||||
this.getPos().getY() + direction.getFrontOffsetY(),
|
|
||||||
this.getPos().getZ() + direction.getFrontOffsetZ()))
|
|
||||||
.getBlock() == Blocks.LAVA) {
|
|
||||||
if (this.tryAddingEnergy(1)) {
|
|
||||||
this.lastOutput = this.world.getTotalWorldTime();
|
|
||||||
didRun = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (didRun != isOn) {
|
|
||||||
isOn = didRun;
|
|
||||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockThermalGenerator.ACTIVE, isOn));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBaseMaxPower() {
|
public double getBaseMaxPower() {
|
||||||
return maxEnergy;
|
return maxEnergy;
|
||||||
|
@ -103,8 +73,8 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory().hotbar()
|
||||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||||
.addInventory().create();
|
.addInventory().create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue