Clean Up Climatisers

This commit is contained in:
Nedelosk committed 2017-09-02 18:07:46 +02:00
1 parent 2b0f5bfdf4
commit 3aa328a522
14 files changed
+29 -214

No files matched your search

@@ -22,7 +22,7 @@ public class Constants implements IForestryConstants {
public static final String MOD_ID = "forestry";
public static final String URL = "http://forestry.sengir.net/";
public static final String VERSION = "5.0.0.0";//"@VERSION@"
public static final String VERSION = "@VERSION@";
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
public static final String RF_MOD_ID = "CoFHAPI|energy";
@@ -46,11 +46,7 @@ import forestry.factory.tiles.TileStill;
import forestry.factory.tiles.TileWorktable;
import forestry.farming.tiles.TileFarm;
import forestry.greenhouse.items.ItemCamouflageSprayCan;
import forestry.greenhouse.tiles.TileDehumidifier;
import forestry.greenhouse.tiles.TileFan;
import forestry.greenhouse.tiles.TileGreenhouse;
import forestry.greenhouse.tiles.TileHeater;
import forestry.greenhouse.tiles.TileHumidifier;
import forestry.greenhouse.tiles.TileHygroregulator;
import forestry.mail.items.ItemCatalogue;
import forestry.mail.items.ItemLetter;
@@ -91,10 +87,6 @@ public class GuiIdRegistry {
TileFarm.class,
TileGreenhouse.class,
TileHeater.class,
TileFan.class,
TileHumidifier.class,
TileDehumidifier.class,
TileHygroregulator.class,
TileEngineBiogas.class,
@@ -61,15 +61,10 @@ 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.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.TileGreenhouseScreen;
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,15 +130,10 @@ public class PluginGreenhouse extends BlankForestryPlugin {
IGreenhouseHelper helper = GreenhouseManager.helper;
GameRegistry.registerTileEntity(TileGreenhousePlain.class, "forestry.GreenhousePlain");
GameRegistry.registerTileEntity(TileFan.class, "forestry.GreenhouseFan");
GameRegistry.registerTileEntity(TileHeater.class, "forestry.GreenhouseHeater");
GameRegistry.registerTileEntity(TileDehumidifier.class, "forestry.GreenhouseDryer");
GameRegistry.registerTileEntity(TileHumidifier.class, "forestry.GreenhouseSprinkler");
GameRegistry.registerTileEntity(TileHygroregulator.class, "forestry.ClimateSourceHygroregulator");
GameRegistry.registerTileEntity(TileGreenhouseGearbox.class, "forestry.GreenhouseGearbox");
GameRegistry.registerTileEntity(TileGreenhouseControl.class, "forestry.GreenhouseController");
GameRegistry.registerTileEntity(TileGreenhouseWindow.class, "forestry.ClimateSourceWindow");
GameRegistry.registerTileEntity(TileGreenhouseScreen.class, "forestry.GreenhouseScreen");
helper.registerWindowGlass("glass", new ItemStack(Blocks.GLASS), "blocks/glass");
for (EnumDyeColor dye : EnumDyeColor.values()) {
@@ -5,20 +5,12 @@
******************************************************************************/
package forestry.greenhouse.api.climate;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.circuits.ICircuit;
import forestry.api.core.ILocatable;
public interface IClimateSourceOwner extends ILocatable {
IClimateSource getClimateSource();
@SideOnly(Side.CLIENT)
ItemStack getItemStack();
boolean isActive();
/**
@@ -68,10 +68,7 @@ import forestry.core.utils.ItemTooltipUtil;
import forestry.core.utils.Translator;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.models.ModelCamouflaged;
import forestry.greenhouse.tiles.TileDehumidifier;
import forestry.greenhouse.tiles.TileFan;
import forestry.greenhouse.tiles.TileHeater;
import forestry.greenhouse.tiles.TileHumidifier;
import forestry.greenhouse.tiles.TileClimatiser;
import forestry.greenhouse.tiles.TileHygroregulator;
public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteRegister, IItemModelRegister, IColoredBlock, IBlockCamouflaged<BlockClimatiser>, ITileEntityProvider {
@@ -186,15 +183,15 @@ public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteReg
BlockClimatiserType type = BlockClimatiserType.VALUES[meta];
switch (type) {
case DEHUMIDIFIER:
return new TileDehumidifier();
return new TileClimatiser(TileClimatiser.DEHUMIDIFIER);
case HUMIDIFIER:
return new TileHumidifier();
return new TileClimatiser(TileClimatiser.HUMIDIFIER);
case HYGRO:
return new TileHygroregulator();
case FAN:
return new TileFan();
return new TileClimatiser(TileClimatiser.FAN);
case HEATER:
return new TileHeater();
return new TileClimatiser(TileClimatiser.HEATER);
}
return null;
}
@@ -79,7 +79,6 @@ import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
import forestry.greenhouse.tiles.TileGreenhouseControl;
import forestry.greenhouse.tiles.TileGreenhouseGearbox;
import forestry.greenhouse.tiles.TileGreenhousePlain;
import forestry.greenhouse.tiles.TileGreenhouseScreen;
public class BlockGreenhouse extends BlockStructure implements ISpriteRegister, IBlockWithMeta, IColoredBlock, IBlockCamouflaged<BlockGreenhouse> {
public static final PropertyEnum<BlockGreenhouseType> TYPE = PropertyEnum.create("type", BlockGreenhouseType.class);
@@ -230,8 +229,6 @@ public class BlockGreenhouse extends BlockStructure implements ISpriteRegister,
return new TileGreenhouseGearbox();
case CONTROL:
return new TileGreenhouseControl();
case SCREEN:
return new TileGreenhouseScreen();
default:
return new TileGreenhousePlain();
}
@@ -26,7 +26,6 @@ import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitBoard;
import forestry.api.circuits.ICircuitSocketType;
import forestry.api.climate.ClimateType;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.apiculture.network.packets.PacketActiveUpdate;
@@ -50,15 +49,24 @@ import forestry.greenhouse.gui.GuiClimatiser;
import forestry.greenhouse.multiblock.GreenhouseController;
import forestry.greenhouse.network.packets.PacketCamouflageSelectionServer;
public abstract class TileClimatiser extends TileForestry implements IActivatable, IStreamableGui, IClimateSourceOwner, ICamouflagedTile, ICamouflageHandler, ISocketable {
public class TileClimatiser extends TileForestry implements IActivatable, IStreamableGui, IClimateSourceOwner, ICamouflagedTile, ICamouflageHandler, ISocketable {
public static final ClimatiserDefinition HEATER = new ClimatiserDefinition(0.075F, 5F, ClimateSourceType.TEMPERATURE);
public static final ClimatiserDefinition FAN = new ClimatiserDefinition(-0.075F, 5F, ClimateSourceType.TEMPERATURE);
public static final ClimatiserDefinition HUMIDIFIER = new ClimatiserDefinition(0.075F, 5F, ClimateSourceType.HUMIDITY);
public static final ClimatiserDefinition DEHUMIDIFIER = new ClimatiserDefinition(-0.075F, 5F, ClimateSourceType.HUMIDITY);
private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets");
private final ClimateSource source;
private ItemStack camouflageBlock;
private boolean active;
protected TileClimatiser(float change, float range, ClimateType type) {
this(new ClimateSourceClimatiser(type == ClimateType.HUMIDITY ? ClimateSourceType.HUMIDITY : ClimateSourceType.TEMPERATURE, change, range));
public TileClimatiser(ClimatiserDefinition definition) {
this(definition.change, definition.range, definition.type);
}
protected TileClimatiser(float change, float range, ClimateSourceType type) {
this(new ClimateSourceClimatiser(type, change, range));
}
protected TileClimatiser(ClimateSource source) {
@@ -262,4 +270,15 @@ public abstract class TileClimatiser extends TileForestry implements IActivatabl
public ICircuitSocketType getSocketType() {
return CircuitSocketType.GREENHOUSE_CLIMATISER;
}
public static class ClimatiserDefinition {
float change, range;
ClimateSourceType type;
public ClimatiserDefinition(float change, float range, ClimateSourceType type) {
this.change = change;
this.range = range;
this.type = type;
}
}
}
@@ -1,34 +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.greenhouse.tiles;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.climate.ClimateType;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.blocks.BlockClimatiserType;
public class TileDehumidifier extends TileClimatiser {
public TileDehumidifier() {
super(-0.075F, 5F, ClimateType.HUMIDITY);
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return new ItemStack(PluginGreenhouse.getBlocks().climatiserBlock, 1, BlockClimatiserType.DEHUMIDIFIER.ordinal());
}
}
@@ -1,34 +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.greenhouse.tiles;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.climate.ClimateType;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.blocks.BlockClimatiserType;
public class TileFan extends TileClimatiser {
public TileFan() {
super(-0.075F, 5F, ClimateType.TEMPERATURE);
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return new ItemStack(PluginGreenhouse.getBlocks().climatiserBlock, 1, BlockClimatiserType.FAN.ordinal());
}
}
@@ -1,17 +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.greenhouse.tiles;
public class TileGreenhouseScreen extends TileGreenhouse {
public TileGreenhouseScreen() {
}
}
@@ -13,16 +13,12 @@ package forestry.greenhouse.tiles;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.apiculture.network.packets.PacketActiveUpdate;
import forestry.core.tiles.IActivatable;
import forestry.core.utils.NetworkUtil;
@@ -49,12 +45,6 @@ public class TileGreenhouseWindow extends TileEntity implements IActivatable, IC
return source;
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return ((BlockGreenhouseWindow) getBlockType()).getItem(glass);
}
@Override
public boolean isCircuitable() {
return false;
@@ -1,34 +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.greenhouse.tiles;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.climate.ClimateType;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.blocks.BlockClimatiserType;
public class TileHeater extends TileClimatiser {
public TileHeater() {
super(0.075F, 5F, ClimateType.TEMPERATURE);
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return new ItemStack(PluginGreenhouse.getBlocks().climatiserBlock, 1, BlockClimatiserType.HEATER.ordinal());
}
}
@@ -1,34 +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.greenhouse.tiles;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.climate.ClimateType;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.blocks.BlockClimatiserType;
public class TileHumidifier extends TileClimatiser {
public TileHumidifier() {
super(0.075F, 5F, ClimateType.HUMIDITY);
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return new ItemStack(PluginGreenhouse.getBlocks().climatiserBlock, 1, BlockClimatiserType.HUMIDIFIER.ordinal());
}
}
@@ -15,7 +15,6 @@ import javax.annotation.Nullable;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@@ -35,8 +34,6 @@ import forestry.core.fluids.Fluids;
import forestry.core.fluids.TankManager;
import forestry.core.recipes.HygroregulatorRecipe;
import forestry.core.tiles.ILiquidTankTile;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.blocks.BlockClimatiserType;
import forestry.greenhouse.climate.ClimateSourceHygroregulator;
import forestry.greenhouse.gui.ContainerHygroregulator;
import forestry.greenhouse.gui.GuiHygroregulator;
@@ -151,10 +148,4 @@ public class TileHygroregulator extends TileClimatiser implements ILiquidTankTil
return recipes;
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItemStack() {
return new ItemStack(PluginGreenhouse.getBlocks().climatiserBlock, 1, BlockClimatiserType.HYGRO.ordinal());
}
}