mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-23 21:39:51 +00:00
Fix a bug
This commit is contained in:
1 parent
ba7ef4228c
commit
28e7b561ea
7 files changed
+35
-4
No files matched your search
@@ -35,6 +35,6 @@ public interface IClimateManager {
|
||||
Map<Integer, List<IClimateRegion>> getRegions();
|
||||
|
||||
@Nonnull
|
||||
Map<Integer, List<IClimateSource>> getSources();
|
||||
Map<Integer, Map<BlockPos, IClimateSource>> getSources();
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package forestry.api.core.climate;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
@@ -18,6 +19,8 @@ public interface IClimateSource {
|
||||
*/
|
||||
void changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
World getWorld();
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController;
|
||||
public class DefaultGreenhouseListener implements IGreenhouseListener {
|
||||
|
||||
@Override
|
||||
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
|
||||
public boolean canWork(IGreenhouseController greenhouse, boolean canWork) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ClimateEventHandler {
|
||||
region.updateClimate();
|
||||
}
|
||||
}
|
||||
for(IClimateSource source : ForestryAPI.climateManager.getSources().get(Integer.valueOf(dim))){
|
||||
for(IClimateSource source : ForestryAPI.climateManager.getSources().get(Integer.valueOf(dim)).values()){
|
||||
source.changeClimate(ticks, ForestryAPI.climateManager.getRegionForPos(event.world, source.getPos()));
|
||||
}
|
||||
serverTicks.put(Integer.valueOf(dim), ticks+1);
|
||||
|
||||
@@ -23,10 +23,12 @@ import java.util.Set;
|
||||
import forestry.api.core.climate.IClimateManager;
|
||||
import forestry.api.core.climate.IClimatePosition;
|
||||
import forestry.api.core.climate.IClimateRegion;
|
||||
import forestry.api.core.climate.IClimateSource;
|
||||
|
||||
public class ClimateManager implements IClimateManager{
|
||||
|
||||
protected Map<Integer, List<IClimateRegion>> regions;
|
||||
protected Map<Integer, Map<BlockPos, IClimateSource>> sources;
|
||||
|
||||
public ClimateManager() {
|
||||
regions = new HashMap<>();
|
||||
@@ -62,6 +64,26 @@ public class ClimateManager implements IClimateManager{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSource(IClimateSource source) {
|
||||
if(sources.get(Integer.valueOf(source.getWorld().provider.getDimension())) == null){
|
||||
sources.put(Integer.valueOf(source.getWorld().provider.getDimension()), new HashMap<>());
|
||||
}
|
||||
if(sources.get(Integer.valueOf(source.getWorld().provider.getDimension())).keySet().contains(source.getPos())){
|
||||
sources.get(Integer.valueOf(source.getWorld().provider.getDimension())).remove(source.getPos(), source);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSource(IClimateSource source) {
|
||||
if(sources.get(Integer.valueOf(source.getWorld().provider.getDimension())) == null){
|
||||
sources.put(Integer.valueOf(source.getWorld().provider.getDimension()), new HashMap<>());
|
||||
}
|
||||
if(!sources.get(Integer.valueOf(source.getWorld().provider.getDimension())).keySet().contains(source.getPos())){
|
||||
sources.get(Integer.valueOf(source.getWorld().provider.getDimension())).put(source.getPos(), source);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTemperature(World world, BlockPos pos) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
@@ -113,5 +135,10 @@ public class ClimateManager implements IClimateManager{
|
||||
}
|
||||
return regions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, Map<BlockPos, IClimateSource>> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TileGreenhouseControl extends TileGreenhouse implements IGreenhouse
|
||||
}
|
||||
|
||||
@Override
|
||||
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
|
||||
public boolean canWork(IGreenhouseController greenhouse, boolean canWork) {
|
||||
return canWork && !hasRedstoneSignal();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user