mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 20:12:19 +00:00
Work on new climate system for the greenhouse
This commit is contained in:
1 parent
d55d86a3c5
commit
fbf30b1a73
30 files changed
+787
-180
No files matched your search
@@ -7,6 +7,7 @@ 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
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
package forestry.api.core.climate;
|
||||
|
||||
public interface IClimateControlled {
|
||||
/**
|
||||
+8
-1
@@ -3,8 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
package forestry.api.core.climate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.core.climate.IClimateWorld.ClimateChunk;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -14,4 +17,8 @@ public interface IClimateManager {
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
void registerWorld(IClimateWorld climateWorld);
|
||||
|
||||
Map<Integer, IClimateWorld> getClimateWorlds();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* 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.Stack;
|
||||
|
||||
import forestry.core.multiblock.RectangularMultiblockControllerBase;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateMap {
|
||||
|
||||
List<IClimatedPosition> getPositions();
|
||||
|
||||
World getWorld();
|
||||
|
||||
BlockPos getMinimumPos();
|
||||
|
||||
BlockPos getMaximumPos();
|
||||
|
||||
void updateClimate();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package forestry.api.core.climate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.climate.IClimateWorld.ClimateChunk;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateWorld {
|
||||
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
|
||||
int getDimensionID();
|
||||
|
||||
void updateClimate();
|
||||
|
||||
void addPositions(BlockPos minPos, BlockPos maxPos);
|
||||
|
||||
void addPosition(BlockPos pos);
|
||||
|
||||
void addPosition(IClimatedPosition position);
|
||||
|
||||
void addPositions(List<IClimatedPosition> positions);
|
||||
|
||||
IClimatedPosition getPosition(BlockPos pos);
|
||||
|
||||
void setChunk(ClimateChunk climateChunk);
|
||||
|
||||
@Nonnull
|
||||
Map<ChunkPos, ClimateChunk> getClimateChunks();
|
||||
|
||||
@Nonnull
|
||||
List<ClimateChunk> getDirtyClimateChunks();
|
||||
|
||||
void addDirtyClimateChunk(ClimateChunk chunk);
|
||||
|
||||
public static class ClimateChunk{
|
||||
|
||||
@Nonnull
|
||||
protected final Map<BlockPos, IClimatedPosition> climates;
|
||||
@Nonnull
|
||||
protected final IClimateWorld world;
|
||||
@Nonnull
|
||||
protected final ChunkPos chunkPos;
|
||||
|
||||
public ClimateChunk(@Nonnull IClimateWorld world, @Nonnull ChunkPos chunkPos) {
|
||||
this.world = world;
|
||||
this.chunkPos = chunkPos;
|
||||
climates = new HashMap<>();
|
||||
}
|
||||
|
||||
public void addPosition(IClimatedPosition position){
|
||||
world.addDirtyClimateChunk(this);
|
||||
climates.put(position.getPos(), position);
|
||||
}
|
||||
|
||||
public Map<BlockPos, IClimatedPosition> getClimates() {
|
||||
return climates;
|
||||
}
|
||||
|
||||
public IClimateWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public ChunkPos getChunkPos() {
|
||||
return chunkPos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.core.climate.IClimateHandler;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IClimatedPosition extends INbtReadable, INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
IClimateWorld getClimateWorld();
|
||||
|
||||
@Nonnull
|
||||
BlockPos getPos();
|
||||
|
||||
void setTemperature(float temperature);
|
||||
|
||||
float getTemperature();
|
||||
|
||||
void setHumidity(float humidity);
|
||||
|
||||
float getHumidity();
|
||||
|
||||
List<IClimateHandler> getHandlers();
|
||||
|
||||
void updateClimate();
|
||||
|
||||
}
|
||||
@@ -8,14 +8,20 @@ package forestry.api.greenhouse;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IGreenhouseState {
|
||||
|
||||
@Nonnull
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
@Nonnull
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
float getExactTemperature();
|
||||
|
||||
@@ -7,9 +7,13 @@ package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IInternalBlock {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
|
||||
/**
|
||||
* Needs to be implemented by TileEntities that want to be part of an alveary.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
@@ -23,7 +23,7 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
}
|
||||
|
||||
interface Climatiser extends IGreenhouseComponent {
|
||||
<G extends IGreenhouseController & IGreenhouseHousing & IClimateControlled> void changeClimate(int tickCount, G greenhouse);
|
||||
void changeClimate(int tickCount, IGreenhouseController controller);
|
||||
}
|
||||
|
||||
interface ButterflyHatch extends IGreenhouseComponent {
|
||||
|
||||
@@ -8,12 +8,13 @@ package forestry.api.multiblock;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.core.climate.IClimateMap;
|
||||
import forestry.api.greenhouse.EnumGreenhouseEventType;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlled {
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler {
|
||||
|
||||
/**
|
||||
* Handle change events.
|
||||
|
||||
Reference in new issue
Block a user