diff --git a/src/main/java/forestry/api/climate/IClimateSource.java b/src/main/java/forestry/api/climate/IClimateSource.java index 05592af34..6e6283000 100644 --- a/src/main/java/forestry/api/climate/IClimateSource.java +++ b/src/main/java/forestry/api/climate/IClimateSource.java @@ -13,8 +13,9 @@ public interface IClimateSource { /** * @param tickCount The current tick count. * @param region The climate region, in that the source stands. + * @return Return true if the the climate has changed. */ - void changeClimate(int tickCount, IClimateRegion region); + boolean changeClimate(int tickCount, IClimateRegion region); /** * @return The ticks that are required for one change. diff --git a/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java b/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java index 173195782..b99854873 100644 --- a/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java +++ b/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java @@ -17,8 +17,6 @@ import java.util.Locale; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; - import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/forestry/core/climate/ClimateEventHandler.java b/src/main/java/forestry/core/climate/ClimateEventHandler.java index 494297e05..fbf917532 100644 --- a/src/main/java/forestry/core/climate/ClimateEventHandler.java +++ b/src/main/java/forestry/core/climate/ClimateEventHandler.java @@ -132,10 +132,10 @@ public class ClimateEventHandler { red = 0.75F; offset = 6; } - event.getContext().func_189697_a(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX - 1 * deltaX, 0, deltaZ)), red, green, blue, 0.35F); - event.getContext().func_189696_b(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX - 1 * deltaX, 0, deltaZ)), red, green, blue, 0.35F); - event.getContext().func_189697_a(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX + offset * deltaX, 0, deltaZ)), red, green, blue, 0.35F); - event.getContext().func_189696_b(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX + offset * deltaX, 0, deltaZ)), red, green, blue, 0.35F); + event.getContext().drawSelectionBoundingBox(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX - 1 * deltaX, 0, deltaZ)), red, green, blue, 0.35F); + event.getContext().renderFilledBox(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX - 1 * deltaX, 0, deltaZ)), red, green, blue, 0.35F); + event.getContext().drawSelectionBoundingBox(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX + offset * deltaX, 0, deltaZ)), red, green, blue, 0.35F); + event.getContext().renderFilledBox(Block.FULL_BLOCK_AABB.offset(pos.getX() -d0, pos.getY() -d1, pos.getZ() -d2).offset(new BlockPos(deltaX + offset * deltaX, 0, deltaZ)), red, green, blue, 0.35F); } } } diff --git a/src/main/java/forestry/core/climate/ClimateManager.java b/src/main/java/forestry/core/climate/ClimateManager.java index d54f84de5..61f4dd57f 100644 --- a/src/main/java/forestry/core/climate/ClimateManager.java +++ b/src/main/java/forestry/core/climate/ClimateManager.java @@ -87,7 +87,7 @@ public class ClimateManager implements IClimateManager{ } IClimateRegion region = getRegionForPos(source.getWorldObj(), source.getCoordinates()); if(region != null){ - if(!region.getSources().contains(source.getClimateSource())){ + if(region.getSources().contains(source.getClimateSource())){ region.removeSource(source.getClimateSource()); } } diff --git a/src/main/java/forestry/core/climate/ClimateRoom.java b/src/main/java/forestry/core/climate/ClimateRoom.java index 427de2040..aab4d7124 100644 --- a/src/main/java/forestry/core/climate/ClimateRoom.java +++ b/src/main/java/forestry/core/climate/ClimateRoom.java @@ -114,10 +114,11 @@ public class ClimateRoom implements IClimateRegion, IStreamable { @Override public void updateClimate(int ticks) { + boolean hasChange = false;; for(IClimateSource source : sources){ if(source != null){ if(ticks % source.getTicksForChange(this) == 0){ - source.changeClimate(ticks, this); + hasChange |= source.changeClimate(ticks, this); } } } @@ -125,7 +126,7 @@ public class ClimateRoom implements IClimateRegion, IStreamable { for(Entry position : positions.entrySet()){ BlockPos pos = position.getKey(); if(world.isBlockLoaded(pos)){ - updateSides(pos); + hasChange |= updateSides(pos); if(!controller.isAssembled()){ IClimateControl climateControl = getControl(pos); @@ -134,25 +135,32 @@ public class ClimateRoom implements IClimateRegion, IStreamable { if(climatedInfo.getTemperature() != climateControl.getControlTemperature()){ if(climatedInfo.getTemperature() > climateControl.getControlTemperature()){ climatedInfo.addTemperature(-Math.min(0.01F, climatedInfo.getTemperature() - climateControl.getControlTemperature())); + hasChange = true; }else{ climatedInfo.addTemperature(Math.min(0.01F, climateControl.getControlTemperature() - climatedInfo.getTemperature())); + hasChange = true; } } if(climatedInfo.getHumidity() != climateControl.getControlHumidity()){ if(climatedInfo.getHumidity() > climateControl.getControlHumidity()){ climatedInfo.addHumidity(-Math.min(0.01F, climatedInfo.getHumidity() - climateControl.getControlHumidity())); + hasChange = true; }else{ climatedInfo.addHumidity(Math.min(0.01F, climateControl.getControlHumidity() - climatedInfo.getHumidity())); - + hasChange = true; } } } } } } + if(hasChange){ + temperature = getExactTemperature(); + humidity = getExactHumidity(); + } } - protected void updateSides(BlockPos pos){ + protected boolean updateSides(BlockPos pos){ IClimatePosition climatedInfo = positions.get(pos); IClimateControl climateControl = getControl(pos); boolean hasChange = false; @@ -175,10 +183,7 @@ public class ClimateRoom implements IClimateRegion, IStreamable { } } } - if(hasChange){ - temperature = getExactTemperature(); - humidity = getExactHumidity(); - } + return hasChange; } protected IClimateControl getControl(BlockPos pos){ diff --git a/src/main/java/forestry/core/climate/ClimateSource.java b/src/main/java/forestry/core/climate/ClimateSource.java index 0a96dbfca..a09b9b49e 100644 --- a/src/main/java/forestry/core/climate/ClimateSource.java +++ b/src/main/java/forestry/core/climate/ClimateSource.java @@ -28,7 +28,8 @@ public abstract class ClimateSource

implements } @Override - public void changeClimate(int tickCount, IClimateRegion region) { + public boolean changeClimate(int tickCount, IClimateRegion region) { + return false; } @Override diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index d8ac13c88..a68941f79 100644 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -29,7 +29,6 @@ import forestry.core.gui.slots.SlotForestry; import forestry.core.gui.slots.SlotLocked; import forestry.core.network.IForestryPacketClient; import forestry.core.proxy.Proxies; -import forestry.core.utils.Log; import forestry.core.utils.SlotUtil; import invtweaks.api.container.ContainerSection; diff --git a/src/main/java/forestry/core/render/TextureMapForestry.java b/src/main/java/forestry/core/render/TextureMapForestry.java index 12e467634..72843ae2b 100644 --- a/src/main/java/forestry/core/render/TextureMapForestry.java +++ b/src/main/java/forestry/core/render/TextureMapForestry.java @@ -148,7 +148,7 @@ public class TextureMapForestry extends TextureMap { flag = false; return flag; } finally { - IOUtils.closeQuietly((Closeable) iresource); + IOUtils.closeQuietly(iresource); } return flag; @@ -161,16 +161,19 @@ public class TextureMapForestry extends TextureMap { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Applying mipmap"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Sprite being mipmapped"); crashreportcategory.setDetail("Sprite name", new ICrashReportDetail() { + @Override public String call() throws Exception { return texture.getIconName(); } }); crashreportcategory.setDetail("Sprite size", new ICrashReportDetail() { + @Override public String call() throws Exception { return texture.getIconWidth() + " x " + texture.getIconHeight(); } }); crashreportcategory.setDetail("Sprite frames", new ICrashReportDetail() { + @Override public String call() throws Exception { return texture.getFrameCount() + " frames"; } diff --git a/src/main/java/forestry/greenhouse/GreenhouseClimateSource.java b/src/main/java/forestry/greenhouse/GreenhouseClimateSource.java index 8bc39b154..1379ebf3e 100644 --- a/src/main/java/forestry/greenhouse/GreenhouseClimateSource.java +++ b/src/main/java/forestry/greenhouse/GreenhouseClimateSource.java @@ -31,13 +31,14 @@ public class GreenhouseClimateSource

extends } @Override - public void changeClimate(int tickCount, IClimateRegion region) { + public boolean changeClimate(int tickCount, IClimateRegion region) { World world = region.getWorld(); IClimatiserDefinition definition = provider.getDefinition(); IMultiblockLogic logic = provider.getMultiblockLogic(); IMultiblockController controller = logic.getController(); Iterable positionsInRange = provider.getPositionsInRange(); + boolean hasChange = false; boolean isActive = false; if(logic.isConnected() && controller.isAssembled() && controller instanceof IGreenhouseControllerInternal && positionsInRange != null && positionsInRange.iterator().hasNext() && region != null){ IGreenhouseControllerInternal greenhouseInternal = (IGreenhouseControllerInternal) controller; @@ -88,10 +89,12 @@ public class GreenhouseClimateSource

extends if(position.getTemperature() < controlTemp) { if(canChange(mode, EnumClimatiserModes.POSITIVE)){ position.addTemperature(Math.min(change, controlTemp - position.getTemperature())); + hasChange = true; } }else if(position.getTemperature() > controlTemp){ if(canChange(mode, EnumClimatiserModes.NEGATIVE)){ position.addTemperature(-Math.min(position.getTemperature() - controlTemp, change)); + hasChange = true; } } } @@ -99,10 +102,12 @@ public class GreenhouseClimateSource

extends if(position.getHumidity() < controlHum) { if(canChange(mode, EnumClimatiserModes.POSITIVE)){ position.addHumidity(Math.min(change, controlHum - position.getHumidity())); + hasChange = true; } }else if(position.getHumidity() > controlHum){ if(canChange(mode, EnumClimatiserModes.NEGATIVE)){ position.addHumidity(-Math.min(position.getHumidity() - controlHum, change)); + hasChange = true; } } } @@ -114,6 +119,7 @@ public class GreenhouseClimateSource

extends if(provider.isActive() != isActive){ provider.setActive(isActive); } + return hasChange; } protected boolean canChange(EnumClimatiserTypes climatiserType, EnumClimatiserTypes type){ diff --git a/src/main/java/forestry/greenhouse/GreenhouseClimateWindow.java b/src/main/java/forestry/greenhouse/GreenhouseClimateWindow.java index 6cee694f0..e786ca6d6 100644 --- a/src/main/java/forestry/greenhouse/GreenhouseClimateWindow.java +++ b/src/main/java/forestry/greenhouse/GreenhouseClimateWindow.java @@ -25,13 +25,14 @@ public class GreenhouseClimateWindow extends GreenhouseClimateSource positionsInRange = provider.getPositionsInRange(); + boolean hasChange = false; WindowMode windowMode = provider.getMode(); if(logic.isConnected() && controller.isAssembled() && controller instanceof IGreenhouseControllerInternal && positionsInRange != null && positionsInRange.iterator().hasNext() && region != null){ IGreenhouseControllerInternal greenhouseInternal = (IGreenhouseControllerInternal) controller; @@ -67,10 +68,12 @@ public class GreenhouseClimateWindow extends GreenhouseClimateSource controlTemp){ if(canChange(mode, EnumClimatiserModes.NEGATIVE)){ position.addTemperature(-Math.min(position.getTemperature() - controlTemp, change)); + hasChange = true; } } } @@ -78,10 +81,12 @@ public class GreenhouseClimateWindow extends GreenhouseClimateSource controlHum){ if(canChange(mode, EnumClimatiserModes.NEGATIVE)){ position.addHumidity(-Math.min(position.getHumidity() - controlHum, change)); + hasChange = true; } } } @@ -90,6 +95,7 @@ public class GreenhouseClimateWindow extends GreenhouseClimateSource