mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Move Greenhouse classes out of the api
This commit is contained in:
1 parent
8bb1b74b1c
commit
38189388f6
96 files changed
+537
-429
No files matched your search
@@ -5,23 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
/**
|
||||
* @return The current state of a container at this position if one exists.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
@Nullable
|
||||
IClimateContainer getContainer(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Gets the current state of a container at this position or setSettings one with the datas from the biome.
|
||||
* @since 5.3.4
|
||||
@@ -37,11 +25,4 @@ public interface IClimateManager {
|
||||
* @return Create a climate manager.
|
||||
*/
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addSource(IClimateSourceOwner owner);
|
||||
|
||||
void removeSource(IClimateSourceOwner owner);
|
||||
|
||||
Collection<IClimateSourceOwner> getSources(World world, Position2D position);
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import forestry.api.core.INbtWritable;
|
||||
*
|
||||
* The range of the value of this two goes from 0.0F to 2.0F. And is oriented on the values of {@link Biome#getTemperature()} and {@link Biome#getRainfall()}.
|
||||
*
|
||||
* Default inmplementations are: {@link ImmutableClimateState}, {@link ClimateState} and {@link ClimateChange}.
|
||||
* Default inmplementations are: {@link ImmutableClimateState}, {@link ClimateState}.
|
||||
*/
|
||||
public interface IClimateState extends INbtWritable {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateFactory;
|
||||
import forestry.greenhouse.api.climate.IClimateFactory;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
|
||||
+3
-6
@@ -3,17 +3,14 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateHousing {
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
|
||||
/**
|
||||
* @return The climate container of this region.
|
||||
*/
|
||||
IClimateContainer getClimateContainer();
|
||||
public interface IClimateHousing {
|
||||
|
||||
/**
|
||||
* @return The size of the region in blocks.
|
||||
@@ -5,9 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
@@ -33,15 +30,4 @@ public interface IGreenhouseHousing extends IErrorLogicSource, IClimateHousing{
|
||||
* @return The current humidity as an float. Range: 0.0F ~ 2.0F
|
||||
*/
|
||||
float getExactHumidity();
|
||||
|
||||
/**
|
||||
* @return the manager of this housing.
|
||||
*/
|
||||
IGreenhouseProvider getProvider();
|
||||
|
||||
/**
|
||||
* @return the maximal and minimal settings of this housing.
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseLimits getLimits();
|
||||
}
|
||||
@@ -27,19 +27,19 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateState;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateContainerListener;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.climate.IClimateModifier;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.packets.PacketUpdateClimate;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainerListener;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.climate.GreenhouseClimateManager;
|
||||
|
||||
public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
public static final float CLIMATE_CHANGE = 0.01F;
|
||||
@@ -87,7 +87,7 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
}else{
|
||||
ImmutableClimateState oldState = state.toImmutable();
|
||||
state = parent.getDefaultClimate().toMutable();
|
||||
for(IClimateModifier modifier : GreenhouseManager.greenhouseHelper.getModifiers()){
|
||||
for(IClimateModifier modifier : GreenhouseClimateManager.getInstance().getModifiers()){
|
||||
state = modifier.modifyTarget(this, state, oldState, modifierData).toMutable();
|
||||
}
|
||||
if(!state.equals(oldState)) {
|
||||
@@ -255,7 +255,7 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListaner(IClimateContainerListener listener) {
|
||||
public void addListener(IClimateContainerListener listener) {
|
||||
listeners.addListaner(listener);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IClimateData getData() {
|
||||
IClimateData data = new ClimateData();
|
||||
for(IClimateModifier modifier : GreenhouseManager.greenhouseHelper.getModifiers()){
|
||||
for(IClimateModifier modifier : GreenhouseClimateManager.getInstance().getModifiers()){
|
||||
modifier.addData(this, state, modifierData, data);
|
||||
}
|
||||
return data;
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
|
||||
public class ClimateData implements IClimateData {
|
||||
private final Map<String, Float> temperatureData = new LinkedHashMap<>();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package forestry.core.climate;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateFactory;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateFactory;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
|
||||
public class ClimateFactory implements IClimateFactory{
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,14 +17,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.ILocatable;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.core.DefaultClimateProvider;
|
||||
import forestry.core.utils.World2ObjectMap;
|
||||
|
||||
@@ -69,53 +62,9 @@ public class ClimateManager implements IClimateManager {
|
||||
return manager.getClimateState(world, pos);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IClimateContainer getContainer(World world, BlockPos pos) {
|
||||
ClimateWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return null;
|
||||
}
|
||||
return manager.getContainer(world, pos);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IClimateContainer getContainer(ILocatable locatable){
|
||||
return getContainer(locatable.getWorldObj(), locatable.getCoordinates());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateProvider getDefaultClimate(World world, BlockPos pos) {
|
||||
return new DefaultClimateProvider(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSource(IClimateSourceOwner owner){
|
||||
World world = owner.getWorldObj();
|
||||
ClimateWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return;
|
||||
}
|
||||
manager.addSource(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSource(IClimateSourceOwner owner){
|
||||
World world = owner.getWorldObj();
|
||||
ClimateWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return;
|
||||
}
|
||||
manager.removeSource(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IClimateSourceOwner> getSources(World world, Position2D position) {
|
||||
ClimateWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return manager.getSources(position);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,14 +14,14 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.ClimateChange;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.climate.ClimateChange;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
|
||||
public abstract class ClimateSource<O extends IClimateSourceOwner> implements IClimateSource {
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
public void onLoad() {
|
||||
World world = owner.getWorldObj();
|
||||
if(!addedToManager && !world.isRemote) {
|
||||
ForestryAPI.climateManager.addSource(owner);
|
||||
GreenhouseManager.climateManager.addSource(owner);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
public void onChunkUnload() {
|
||||
World world = owner.getWorldObj();
|
||||
if(addedToManager &&!world.isRemote) {
|
||||
ForestryAPI.climateManager.removeSource(owner);
|
||||
GreenhouseManager.climateManager.removeSource(owner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.core.climate;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,34 +13,27 @@ package forestry.core.climate;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.multiblock.blocks.world.GreenhouseBlockManager;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IGreenhouseClimateManager;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
|
||||
public class ClimateWorldManager{
|
||||
|
||||
private final Set<IClimateContainer> containers;
|
||||
|
||||
private final Cache<BlockPos, IClimateState> stateCache;
|
||||
private final ClimateManager parent;
|
||||
private final Map<Position2D, Map<Integer, IClimateSourceOwner>> owners;
|
||||
|
||||
public ClimateWorldManager(ClimateManager parent) {
|
||||
this.containers = new HashSet<>();
|
||||
this.stateCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.SECONDS).build();
|
||||
this.parent = parent;
|
||||
this.owners = new HashMap<>();
|
||||
@@ -49,7 +42,8 @@ public class ClimateWorldManager{
|
||||
public IClimateState getClimateState(World world, BlockPos pos) {
|
||||
IClimateState cacheState = stateCache.getIfPresent(pos);
|
||||
if(cacheState == null){
|
||||
IClimateContainer container = getContainer(world, pos);
|
||||
IGreenhouseClimateManager climateSourceManager = GreenhouseManager.climateManager;
|
||||
IClimateContainer container = climateSourceManager.getContainer(world, pos);
|
||||
|
||||
if (container != null) {
|
||||
cacheState = container.getState();
|
||||
@@ -62,42 +56,4 @@ public class ClimateWorldManager{
|
||||
return cacheState;
|
||||
}
|
||||
|
||||
public IClimateContainer getContainer(World world, BlockPos pos) {
|
||||
IGreenhouseBlock logicBlock = GreenhouseBlockManager.getInstance().getBlock(world, pos);
|
||||
if(logicBlock != null){
|
||||
IGreenhouseProvider provider = logicBlock.getProvider();
|
||||
if(!provider.isClosed()) {
|
||||
return null;
|
||||
}
|
||||
return provider.getClimateContainer();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<IClimateContainer> getContainers() {
|
||||
return containers;
|
||||
}
|
||||
|
||||
public void addSource(IClimateSourceOwner owner){
|
||||
BlockPos pos = owner.getCoordinates();
|
||||
Position2D position = new Position2D(pos);
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k->new HashMap<>());
|
||||
positionedOwners.put(pos.getY(), owner);
|
||||
}
|
||||
|
||||
public void removeSource(IClimateSourceOwner owner){
|
||||
BlockPos pos = owner.getCoordinates();
|
||||
Position2D position = new Position2D(pos);
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k->new HashMap<>());
|
||||
positionedOwners.remove(pos.getY());
|
||||
}
|
||||
|
||||
public Collection<IClimateSourceOwner> getSources(Position2D position) {
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.get(position);
|
||||
if(positionedOwners == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return positionedOwners.values();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
|
||||
@@ -15,16 +15,18 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.core.climate.ClimateContainer;
|
||||
import forestry.core.multiblock.MultiblockUtil;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.IForestryPacketHandlerClient;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.PacketIdClient;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
|
||||
public class PacketUpdateClimate extends ForestryPacket implements IForestryPacketClient {
|
||||
|
||||
@@ -51,7 +53,8 @@ public class PacketUpdateClimate extends ForestryPacket implements IForestryPack
|
||||
@Override
|
||||
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
|
||||
BlockPos position = data.readBlockPos();
|
||||
IClimateHousing housing = TileUtil.getTile(player.world, position, IClimateHousing.class);
|
||||
//TODO:Greenhouse Api
|
||||
/*IClimateHousing housing = TileUtil.getTile(player.world, position, IClimateHousing.class);
|
||||
if(housing != null){
|
||||
IClimateContainer container = housing.getClimateContainer();
|
||||
if(container != null && container instanceof IStreamable){
|
||||
@@ -60,6 +63,17 @@ public class PacketUpdateClimate extends ForestryPacket implements IForestryPack
|
||||
IClimateHousing parent = container.getParent();
|
||||
parent.onUpdateClimate();
|
||||
}
|
||||
}*/
|
||||
IGreenhouseControllerInternal controller = MultiblockUtil.getController(player.world, position, IGreenhouseComponent.class);
|
||||
if(controller == null){
|
||||
return;
|
||||
}
|
||||
IClimateContainer container = controller.getClimateContainer();
|
||||
if(container != null && container instanceof IStreamable){
|
||||
IStreamable streamable = (IStreamable) container;
|
||||
streamable.readData(data);
|
||||
IClimateHousing parent = container.getParent();
|
||||
parent.onUpdateClimate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.core.multiblock.MultiblockUtil;
|
||||
import forestry.greenhouse.items.ItemGreenhouseScreen;
|
||||
|
||||
@@ -15,27 +15,19 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.climate.IClimateModifier;
|
||||
import forestry.api.greenhouse.IGreenhouseHelper;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IGreenhouseLogicFactory;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseHelper;
|
||||
|
||||
public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
|
||||
private final Set<IClimateModifier> modifiers;
|
||||
private List<IGreenhouseLogicFactory> factories = new ArrayList<>();
|
||||
private Map<String, GreenhouseWindowGlass> windowGlasses = new HashMap<>();
|
||||
|
||||
public GreenhouseHelper() {
|
||||
modifiers = new TreeSet<IClimateModifier>((firstModifier, secondModifier) -> firstModifier.getPriority() > secondModifier.getPriority() ? 1 : -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWindowGlass(String name, ItemStack item, String texture) {
|
||||
windowGlasses.put(name, new GreenhouseWindowGlass(name, texture, item));
|
||||
@@ -78,16 +70,6 @@ public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
return logics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModifier(IClimateModifier modifier) {
|
||||
modifiers.add(modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IClimateModifier> getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
private final class GreenhouseWindowGlass {
|
||||
ItemStack item;
|
||||
String name;
|
||||
|
||||
@@ -31,8 +31,6 @@ import forestry.api.climate.ClimateType;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.api.greenhouse.IGreenhouseHelper;
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
@@ -43,12 +41,16 @@ import forestry.core.items.ItemRegistryCore;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import forestry.greenhouse.api.climate.IGreenhouseClimateManager;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseHelper;
|
||||
import forestry.greenhouse.blocks.BlockClimatiserType;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
import forestry.greenhouse.blocks.BlockRegistryGreenhouse;
|
||||
import forestry.greenhouse.camouflage.CamouflageAccess;
|
||||
import forestry.greenhouse.camouflage.CamouflageHandlerBlock;
|
||||
import forestry.greenhouse.circuits.CircuitClimateSource;
|
||||
import forestry.greenhouse.climate.GreenhouseClimateManager;
|
||||
import forestry.greenhouse.climate.modifiers.AltitudeModifier;
|
||||
import forestry.greenhouse.climate.modifiers.ClimateSourceModifier;
|
||||
import forestry.greenhouse.climate.modifiers.TimeModifier;
|
||||
@@ -72,11 +74,6 @@ import forestry.greenhouse.tiles.TileHygroregulator;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.GREENHOUSE, name = "Greenhouse", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.greenhouse.description")
|
||||
public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
@@ -109,8 +106,9 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
GreenhouseManager.greenhouseHelper = new GreenhouseHelper();
|
||||
GreenhouseManager.greenhouseBlockManager = GreenhouseBlockManager.getInstance();
|
||||
GreenhouseManager.helper = new GreenhouseHelper();
|
||||
GreenhouseManager.blockManager = GreenhouseBlockManager.getInstance();
|
||||
GreenhouseManager.climateManager = GreenhouseClimateManager.getInstance();
|
||||
CamouflageManager.camouflageAccess = new CamouflageAccess();
|
||||
}
|
||||
|
||||
@@ -134,7 +132,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
@Override
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
IGreenhouseHelper helper = GreenhouseManager.greenhouseHelper;
|
||||
IGreenhouseHelper helper = GreenhouseManager.helper;
|
||||
|
||||
GameRegistry.registerTileEntity(TileGreenhousePlain.class, "forestry.GreenhousePlain");
|
||||
GameRegistry.registerTileEntity(TileFan.class, "forestry.GreenhouseFan");
|
||||
@@ -152,10 +150,11 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
helper.registerWindowGlass("glass" + dye.getName(), new ItemStack(Blocks.STAINED_GLASS, 1, dye.getMetadata()), "blocks/glass_" + dye.getName());
|
||||
}
|
||||
|
||||
helper.registerModifier(new WeatherModifier());
|
||||
helper.registerModifier(new TimeModifier());
|
||||
helper.registerModifier(new AltitudeModifier());
|
||||
helper.registerModifier(new ClimateSourceModifier());
|
||||
IGreenhouseClimateManager climateSourceManager = GreenhouseClimateManager.getInstance();
|
||||
climateSourceManager.registerModifier(new WeatherModifier());
|
||||
climateSourceManager.registerModifier(new TimeModifier());
|
||||
climateSourceManager.registerModifier(new AltitudeModifier());
|
||||
climateSourceManager.registerModifier(new ClimateSourceModifier());
|
||||
|
||||
Circuits.greenhouseClimatiserTemperature1 = new CircuitClimateSource("climatiser.temperature.1", ClimateType.TEMPERATURE, 0.125F, 0.125F);
|
||||
Circuits.greenhouseClimatiserTemperature2 = new CircuitClimateSource("climatiser.temperature.2", ClimateType.TEMPERATURE, 0.25F, 0.25F);
|
||||
@@ -236,8 +235,8 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'#', OreDictUtil.INGOT_TIN,
|
||||
'T', coreItems.tubes.get(EnumElectronTube.LAPIS, 1));
|
||||
|
||||
for (String glassName : GreenhouseManager.greenhouseHelper.getWindowGlasses()) {
|
||||
ItemStack glassItem = GreenhouseManager.greenhouseHelper.getGlassItem(glassName);
|
||||
for (String glassName : GreenhouseManager.helper.getWindowGlasses()) {
|
||||
ItemStack glassItem = GreenhouseManager.helper.getGlassItem(glassName);
|
||||
ItemStack window = blocks.window.getItem(glassName);
|
||||
ItemStack roodWindow = blocks.roofWindow.getItem(glassName);
|
||||
RecipeUtil.addRecipe("greenhouse_window_" + glassName, roodWindow,
|
||||
|
||||
+4
-1
@@ -3,10 +3,13 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
|
||||
public class BlankClimateModifier implements IClimateModifier {
|
||||
@Override
|
||||
public IClimateState modifyTarget(IClimateContainer container, IClimateState newState, ImmutableClimateState oldState, NBTTagCompound data) {
|
||||
+4
-1
@@ -3,13 +3,16 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import forestry.api.climate.ClimateState;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.INbtReadable;
|
||||
|
||||
/**
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
public enum GreenhouseState {
|
||||
CLOSED,
|
||||
+5
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@@ -13,8 +13,11 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
|
||||
public interface IClimateContainer extends INbtReadable, INbtWritable, IClimateSourceContainer {
|
||||
|
||||
@@ -38,7 +41,7 @@ public interface IClimateContainer extends INbtReadable, INbtWritable, IClimateS
|
||||
/**
|
||||
* Add a listener to this container.
|
||||
*/
|
||||
void addListaner(IClimateContainerListener listener);
|
||||
void addListener(IClimateContainerListener listener);
|
||||
|
||||
/**
|
||||
* Remove a listener to this container.
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
public interface IClimateContainerListener {
|
||||
|
||||
+3
-1
@@ -3,10 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
|
||||
public interface IClimateData {
|
||||
|
||||
IClimateData addData(ClimateType type, String displayName, float value);
|
||||
+3
-1
@@ -3,7 +3,9 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
|
||||
public interface IClimateFactory {
|
||||
|
||||
+4
-1
@@ -3,13 +3,16 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
|
||||
/**
|
||||
* This modifier is used by {@link IClimateContainer}s.
|
||||
*/
|
||||
+6
-2
@@ -3,12 +3,16 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
|
||||
/**
|
||||
* A climate source is stored in a {@link IClimateSourceOwner}. It is used by the {@link IClimateSourceContainer}s to change the climate of a {@link IClimateContainer}.
|
||||
* A climate source is stored in a {@link IClimateSourceOwner}. It is used by the {@link IClimateSourceContainer}s to change the climate of a {@link IClimateContainer}.
|
||||
* One {@link IClimateSource} can only be used by one {@link IClimateSourceContainer} at the same time.
|
||||
* <p>
|
||||
* In forestry it is used in a part of a {@link IClimateModifier}.
|
||||
+2
-1
@@ -3,9 +3,10 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.climate.ClimateType;
|
||||
|
||||
public interface IClimateSourceCircuitable extends IClimateSource {
|
||||
/**
|
||||
+3
-1
@@ -3,10 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
/**
|
||||
* @since 5.3.4
|
||||
*
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
|
||||
public interface IGreenhouseClimateManager {
|
||||
/**
|
||||
* @return The current state of a container at this position if one exists.
|
||||
*/
|
||||
@Nullable
|
||||
IClimateContainer getContainer(World world, BlockPos pos);
|
||||
|
||||
void addSource(IClimateSourceOwner owner);
|
||||
|
||||
void removeSource(IClimateSourceOwner owner);
|
||||
|
||||
Collection<IClimateSourceOwner> getSources(World world, Position2D position);
|
||||
|
||||
void registerModifier(IClimateModifier modifier);
|
||||
|
||||
Collection<IClimateModifier> getModifiers();
|
||||
}
|
||||
+5
-7
@@ -3,12 +3,10 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
public class GreenhouseManager {
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public static IGreenhouseHelper greenhouseHelper;
|
||||
|
||||
public static IGreenhouseBlockManager greenhouseBlockManager;
|
||||
|
||||
}
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+2
-1
@@ -3,8 +3,9 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
|
||||
public class DefaultGreenhouseListener implements IGreenhouseListener {
|
||||
@@ -0,0 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.greenhouse.api.climate.IGreenhouseClimateManager;
|
||||
|
||||
public class GreenhouseManager {
|
||||
|
||||
@Nullable
|
||||
public static IGreenhouseHelper helper;
|
||||
@Nullable
|
||||
public static IGreenhouseBlockManager blockManager;
|
||||
@Nullable
|
||||
public static IGreenhouseClimateManager climateManager;
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Set;
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
+3
-6
@@ -3,13 +3,14 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.climate.IClimateModifier;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IGreenhouseLogicFactory;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
|
||||
public interface IGreenhouseHelper {
|
||||
@@ -25,9 +26,5 @@ public interface IGreenhouseHelper {
|
||||
void registerLogic(IGreenhouseLogicFactory logicFactory);
|
||||
|
||||
Collection<IGreenhouseLogic> createLogics(IGreenhouseController controller);
|
||||
|
||||
void registerModifier(IClimateModifier modifier);
|
||||
|
||||
Collection<IClimateModifier> getModifiers();
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
/**
|
||||
* The limits that a greenhouse has. Used in the {@link IGreenhouseProvider} to test if the greenhouse is tested.
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@@ -11,8 +11,8 @@ import java.util.Collection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.GreenhouseState;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.GreenhouseState;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
/**
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
|
||||
public interface IWallBlock extends IGreenhouseBlock {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
|
||||
package forestry.greenhouse.api.greenhouse;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -49,7 +49,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
@@ -57,7 +57,7 @@ import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
import forestry.api.core.ITextureManager;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
|
||||
@@ -49,7 +49,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.core.blocks.IBlockRotatable;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
@@ -197,7 +197,7 @@ public class BlockGreenhouseWindow extends Block implements IBlockRotatable, ITi
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (String glass : GreenhouseManager.greenhouseHelper.getWindowGlasses()) {
|
||||
for (String glass : GreenhouseManager.helper.getWindowGlasses()) {
|
||||
list.add(getItem(glass));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ package forestry.greenhouse.circuits;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateSourceCircuitable;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceCircuitable;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.core.circuits.Circuit;
|
||||
|
||||
public class CircuitClimateSource extends Circuit {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateSourceCircuitable;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceCircuitable;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.core.climate.ClimateSource;
|
||||
import forestry.core.climate.ClimateSourceType;
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import forestry.api.climate.ClimateChange;
|
||||
import forestry.greenhouse.api.climate.ClimateChange;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.greenhouse.climate;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.climate.ClimateChange;
|
||||
import forestry.greenhouse.api.climate.ClimateChange;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import forestry.api.climate.ClimateChange;
|
||||
import forestry.greenhouse.api.climate.ClimateChange;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
|
||||
public class ClimateSourceWorldManager{
|
||||
|
||||
private final Map<Position2D, Map<Integer, IClimateSourceOwner>> owners;
|
||||
|
||||
public ClimateSourceWorldManager() {
|
||||
this.owners = new HashMap<>();
|
||||
}
|
||||
|
||||
public void addSource(IClimateSourceOwner owner){
|
||||
BlockPos pos = owner.getCoordinates();
|
||||
Position2D position = new Position2D(pos);
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k -> new HashMap<>());
|
||||
positionedOwners.put(pos.getY(), owner);
|
||||
}
|
||||
|
||||
public void removeSource(IClimateSourceOwner owner){
|
||||
BlockPos pos = owner.getCoordinates();
|
||||
Position2D position = new Position2D(pos);
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k -> new HashMap<>());
|
||||
positionedOwners.remove(pos.getY());
|
||||
}
|
||||
|
||||
public Collection<IClimateSourceOwner> getSources(Position2D position) {
|
||||
Map<Integer, IClimateSourceOwner> positionedOwners = owners.get(position);
|
||||
if(positionedOwners == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return positionedOwners.values();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.utils.World2ObjectMap;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateModifier;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.api.climate.IGreenhouseClimateManager;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.multiblock.blocks.world.GreenhouseBlockManager;
|
||||
|
||||
public class GreenhouseClimateManager implements IGreenhouseClimateManager {
|
||||
|
||||
private static final GreenhouseClimateManager INSTANCE = new GreenhouseClimateManager();
|
||||
|
||||
private final World2ObjectMap<ClimateSourceWorldManager> managers;
|
||||
private final Set<IClimateModifier> modifiers;
|
||||
|
||||
private GreenhouseClimateManager() {
|
||||
managers = new World2ObjectMap(world->new ClimateSourceWorldManager());
|
||||
modifiers = new TreeSet<IClimateModifier>((firstModifier, secondModifier) -> firstModifier.getPriority() > secondModifier.getPriority() ? 1 : -1);
|
||||
}
|
||||
|
||||
public static GreenhouseClimateManager getInstance(){
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateContainer getContainer(World world, BlockPos pos) {
|
||||
IGreenhouseBlock logicBlock = GreenhouseBlockManager.getInstance().getBlock(world, pos);
|
||||
if(logicBlock != null){
|
||||
IGreenhouseProvider provider = logicBlock.getProvider();
|
||||
if(!provider.isClosed()) {
|
||||
return null;
|
||||
}
|
||||
return provider.getClimateContainer();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSource(IClimateSourceOwner owner){
|
||||
World world = owner.getWorldObj();
|
||||
ClimateSourceWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return;
|
||||
}
|
||||
manager.addSource(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSource(IClimateSourceOwner owner){
|
||||
World world = owner.getWorldObj();
|
||||
ClimateSourceWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return;
|
||||
}
|
||||
manager.removeSource(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IClimateSourceOwner> getSources(World world, Position2D position) {
|
||||
ClimateSourceWorldManager manager = managers.get(world);
|
||||
if(manager == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return manager.getSources(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModifier(IClimateModifier modifier) {
|
||||
modifiers.add(modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IClimateModifier> getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,11 +17,11 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.BlankClimateModifier;
|
||||
import forestry.greenhouse.api.climate.BlankClimateModifier;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
@@ -17,14 +17,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.BlankClimateModifier;
|
||||
import forestry.api.climate.ClimateChange;
|
||||
import forestry.greenhouse.api.climate.BlankClimateModifier;
|
||||
import forestry.greenhouse.api.climate.ClimateChange;
|
||||
import forestry.api.climate.ClimateState;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.core.config.Config;
|
||||
|
||||
@@ -18,10 +18,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.BlankClimateModifier;
|
||||
import forestry.greenhouse.api.climate.BlankClimateModifier;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
@@ -16,10 +16,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.BlankClimateModifier;
|
||||
import forestry.greenhouse.api.climate.BlankClimateModifier;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
@@ -16,8 +16,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateData;
|
||||
import forestry.greenhouse.api.climate.IClimateData;
|
||||
import forestry.core.gui.tables.Table;
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.models.DefaultTextureGetter;
|
||||
@@ -68,7 +68,7 @@ public class ModelGreenhouseWindow extends ModelBlockCustomCached<BlockGreenhous
|
||||
@Override
|
||||
protected IBakedModel bakeBlock(BlockGreenhouseWindow block, Key key, boolean inventory) {
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
String texture = GreenhouseManager.greenhouseHelper.getGlassTexture(key.glassName);
|
||||
String texture = GreenhouseManager.helper.getGlassTexture(key.glassName);
|
||||
textures.put("texture", texture);
|
||||
textures.put("particle", texture);
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.Listener;
|
||||
import forestry.core.multiblock.FakeMultiblockController;
|
||||
import forestry.energy.EnergyManager;
|
||||
|
||||
@@ -26,21 +26,21 @@ import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.GreenhouseState;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateContainerListener;
|
||||
import forestry.greenhouse.api.climate.GreenhouseState;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainerListener;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.Active;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.Listener;
|
||||
@@ -99,7 +99,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
|
||||
this.camouflage = getDefaultCamouflageBlock();
|
||||
this.climateContainer = new ClimateContainer(this);
|
||||
this.climateContainer.addListaner(this);
|
||||
this.climateContainer.addListener(this);
|
||||
this.centerPos = BlockPos.ORIGIN;
|
||||
if (world.isRemote) {
|
||||
provider = new GreenhouseProviderClient(world, climateContainer);
|
||||
@@ -107,7 +107,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
provider = new GreenhouseProviderServer(world, climateContainer);
|
||||
}
|
||||
provider.addListener(this);
|
||||
this.logics = GreenhouseManager.greenhouseHelper.createLogics(this);
|
||||
this.logics = GreenhouseManager.helper.createLogics(this);
|
||||
for (IGreenhouseLogic logic : logics) {
|
||||
if (logic instanceof IGreenhouseProviderListener) {
|
||||
this.provider.addListener((IGreenhouseProviderListener) logic);
|
||||
|
||||
@@ -14,8 +14,8 @@ import java.io.IOException;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
|
||||
public class GreenhouseLimits implements IGreenhouseLimits {
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.greenhouse.multiblock;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
|
||||
public class GreenhouseLimitsBuilder {
|
||||
public BlockPos.MutableBlockPos maximumCoordinates;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.multiblock;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
@@ -18,6 +19,9 @@ import forestry.core.multiblock.IMultiblockControllerInternal;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.owner.IOwnedTile;
|
||||
import forestry.energy.EnergyManager;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
|
||||
public interface IGreenhouseControllerInternal extends IGreenhouseController, IMultiblockControllerInternal, IOwnedTile, IStreamableGui {
|
||||
|
||||
@@ -35,4 +39,26 @@ public interface IGreenhouseControllerInternal extends IGreenhouseController, IM
|
||||
* @return A Set with listener componets.
|
||||
*/
|
||||
Set<IGreenhouseComponent.Listener> getListenerComponents();
|
||||
|
||||
//TODO: Move back to api
|
||||
/***************************************/
|
||||
/* IClimateHousing */
|
||||
|
||||
/**
|
||||
* @return The climate container of this region.
|
||||
*/
|
||||
IClimateContainer getClimateContainer();
|
||||
|
||||
/* IGreenhouseHousing */
|
||||
/**
|
||||
* @return the manager of this housing.
|
||||
*/
|
||||
IGreenhouseProvider getProvider();
|
||||
|
||||
/**
|
||||
* @return the maximal and minimal settings of this housing.
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseLimits getLimits();
|
||||
/**************************************/
|
||||
}
|
||||
@@ -18,10 +18,10 @@ import java.util.Set;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
|
||||
public abstract class GreenhouseBlock<P extends IGreenhouseBlock> implements IGreenhouseBlock {
|
||||
protected final BlockPos pos;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.greenhouse.network.packets.PacketGreenhouseData;
|
||||
|
||||
@@ -13,9 +13,9 @@ package forestry.greenhouse.multiblock.blocks.blank;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseBlock;
|
||||
|
||||
public class BlankBlock extends GreenhouseBlock<IBlankBlock> implements IBlankBlock {
|
||||
|
||||
@@ -16,11 +16,11 @@ import java.util.List;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
public class BlankBlockHandler implements IGreenhouseBlockHandler<IBlankBlock, IBlankBlock> {
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseBlock;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,9 +17,9 @@ import java.util.List;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
public class ClientBlockHandler implements IGreenhouseBlockHandler<ClientBlock, ClientBlock> {
|
||||
|
||||
+6
-6
@@ -24,12 +24,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseBlockCache;
|
||||
|
||||
@@ -17,9 +17,9 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
|
||||
public class GreenhouseChunk implements IGreenhouseChunk {
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ import java.util.Set;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.GreenhouseState;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.greenhouse.api.climate.GreenhouseState;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
|
||||
+5
-5
@@ -18,11 +18,11 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.GreenhouseState;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.climate.GreenhouseState;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.greenhouse.multiblock.GreenhouseLimits;
|
||||
|
||||
+12
-11
@@ -28,18 +28,18 @@ import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.GreenhouseState;
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateHousing;
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.GreenhouseState;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.multiblock.GreenhouseLimits;
|
||||
import forestry.greenhouse.multiblock.GreenhouseLimitsBuilder;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
@@ -50,8 +50,8 @@ import forestry.greenhouse.network.packets.PacketGreenhouseData;
|
||||
|
||||
public class GreenhouseProviderServer extends GreenhouseProvider {
|
||||
private static final List<IGreenhouseBlockHandler> HANDLERS = new ArrayList<>();
|
||||
private static final int TIME_BETWEEN_UPDATES = 100;
|
||||
private static final int UPDATE_DELAY = 35;
|
||||
private static final int TIME_BETWEEN_UPDATES = 25;
|
||||
private static final int UPDATE_DELAY = 50;
|
||||
|
||||
private final Set<Long> unloadedChunks;
|
||||
|
||||
@@ -175,7 +175,8 @@ public class GreenhouseProviderServer extends GreenhouseProvider {
|
||||
public void onBlockChange() {
|
||||
long totalWorldTime = world.getTotalWorldTime();
|
||||
if (totalWorldTime >= previousUpdateTick + TIME_BETWEEN_UPDATES) {
|
||||
GreenhouseBlockManager.getInstance().scheduleUpdate(world, container.getParent().getCoordinates(), this, UPDATE_DELAY);
|
||||
GreenhouseBlockManager blockManager = GreenhouseBlockManager.getInstance();
|
||||
blockManager.scheduleUpdate(world, container.getParent().getCoordinates(), this, UPDATE_DELAY);
|
||||
previousUpdateTick = totalWorldTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,15 +16,15 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.IWallBlock;
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IWallBlock;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseBlock;
|
||||
|
||||
public class WallBlock extends GreenhouseBlock<IBlankBlock> implements IWallBlock {
|
||||
@@ -44,7 +44,7 @@ public class WallBlock extends GreenhouseBlock<IBlankBlock> implements IWallBloc
|
||||
@Override
|
||||
public void onCreate() {
|
||||
IClimateContainer container = provider.getClimateContainer();
|
||||
for (IClimateSourceOwner sourceOwner : ForestryAPI.climateManager.getSources(provider.getWorld(), new Position2D(pos))) {
|
||||
for (IClimateSourceOwner sourceOwner : GreenhouseManager.climateManager.getSources(provider.getWorld(), new Position2D(pos))) {
|
||||
IClimateSource source = sourceOwner.getClimateSource();
|
||||
sources.add(source);
|
||||
container.addClimateSource(source);
|
||||
|
||||
@@ -21,13 +21,13 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.IBlankBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.api.greenhouse.IWallBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IBlankBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockHandler;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockStorage;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProviderListener;
|
||||
import forestry.greenhouse.api.greenhouse.IWallBlock;
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
public class WallBlockHandler implements IGreenhouseBlockHandler<IWallBlock, IBlankBlock> {
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseChunk;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseChunk;
|
||||
|
||||
|
||||
+4
-4
@@ -18,10 +18,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.api.greenhouse.IGreenhouseBlockManager;
|
||||
import forestry.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlockManager;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseChunk;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.core.utils.World2ObjectMap;
|
||||
import forestry.greenhouse.multiblock.blocks.blank.BlankBlockHandler;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseChunk;
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.greenhouse.multiblock.blocks.world;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
|
||||
class NextTickEntry implements Comparable<NextTickEntry> {
|
||||
private final IGreenhouseProvider provider;
|
||||
|
||||
@@ -15,18 +15,19 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.core.multiblock.MultiblockUtil;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.IForestryPacketHandlerClient;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.PacketIdClient;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseProvider;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseProviderClient;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseProviderServer;
|
||||
import forestry.greenhouse.multiblock.blocks.world.GreenhouseBlockManager;
|
||||
|
||||
public class PacketGreenhouseData extends ForestryPacket implements IForestryPacketClient {
|
||||
|
||||
@@ -57,7 +58,7 @@ public class PacketGreenhouseData extends ForestryPacket implements IForestryPac
|
||||
@Override
|
||||
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException {
|
||||
BlockPos pos = data.readBlockPos();
|
||||
IGreenhouseController controller = MultiblockUtil.getController(player.world, pos, IGreenhouseComponent.class);
|
||||
IGreenhouseControllerInternal controller = MultiblockUtil.getController(player.world, pos, IGreenhouseComponent.class);
|
||||
if (controller == null) {
|
||||
return;
|
||||
}
|
||||
@@ -66,9 +67,9 @@ public class PacketGreenhouseData extends ForestryPacket implements IForestryPac
|
||||
GreenhouseProviderClient providerClient = (GreenhouseProviderClient) provider;
|
||||
providerClient.readData(data);
|
||||
}
|
||||
//GreenhouseBlockManager manager = GreenhouseBlockManager.getInstance();
|
||||
provider.onBlockChange();
|
||||
//manager.markProviderDirty(player.world, controller.getProvider().getCenterPos(), provider);
|
||||
GreenhouseBlockManager manager = GreenhouseBlockManager.getInstance();
|
||||
//provider.recreate();
|
||||
manager.markProviderDirty(player.world, controller.getProvider().getCenterPos(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.core.multiblock.MultiblockUtil;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.IForestryPacketHandlerServer;
|
||||
@@ -25,6 +24,7 @@ import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.PacketIdServer;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseProviderServer;
|
||||
|
||||
public class PacketGreenhouseDataRequest extends ForestryPacket implements IForestryPacketServer {
|
||||
@@ -50,7 +50,7 @@ public class PacketGreenhouseDataRequest extends ForestryPacket implements IFore
|
||||
public void onPacketData(PacketBufferForestry data, EntityPlayerMP player) throws IOException {
|
||||
BlockPos position = data.readBlockPos();
|
||||
World world = player.world;
|
||||
IGreenhouseController controller = MultiblockUtil.getController(world, position, IGreenhouseComponent.class);
|
||||
IGreenhouseControllerInternal controller = MultiblockUtil.getController(world, position, IGreenhouseComponent.class);
|
||||
if (controller != null) {
|
||||
NetworkUtil.sendToPlayer(new PacketGreenhouseData(position, (GreenhouseProviderServer) controller.getProvider()), player);
|
||||
}
|
||||
|
||||
@@ -15,17 +15,17 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.core.multiblock.MultiblockUtil;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.IForestryPacketHandlerServer;
|
||||
import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.PacketIdServer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
|
||||
public class PacketSelectClimateTargeted extends ForestryPacket implements IForestryPacketServer {
|
||||
private final BlockPos pos;
|
||||
@@ -55,7 +55,7 @@ public class PacketSelectClimateTargeted extends ForestryPacket implements IFore
|
||||
float temperature = data.readFloat();
|
||||
float humidity = data.readFloat();
|
||||
|
||||
IGreenhouseController controller = MultiblockUtil.getController(player.world, pos, IGreenhouseComponent.class);
|
||||
IGreenhouseControllerInternal controller = MultiblockUtil.getController(player.world, pos, IGreenhouseComponent.class);
|
||||
if (controller != null) {
|
||||
IClimateContainer container = controller.getClimateContainer();
|
||||
container.setTargetedState(new ImmutableClimateState(temperature, humidity));
|
||||
|
||||
@@ -28,9 +28,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
|
||||
import forestry.core.models.BlockModelEntry;
|
||||
import forestry.core.models.ModelEntry;
|
||||
import forestry.core.models.ModelManager;
|
||||
|
||||
@@ -27,8 +27,8 @@ import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.apiculture.network.packets.PacketActiveUpdate;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -23,7 +22,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateContainer;
|
||||
import forestry.api.climate.ImmutableClimateState;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -32,8 +30,6 @@ import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseLimits;
|
||||
import forestry.api.greenhouse.IGreenhouseProvider;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
import forestry.core.multiblock.MultiblockTileEntityForestry;
|
||||
@@ -179,11 +175,11 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry<Multib
|
||||
}
|
||||
|
||||
/* IGreenhouseHousing */
|
||||
|
||||
@Override
|
||||
//TODO:Greenhouse Api
|
||||
/*@Override
|
||||
public IClimateContainer getClimateContainer() {
|
||||
return getMultiblockLogic().getController().getClimateContainer();
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
@@ -220,7 +216,8 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry<Multib
|
||||
return getMultiblockLogic().getController().getExactHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO:Greenhouse Api
|
||||
/*@Override
|
||||
public IGreenhouseProvider getProvider() {
|
||||
return getMultiblockLogic().getController().getProvider();
|
||||
}
|
||||
@@ -229,5 +226,5 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry<Multib
|
||||
@Override
|
||||
public IGreenhouseLimits getLimits() {
|
||||
return getMultiblockLogic().getController().getLimits();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.DefaultGreenhouseListener;
|
||||
import forestry.greenhouse.api.greenhouse.DefaultGreenhouseListener;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
|
||||
@@ -23,8 +23,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateSourceOwner;
|
||||
import forestry.greenhouse.api.climate.IClimateSource;
|
||||
import forestry.greenhouse.api.climate.IClimateSourceOwner;
|
||||
import forestry.apiculture.network.packets.PacketActiveUpdate;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
|
||||
@@ -13,6 +13,15 @@ package forestry.plugins.compat;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
@@ -32,13 +41,6 @@ import forestry.farming.logic.FarmableAgingCrop;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.EXTRA_UTILITIES, name = "ExtraUtilities", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.extrautilities.description")
|
||||
public class PluginExtraUtilities extends BlankForestryPlugin {
|
||||
|
||||
@@ -11,8 +11,28 @@
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
@@ -31,23 +51,6 @@ import forestry.farming.logic.FarmableSapling;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.NATURA, name = "Natura", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.natura.description")
|
||||
public class PluginNatura extends BlankForestryPlugin {
|
||||
|
||||
Reference in new issue
Block a user