mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Add Climate Modifier Widget
This commit is contained in:
1 parent
4d0dfd837e
commit
d2ea1d820c
32 files changed
+368
-364
No files matched your search
@@ -1,39 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.climate;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
|
||||
public class ClimateData implements IClimateData {
|
||||
private final Map<String, Float> temperatureData = new LinkedHashMap<>();
|
||||
private final Map<String, Float> humidityData = new LinkedHashMap<>();
|
||||
|
||||
@Override
|
||||
public ClimateData addData(ClimateType type, String displayName, float value) {
|
||||
if(type == ClimateType.HUMIDITY){
|
||||
humidityData.put(displayName, value);
|
||||
}else{
|
||||
temperatureData.put(displayName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, Float> getData(ClimateType type){
|
||||
if(type == ClimateType.HUMIDITY){
|
||||
return humidityData;
|
||||
}
|
||||
return temperatureData;
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
World world = owner.getWorldObj();
|
||||
if(!addedToManager && !world.isRemote) {
|
||||
GreenhouseManager.climateManager.addSource(owner);
|
||||
addedToManager = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -126,6 +127,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
World world = owner.getWorldObj();
|
||||
if(addedToManager &&!world.isRemote) {
|
||||
GreenhouseManager.climateManager.removeSource(owner);
|
||||
addedToManager = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class Table {
|
||||
private final List<TableEntry> lines = new ArrayList<>();
|
||||
|
||||
public Table() {
|
||||
}
|
||||
|
||||
public Table(String title) {
|
||||
lines.add(new TableTitle(title));
|
||||
}
|
||||
|
||||
public Table clear(){
|
||||
lines.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Table addValueEntry(String textKey, String value) {
|
||||
lines.add(new TableValueText(textKey + ": ", value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Table addCenteredEntry(String textKey) {
|
||||
lines.add(new TableTextCentered(textKey));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Table addEmptyEntry() {
|
||||
lines.add(new TableEmptyLine());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Table addEntry(TableEntry entry) {
|
||||
lines.add(entry);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int fontColor, boolean drawBackground){
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
int lineWidth = getLineWidth();
|
||||
int lineStart = x + 2;
|
||||
int lineEnd = lineStart + lineWidth;
|
||||
int rowTopY = y + 1;
|
||||
|
||||
for (TableEntry entry : lines) {
|
||||
int rowBottomY = rowTopY + entry.getHeight(fontRenderer) - 1;
|
||||
entry.draw(fontRenderer, x, y, lineWidth, lineStart, lineEnd, rowTopY, rowBottomY, fontColor, drawBackground);
|
||||
rowTopY += + entry.getHeight(fontRenderer) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<TableEntry> getEntrys() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
int height = 0;
|
||||
for (TableEntry entry : lines) {
|
||||
height += entry.getHeight(fontRenderer);
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
public int getLineWidth() {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
int lineWidth = 0;
|
||||
|
||||
for (TableEntry entry : lines) {
|
||||
lineWidth = Math.max(entry.getLineWidth(fontRenderer), lineWidth);
|
||||
}
|
||||
|
||||
return lineWidth;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public abstract class TableEntry {
|
||||
public static final int TITLE_BACKGROUND = 1610612736;
|
||||
public static final int DEFAULT_BACKGROUND = 1342177280;
|
||||
public static final int DEFAULT_FONT = 553648127;
|
||||
|
||||
public int getHeight(FontRenderer fontRenderer) {
|
||||
return fontRenderer.FONT_HEIGHT + 1;
|
||||
}
|
||||
|
||||
public abstract int getLineWidth(FontRenderer fontRenderer);
|
||||
|
||||
public abstract void draw(FontRenderer fontRenderer, int x, int y, int lineWidth, int lineStart, int lineEnd, int rowTopY, int rowBottomY, int fontColor, boolean drawBackground);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
class TableTextCentered extends TableText {
|
||||
public TableTextCentered(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(FontRenderer fontRenderer, int x, int y, int lineWidth, int lineStart, int lineEnd, int rowTopY, int rowBottomY, int fontColor, boolean drawBackground) {
|
||||
if(drawBackground) {
|
||||
Gui.drawRect(x, y + fontRenderer.FONT_HEIGHT, lineEnd, y, DEFAULT_BACKGROUND);
|
||||
}
|
||||
fontRenderer.drawString(text, lineStart + lineWidth / 2 - fontRenderer.getStringWidth(text) / 2, y + 1, fontColor);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
class TableTitle extends TableText {
|
||||
public TableTitle(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(FontRenderer fontRenderer, int x, int y, int lineWidth, int lineStart, int lineEnd, int rowTopY, int rowBottomY, int fontColor, boolean drawBackground) {
|
||||
if(drawBackground) {
|
||||
Gui.drawRect(x, rowBottomY - 1, lineEnd, y, TITLE_BACKGROUND);
|
||||
Gui.drawRect(x, rowBottomY, lineEnd, rowBottomY - 1, DEFAULT_BACKGROUND);
|
||||
}
|
||||
fontRenderer.drawString(text, lineStart + lineWidth / 2 - fontRenderer.getStringWidth(text) / 2, y + 1, fontColor);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
||||
class TableValueText extends TableText {
|
||||
String value;
|
||||
|
||||
public TableValueText(String text, String value) {
|
||||
super(text);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(FontRenderer fontRenderer, int x, int y, int lineWidth, int lineStart, int lineEnd, int rowTopY, int rowBottomY, int fontColor, boolean drawBackground) {
|
||||
if(drawBackground) {
|
||||
Gui.drawRect(x, rowBottomY, lineEnd, rowTopY, DEFAULT_BACKGROUND);
|
||||
}
|
||||
fontRenderer.drawString(text, lineStart, rowTopY, fontColor);
|
||||
fontRenderer.drawString(value, lineEnd - fontRenderer.getStringWidth(value), rowTopY, fontColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineWidth(FontRenderer fontRenderer) {
|
||||
return fontRenderer.getStringWidth(text + value);
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,14 @@ public class TextureManagerForestry implements ITextureManager {
|
||||
public static void initDefaultSprites() {
|
||||
String[] defaultIconNames = new String[]{"habitats/desert", "habitats/end", "habitats/forest", "habitats/hills", "habitats/jungle", "habitats/mushroom",
|
||||
"habitats/nether", "habitats/ocean", "habitats/plains", "habitats/snow", "habitats/swamp", "habitats/taiga",
|
||||
"misc/access.shared", "misc/energy", "misc/hint", "misc/humidity", "misc/temperature",
|
||||
"misc/access.shared", "misc/energy", "misc/hint",
|
||||
"analyzer/anything", "analyzer/bee", "analyzer/cave", "analyzer/closed", "analyzer/drone", "analyzer/flyer",
|
||||
"analyzer/item", "analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave",
|
||||
"analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen",
|
||||
"errors/errored", "errors/unknown",
|
||||
"slots/blocked", "slots/blocked_2", "slots/liquid", "slots/container", "slots/locked", "slots/cocoon",
|
||||
"mail/carrier.player", "mail/carrier.trader"};
|
||||
"mail/carrier.player", "mail/carrier.trader",
|
||||
"modifiers/rain"};
|
||||
for (String identifier : defaultIconNames) {
|
||||
ResourceLocation resourceLocation = getForestryGuiLocation(identifier);
|
||||
INSTANCE.registerGuiSprite(resourceLocation);
|
||||
|
||||
@@ -61,11 +61,14 @@ import forestry.greenhouse.multiblock.blocks.ChunkEvents;
|
||||
import forestry.greenhouse.multiblock.blocks.world.GreenhouseBlockManager;
|
||||
import forestry.greenhouse.network.PacketRegistryGreenhouse;
|
||||
import forestry.greenhouse.proxy.ProxyGreenhouse;
|
||||
import forestry.greenhouse.tiles.TileClimatiser;
|
||||
import forestry.greenhouse.tiles.TileDehumidifier;
|
||||
import forestry.greenhouse.tiles.TileFan;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseControl;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseGearbox;
|
||||
import forestry.greenhouse.tiles.TileGreenhousePlain;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseWindow;
|
||||
import forestry.greenhouse.tiles.TileHeater;
|
||||
import forestry.greenhouse.tiles.TileHumidifier;
|
||||
import forestry.greenhouse.tiles.TileHygroregulator;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
@@ -135,7 +138,10 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
GameRegistry.registerTileEntity(TileGreenhouseGearbox.class, "forestry.GreenhouseGearbox");
|
||||
GameRegistry.registerTileEntity(TileGreenhouseControl.class, "forestry.GreenhouseController");
|
||||
GameRegistry.registerTileEntity(TileGreenhouseWindow.class, "forestry.ClimateSourceWindow");
|
||||
GameRegistry.registerTileEntity(TileClimatiser.class, "forestry.Climatiser");
|
||||
GameRegistry.registerTileEntity(TileFan.class, "forestry.GreenhouseFan");
|
||||
GameRegistry.registerTileEntity(TileHeater.class, "forestry.GreenhouseHeater");
|
||||
GameRegistry.registerTileEntity(TileDehumidifier.class, "forestry.GreenhouseDryer");
|
||||
GameRegistry.registerTileEntity(TileHumidifier.class, "forestry.GreenhouseSprinkler");
|
||||
|
||||
helper.registerWindowGlass("glass", new ItemStack(Blocks.GLASS), "blocks/glass");
|
||||
for (EnumDyeColor dye : EnumDyeColor.values()) {
|
||||
|
||||
@@ -5,11 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
@@ -42,6 +45,6 @@ public interface IClimateContainer extends INbtReadable, INbtWritable, IClimateS
|
||||
void setTargetedState(IClimateState state);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IClimateData getData();
|
||||
void addModifierInformation(IClimateModifier modifier, ClimateType type, List<String> lines);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
|
||||
public interface IClimateData {
|
||||
|
||||
IClimateData addData(ClimateType type, String displayName, float value);
|
||||
|
||||
/**
|
||||
* @return A map with all data that this object contains.
|
||||
*/
|
||||
Map<String, Float> getData(ClimateType type);
|
||||
}
|
||||
@@ -5,11 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
/**
|
||||
@@ -31,7 +39,11 @@ public interface IClimateModifier {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
default void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
default void addInformation(IClimateContainer container, NBTTagCompound nbtData, ClimateType type, List<String> lines) {
|
||||
}
|
||||
|
||||
default boolean canModify(ClimateType type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,4 +53,25 @@ public interface IClimateModifier {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String getName();
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
default TextureAtlasSprite getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
default ResourceLocation getTextureMap() {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemStack that represents this climate modifier. Used as an icon for the climate modifier if {@link #getIcon()} is null.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
default ItemStack getIconItemStack() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,10 @@ import forestry.core.utils.ItemTooltipUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.PluginGreenhouse;
|
||||
import forestry.greenhouse.models.ModelCamouflaged;
|
||||
import forestry.greenhouse.tiles.TileClimatiser;
|
||||
import forestry.greenhouse.tiles.TileDehumidifier;
|
||||
import forestry.greenhouse.tiles.TileFan;
|
||||
import forestry.greenhouse.tiles.TileHeater;
|
||||
import forestry.greenhouse.tiles.TileHumidifier;
|
||||
import forestry.greenhouse.tiles.TileHygroregulator;
|
||||
|
||||
public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteRegister, IItemModelRegister, IColoredBlock, IBlockCamouflaged<BlockClimatiser>, ITileEntityProvider {
|
||||
@@ -183,15 +186,15 @@ public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteReg
|
||||
BlockClimatiserType type = BlockClimatiserType.VALUES[meta];
|
||||
switch (type) {
|
||||
case DEHUMIDIFIER:
|
||||
return new TileClimatiser(TileClimatiser.DEHUMIDIFIER);
|
||||
return new TileDehumidifier();
|
||||
case HUMIDIFIER:
|
||||
return new TileClimatiser(TileClimatiser.HUMIDIFIER);
|
||||
return new TileHumidifier();
|
||||
case HYGRO:
|
||||
return new TileHygroregulator();
|
||||
case FAN:
|
||||
return new TileClimatiser(TileClimatiser.FAN);
|
||||
return new TileFan();
|
||||
case HEATER:
|
||||
return new TileClimatiser(TileClimatiser.HEATER);
|
||||
return new TileHeater();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.greenhouse.climate;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -29,14 +30,12 @@ import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.climate.AbsentClimateState;
|
||||
import forestry.core.climate.ClimateData;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.packets.PacketUpdateClimate;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
|
||||
@@ -241,12 +240,11 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IClimateData getData() {
|
||||
IClimateData data = new ClimateData();
|
||||
for(IClimateModifier modifier : GreenhouseClimateManager.getInstance().getModifiers()){
|
||||
modifier.addData(this, state, modifierData, data);
|
||||
public void addModifierInformation(IClimateModifier modifier, ClimateType type, List<String> lines) {
|
||||
if (!modifier.canModify(type)) {
|
||||
return;
|
||||
}
|
||||
return data;
|
||||
modifier.addInformation(this, modifierData, type, lines);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate.modifiers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -20,9 +24,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.render.TextureManagerForestry;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
|
||||
public class AltitudeModifier implements IClimateModifier {
|
||||
@@ -45,8 +50,29 @@ public class AltitudeModifier implements IClimateModifier {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
data.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.altitude"), nbtData.getFloat("altitudeChange"));
|
||||
public void addInformation(IClimateContainer container, NBTTagCompound nbtData, ClimateType type, List<String> lines) {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.altitude", StringUtil.floatAsPercent(nbtData.getFloat("altitudeChange"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(ClimateType type) {
|
||||
return type == ClimateType.TEMPERATURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.gui.modifier.altitude.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getIcon() {
|
||||
return TextureManagerForestry.getInstance().getDefault("habitats/hills");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getTextureMap() {
|
||||
return TextureManagerForestry.LOCATION_FORESTRY_TEXTURE;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,9 @@
|
||||
package forestry.greenhouse.climate.modifiers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -23,9 +25,10 @@ import forestry.api.climate.IClimateState;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.PluginGreenhouse;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
|
||||
@@ -113,18 +116,29 @@ public class ClimateSourceModifier implements IClimateModifier {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
public void addInformation(IClimateContainer container, NBTTagCompound nbtData, ClimateType type, List<String> lines) {
|
||||
IClimateState rangeDown = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("rangeDown"), ClimateStateType.MUTABLE);
|
||||
IClimateState rangeUp = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("rangeUp"), ClimateStateType.MUTABLE);
|
||||
IClimateState change = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("change"), ClimateStateType.MUTABLE);
|
||||
if (type == ClimateType.HUMIDITY) {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.range.up", StringUtil.floatAsPercent(rangeUp.getHumidity())));
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.range.down", StringUtil.floatAsPercent(rangeDown.getHumidity())));
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.change", StringUtil.floatAsPercent(change.getHumidity())));
|
||||
} else {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.range.up", StringUtil.floatAsPercent(rangeUp.getTemperature())));
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.range.down", StringUtil.floatAsPercent(rangeDown.getTemperature())));
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.sources.change", StringUtil.floatAsPercent(change.getTemperature())));
|
||||
}
|
||||
}
|
||||
|
||||
data.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.sources.range.up"), rangeUp.getHumidity())
|
||||
.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.sources.range.down"), rangeDown.getHumidity())
|
||||
.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.sources.change"), change.getHumidity());
|
||||
@Override
|
||||
public boolean canModify(ClimateType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
data.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.sources.range.up"), rangeUp.getTemperature())
|
||||
.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.sources.range.down"), rangeDown.getTemperature())
|
||||
.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.sources.change"), change.getTemperature());
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.gui.modifier.sources.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,4 +163,10 @@ public class ClimateSourceModifier implements IClimateModifier {
|
||||
}
|
||||
return ClimateStates.immutableOf(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getIconItemStack() {
|
||||
return PluginGreenhouse.getBlocks().window.getItem("glass");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate.modifiers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
@@ -20,9 +24,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
|
||||
public class TimeModifier implements IClimateModifier {
|
||||
@@ -60,8 +64,23 @@ public class TimeModifier implements IClimateModifier {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
data.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.time"), nbtData.getFloat("timeTemperatureChange"));
|
||||
public void addInformation(IClimateContainer container, NBTTagCompound nbtData, ClimateType type, List<String> lines) {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.time", StringUtil.floatAsPercent(nbtData.getFloat("timeTemperatureChange"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(ClimateType type) {
|
||||
return type == ClimateType.TEMPERATURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.gui.modifier.time.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Items.CLOCK);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate.modifiers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -18,9 +22,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.core.render.TextureManagerForestry;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
|
||||
public class WeatherModifier implements IClimateModifier {
|
||||
@@ -62,9 +67,34 @@ public class WeatherModifier implements IClimateModifier {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
data.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.rain"), nbtData.getFloat("rainHumidityChange"))
|
||||
.addData(ClimateType.TEMPERATURE, Translator.translateToLocal("for.gui.modifier.rain"), nbtData.getFloat("rainTemperatureChange"));
|
||||
public void addInformation(IClimateContainer container, NBTTagCompound nbtData, ClimateType type, List<String> lines) {
|
||||
if (type == ClimateType.HUMIDITY) {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.rain", StringUtil.floatAsPercent(nbtData.getFloat("rainHumidityChange"))));
|
||||
} else {
|
||||
lines.add(Translator.translateToLocalFormatted("for.gui.modifier.rain", StringUtil.floatAsPercent(nbtData.getFloat("rainTemperatureChange"))));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canModify(ClimateType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.gui.modifier.weather.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getIcon() {
|
||||
return TextureManagerForestry.getInstance().getDefault("modifiers/rain");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getTextureMap() {
|
||||
return TextureManagerForestry.LOCATION_FORESTRY_TEXTURE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class GuiGreenhouse extends GuiForestryTitled<ContainerGreenhouse> {
|
||||
float temp = temperaturePanel.parseValue();
|
||||
float hum = humidityPanel.parseValue();
|
||||
setClimate(container, temp, hum);
|
||||
NetworkUtil.sendToServer(new PacketSelectClimateTargeted(pos, climateState));
|
||||
NetworkUtil.sendToServer(new PacketSelectClimateTargeted(pos, container.getTargetedState()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
@@ -29,6 +28,7 @@ import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
import forestry.core.gui.GuiUtil;
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
@@ -72,12 +72,9 @@ public class WidgetCamouflageSlot extends Widget {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
TextureManager textureManager = minecraft.getTextureManager();
|
||||
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem renderItem = minecraft.getRenderItem();
|
||||
renderItem.renderItemIntoGUI(camouflageBlock, startX + xPos, startY + yPos);
|
||||
GuiUtil.drawItemStack(manager.gui, camouflageBlock, startX + xPos, startY + yPos);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ public class WidgetClimateBar extends Widget {
|
||||
IClimateState climateState = button.climate.climateState;
|
||||
((GuiGreenhouse) manager.gui).temperaturePanel.setValue(climateState.getTemperature());
|
||||
((GuiGreenhouse) manager.gui).humidityPanel.setValue(climateState.getHumidity());
|
||||
((GuiGreenhouse) manager.gui).sendNetworkUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package forestry.greenhouse.gui.widgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
|
||||
public class WidgetClimateModifier {
|
||||
public static final int WIDTH = 18;
|
||||
public static final int HEIGHT = 18;
|
||||
|
||||
private final int xPos;
|
||||
private final int yPos;
|
||||
private final WidgetClimatePanel parent;
|
||||
private final IClimateModifier modifier;
|
||||
private final ToolTip toolTip = new ToolTip(250) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void refresh() {
|
||||
toolTip.clear();
|
||||
toolTip.add(modifier.getName());
|
||||
List<String> lines = new ArrayList<>();
|
||||
parent.gui.container.addModifierInformation(modifier, parent.getType(), lines);
|
||||
for (String line : lines) {
|
||||
toolTip.add(line, TextFormatting.GRAY);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public WidgetClimateModifier(WidgetClimatePanel parent, int xPos, int yPos, IClimateModifier modifier) {
|
||||
this.parent = parent;
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public void draw(int startX, int startY) {
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||
textureManager.bindTexture(modifier.getTextureMap());
|
||||
TextureAtlasSprite icon = modifier.getIcon();
|
||||
if (icon == null) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
ItemStack stack = modifier.getIconItemStack();
|
||||
FontRenderer font = null;
|
||||
if (!stack.isEmpty()) {
|
||||
font = stack.getItem().getFontRenderer(stack);
|
||||
}
|
||||
if (font == null) {
|
||||
font = parent.gui.getFontRenderer();
|
||||
}
|
||||
|
||||
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
|
||||
itemRender.renderItemAndEffectIntoGUI(null, stack, xPos + startX, yPos + startY);
|
||||
itemRender.renderItemOverlayIntoGUI(font, stack, xPos + startX, yPos + startY, null);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
} else {
|
||||
parent.gui.drawTexturedModalRect(startX + xPos, startY + yPos, icon, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return mouseX >= xPos && mouseX < xPos + WIDTH && mouseY >= yPos && mouseY < yPos + HEIGHT;
|
||||
}
|
||||
|
||||
public ToolTip getToolTip(int mouseX, int mouseY) {
|
||||
if (!isVisible()) {
|
||||
return null;
|
||||
}
|
||||
if (!isMouseOver(mouseX, mouseY)) {
|
||||
return null;
|
||||
}
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
private boolean isVisible() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -11,25 +11,29 @@
|
||||
package forestry.greenhouse.gui.widgets;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Floats;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.core.gui.tables.Table;
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.render.ColourProperties;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.gui.GuiGreenhouse;
|
||||
|
||||
public class WidgetClimatePanel extends Widget {
|
||||
@@ -53,10 +57,10 @@ public class WidgetClimatePanel extends Widget {
|
||||
Float value = Floats.tryParse(text);
|
||||
return value != null && Floats.isFinite(value) && value >= 0.0F;
|
||||
};
|
||||
private final GuiGreenhouse gui;
|
||||
public final GuiGreenhouse gui;
|
||||
private final ClimateType type;
|
||||
private final Table table;
|
||||
private final GuiTextField textField;
|
||||
private List<WidgetClimateModifier> modifiers;
|
||||
|
||||
public WidgetClimatePanel(WidgetManager manager, GuiGreenhouse gui, int xPos, int yPos, ClimateType type) {
|
||||
super(manager, xPos, yPos);
|
||||
@@ -74,7 +78,17 @@ public class WidgetClimatePanel extends Widget {
|
||||
textField.setVisible(false);
|
||||
textField.setEnabled(false);
|
||||
}
|
||||
table = new Table();
|
||||
ImmutableList.Builder builder = new ImmutableList.Builder();
|
||||
int i = 0;
|
||||
for (IClimateModifier modifier : GreenhouseManager.climateManager.getModifiers()) {
|
||||
if (modifier.canModify(type)) {
|
||||
int xOffset = i % 5 * WidgetClimateModifier.WIDTH;
|
||||
int yOffset = i / 5 * WidgetClimateModifier.HEIGHT;
|
||||
builder.add(new WidgetClimateModifier(this, xPos + xOffset - 2, yPos + yOffset + (height - WidgetClimateModifier.HEIGHT * 3 - 7), modifier));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
this.modifiers = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,27 +105,24 @@ public class WidgetClimatePanel extends Widget {
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f);
|
||||
textField.drawTextBox();
|
||||
|
||||
updateData();
|
||||
table.draw(xPos + startX - 2, yPos + startY + 26, 14737632, false);
|
||||
String modifiersTitle = Translator.translateToLocal("for.gui.modifier.title");
|
||||
fontRenderer.drawStringWithShadow(TextFormatting.UNDERLINE + modifiersTitle, xPos + startX + width / 2 - fontRenderer.getStringWidth(modifiersTitle) / 2, yPos + startY + (height - WidgetClimateModifier.HEIGHT * 4), ColourProperties.INSTANCE.get("gui.greenhouse.modifiers.subheader"));
|
||||
|
||||
for (WidgetClimateModifier modifier : modifiers) {
|
||||
modifier.draw(startX, startY);
|
||||
}
|
||||
}
|
||||
|
||||
private int updateTimer = 0;
|
||||
|
||||
private void updateData() {
|
||||
if (updateTimer > 0) {
|
||||
updateTimer--;
|
||||
return;
|
||||
}
|
||||
updateTimer = 40;
|
||||
table.clear();
|
||||
IClimateData data = gui.container.getData();
|
||||
for (Map.Entry<String, Float> entry : data.getData(type).entrySet()) {
|
||||
float value = entry.getValue();
|
||||
int percent = (int) (value * 100);
|
||||
if (percent != 0) {
|
||||
table.addValueEntry(entry.getKey(), percent + " %");
|
||||
@Nullable
|
||||
@Override
|
||||
public ToolTip getToolTip(int mouseX, int mouseY) {
|
||||
for (WidgetClimateModifier modifier : modifiers) {
|
||||
ToolTip toolTip = modifier.getToolTip(mouseX, mouseY);
|
||||
if (toolTip != null) {
|
||||
return toolTip;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,4 +159,8 @@ public class WidgetClimatePanel extends Widget {
|
||||
}
|
||||
return textField.textboxKeyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
public ClimateType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,12 @@ public class ModelGreenhouseWindow extends ModelBlockCustomCached<BlockGreenhous
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
TileGreenhouseWindow window = TileUtil.getTile(world, pos, TileGreenhouseWindow.class);
|
||||
String glassName = "glass";
|
||||
if (window != null) {
|
||||
glassName = window.getGlass();
|
||||
if (world != null && pos != null) {
|
||||
TileGreenhouseWindow window = TileUtil.getTile(world, pos, TileGreenhouseWindow.class);
|
||||
if (window != null) {
|
||||
glassName = window.getGlass();
|
||||
}
|
||||
}
|
||||
return new Key(glassName, state.getValue(State.PROPERTY) == State.ON, false, state.getValue(BlockGreenhouseWindow.FACING));
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
@Override
|
||||
protected boolean updateServer(int tickCount) {
|
||||
if (provider.getState() == GreenhouseState.UNLOADED) {
|
||||
if (assembleTickCount + 20 <= tickCount) {
|
||||
if (assembleTickCount + 60 <= tickCount) {
|
||||
provider.create();
|
||||
}
|
||||
} else {
|
||||
|
||||
+5
-12
@@ -8,19 +8,12 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
package forestry.greenhouse.tiles;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
public class TileDehumidifier extends TileClimatiser {
|
||||
|
||||
abstract class TableText extends TableEntry {
|
||||
String text;
|
||||
|
||||
public TableText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineWidth(FontRenderer fontRenderer) {
|
||||
return fontRenderer.getStringWidth(text);
|
||||
public TileDehumidifier() {
|
||||
super(DEHUMIDIFIER);
|
||||
}
|
||||
|
||||
}
|
||||
+5
-10
@@ -8,17 +8,12 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.tables;
|
||||
package forestry.greenhouse.tiles;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
public class TileFan extends TileClimatiser {
|
||||
|
||||
class TableEmptyLine extends TableEntry {
|
||||
@Override
|
||||
public void draw(FontRenderer fontRenderer, int x, int y, int lineWidth, int lineStart, int lineEnd, int rowTopY, int rowBottomY, int fontColor, boolean drawBackground) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineWidth(FontRenderer fontRenderer) {
|
||||
return 0;
|
||||
public TileFan() {
|
||||
super(FAN);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.tiles;
|
||||
|
||||
public class TileHeater extends TileClimatiser {
|
||||
|
||||
public TileHeater() {
|
||||
super(HEATER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.tiles;
|
||||
|
||||
public class TileHumidifier extends TileClimatiser {
|
||||
|
||||
public TileHumidifier() {
|
||||
super(HUMIDIFIER);
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 223 B |
File renamed without changes.
|
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
@@ -20,7 +20,7 @@ gui.mail.text=6689dc
|
||||
|
||||
gui.greenhouse.temperature.header=404040
|
||||
gui.greenhouse.humidity.header=404040
|
||||
gui.greenhouse.sources.subheader=aaafb8
|
||||
gui.greenhouse.modifiers.subheader=aaafb8
|
||||
|
||||
ledger.error.background=ff3535
|
||||
ledger.error.header=e1c92f
|
||||
|
||||
Reference in new issue
Block a user