Revert greenhouse climate changes. Close #1319

This commit is contained in:
mezz committed 2016-06-13 15:27:19 -07:00
1 parent 8639148f20
commit f400241ff4
47 files changed
+515 -952

No files matched your search

@@ -7,7 +7,6 @@ package forestry.api.core;
import java.util.Set;
import forestry.api.core.climate.IClimateManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -1,9 +1,14 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
* 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
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.core.climate;
package forestry.api.core;
public interface IClimateControlled {
/**
@@ -3,24 +3,15 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core.climate;
package forestry.api.core;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* A climate source is used to change the climate in a region.
*/
public interface IClimateSource {
/**
* @param tickCount The current tick count.
* @param region The climate region, in that the source stands.
*/
void changeClimate(int tickCount, IClimateRegion region);
World getWorld();
BlockPos getPos();
public interface IClimateManager {
float getTemperature(World world, BlockPos pos);
float getHumidity(World world, BlockPos pos);
}
@@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core.climate;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateManager {
float getTemperature(World world, BlockPos pos);
float getHumidity(World world, BlockPos pos);
void addRegion(IClimateRegion region);
void removeRegion(IClimateRegion region);
void addSource(IClimateSource source);
void removeSource(IClimateSource source);
@Nullable
IClimateRegion getRegionForPos(World world, BlockPos pos);
@Nonnull
Map<Integer, List<IClimateRegion>> getRegions();
@Nonnull
Map<Integer, Map<BlockPos, IClimateSource>> getSources();
}
@@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core.climate;
import javax.annotation.Nonnull;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.util.math.BlockPos;
public interface IClimatePosition extends INbtReadable, INbtWritable {
@Nonnull
IClimateRegion getClimateRegion();
@Nonnull
BlockPos getPos();
void setTemperature(float temperature);
void addTemperature(float temperature);
float getTemperature();
void setHumidity(float humidity);
void addHumidity(float humidity);
float getHumidity();
}
@@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core.climate;
import java.util.Map;
import javax.annotation.Nonnull;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateRegion extends INbtReadable, INbtWritable {
@Nonnull
World getWorld();
/**
* Update the climate in a region, all 20 world ticks.
*/
void updateClimate();
@Nonnull
Map<BlockPos, IClimatePosition> getPositions();
}
@@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController;
public class DefaultGreenhouseListener implements IGreenhouseListener {
@Override
public boolean canWork(IGreenhouseController greenhouse, boolean canWork) {
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
return true;
}
@@ -18,15 +18,14 @@ import net.minecraftforge.fml.common.eventhandler.Event;
import forestry.api.core.EnumCamouflageType;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.api.multiblock.IGreenhouseController;
public class GreenhouseEvents extends Event {
@Nullable
public final IGreenhouseController controller;
public final IGreenhouseState state;
public GreenhouseEvents(@Nullable IGreenhouseController state) {
this.controller = state;
public GreenhouseEvents(@Nullable IGreenhouseState state) {
this.state = state;
}
public static class CamouflageChangeEvent extends GreenhouseEvents{
@@ -38,8 +37,8 @@ public class GreenhouseEvents extends Event {
@Nonnull
public final EnumCamouflageType camouflageType;
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull EnumCamouflageType camouflageType) {
super(controller);
public CamouflageChangeEvent(IGreenhouseState state, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull EnumCamouflageType camouflageType) {
super(state);
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
@@ -52,8 +51,8 @@ public class GreenhouseEvents extends Event {
@Nonnull
public IInternalBlock internalBlock;
public InternalBlockEvent(IGreenhouseController controller, @Nonnull IInternalBlock internalBlock) {
super(controller);
public InternalBlockEvent(IGreenhouseState state, @Nonnull IInternalBlock internalBlock) {
super(state);
this.internalBlock = internalBlock;
}
@@ -61,8 +60,8 @@ public class GreenhouseEvents extends Event {
public static class CreateInternalBlockEvent extends InternalBlockEvent{
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
super(controller, internalBlock);
public CreateInternalBlockEvent(IGreenhouseState state, IInternalBlock internalBlock) {
super(state, internalBlock);
}
}
@@ -71,8 +70,8 @@ public class GreenhouseEvents extends Event {
@Nonnull
public final IInternalBlockFace face;
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
super(controller, internalBlock);
public CheckInternalBlockFaceEvent(IGreenhouseState state, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
super(state, internalBlock);
this.face = face;
}
@@ -5,15 +5,14 @@
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IGreenhouseHelper {
/**
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
* @return A {@link IGreenhouseState} of a greenhouse, when the pos is a greenhouse
*/
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
IGreenhouseState getGreenhouseState(World world, BlockPos pos);
}
@@ -10,12 +10,12 @@ import forestry.api.multiblock.IGreenhouseController;
public interface IGreenhouseListener {
/**
* Called before the greenhouse update the climate system.
* Called before the greenhouse work.
*
* @param greenhouse The greenhouse of the listener.
* @param greenhouse The greenhouse multiblock.
* @param canWork The actual {@link Boolean} value.
* @return True if the greenhouse can update the climate.
* @return True if the greenhouse can work.
*/
boolean canWork(IGreenhouseController greenhouse, boolean canWork);
<G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork);
}
@@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import java.util.Collection;
import java.util.Set;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.multiblock.IMultiblockComponent;
public interface IGreenhouseState {
EnumTemperature getTemperature();
EnumHumidity getHumidity();
float getExactTemperature();
float getExactHumidity();
Set<IInternalBlock> getInternalBlocks();
Collection<IMultiblockComponent> getGreenhouseComponents();
}
@@ -7,7 +7,6 @@ package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraft.util.math.BlockPos;
@@ -7,7 +7,7 @@ package forestry.api.multiblock;
import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.core.climate.IClimateControlled;
import forestry.api.core.IClimateControlled;
/**
* Needs to be implemented by TileEntities that want to be part of an alveary.
@@ -5,7 +5,8 @@
******************************************************************************/
package forestry.api.multiblock;
import forestry.api.core.climate.IClimateSource;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseListener;
import forestry.api.lepidopterology.IButterflyCocoon;
import net.minecraft.item.ItemStack;
@@ -21,7 +22,8 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
interface Door extends IGreenhouseComponent {
}
interface Climatiser extends IGreenhouseComponent, IClimateSource {
interface Climatiser extends IGreenhouseComponent {
<G extends IGreenhouseController & IGreenhouseHousing & IClimateControlled> void changeClimate(int tickCount, G greenhouse);
}
interface ButterflyHatch extends IGreenhouseComponent {
@@ -7,15 +7,13 @@ package forestry.api.multiblock;
import java.util.List;
import javax.annotation.Nullable;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.climate.IClimateRegion;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseLogic;
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler {
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlled {
/**
* Handle change events.
@@ -26,8 +24,5 @@ public interface IGreenhouseController extends IMultiblockController, IGreenhous
* @return The logics of the greenhouse.
*/
List<IGreenhouseLogic> getLogics();
@Nullable
IClimateRegion getRegion();
}