mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 23:03:18 +00:00
Fix greenhouse door logic
This commit is contained in:
1 parent
0f3e63ed20
commit
27d6cf1219
1 file changed
+16
-5
@@ -13,6 +13,10 @@ package forestry.greenhouse.logics;
|
||||
import forestry.api.greenhouse.DefaultGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IGreenhouseClimaLogic;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseDoor;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class GreenhouseLogicGreenhouseDoor extends DefaultGreenhouseLogic implements IGreenhouseClimaLogic{
|
||||
@@ -28,12 +32,19 @@ public class GreenhouseLogicGreenhouseDoor extends DefaultGreenhouseLogic implem
|
||||
if(controller == null || !controller.isAssembled()){
|
||||
return;
|
||||
}
|
||||
if(controller.getWorld().isDaytime()){
|
||||
if(workTimer++>20){
|
||||
controller.addTemperatureChange(-0.0001F, 0.05F, 2.5F);
|
||||
controller.addHumidityChange(-0.0001F, 0.05F, 2.5F);
|
||||
workTimer = 0;
|
||||
if(workTimer++>20){
|
||||
int openDoors = 0;
|
||||
for(IMultiblockComponent component : controller.getComponents()){
|
||||
if(component instanceof TileGreenhouseDoor){
|
||||
IBlockState state = ((TileGreenhouseDoor) component).getWorld().getBlockState(component.getCoordinates());
|
||||
if(state.getValue(BlockDoor.OPEN)){
|
||||
openDoors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.addTemperatureChange(-0.0001F * openDoors, 0.05F, 2.5F);
|
||||
controller.addHumidityChange(-0.0001F * openDoors, 0.05F, 2.5F);
|
||||
workTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user