This commit is contained in:
Nedelosk committed 2017-09-02 17:28:13 +02:00
1 parent bbe6f919c4
commit 2b0f5bfdf4
49 files changed
+182 -184

No files matched your search

@@ -33,8 +33,8 @@ public class Circuits {
public static ICircuit machineSpeedUpgrade1;
public static ICircuit machineSpeedUpgrade2;
public static ICircuit machineEfficiencyUpgrade1;
public static ICircuit greenhouseClimatiserTemperature1;
public static ICircuit greenhouseClimatiserTemperature2;
public static ICircuit greenhouseClimatiserHumidity1;
public static ICircuit greenhouseClimatiserHumidity2;
public static ICircuit climatiserTemperature1;
public static ICircuit climatiserTemperature2;
public static ICircuit climatiserHumidity1;
public static ICircuit climatiserHumidity2;
}
@@ -22,7 +22,7 @@ public class Constants implements IForestryConstants {
public static final String MOD_ID = "forestry";
public static final String URL = "http://forestry.sengir.net/";
public static final String VERSION = "@VERSION@";
public static final String VERSION = "5.0.0.0";//"@VERSION@"
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
public static final String RF_MOD_ID = "CoFHAPI|energy";
@@ -12,6 +12,11 @@ import forestry.api.farming.ISimpleFarmLogic;
public class DummyFarmRegistry implements IFarmRegistry {
@Override
public void registerFarmLogic(String identifier, IFarmLogic logic) {
}
@Override
public void registerFarmables(String identifier, IFarmable... farmable) {
}
@@ -111,7 +111,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
GreenhouseManager.climateManager = GreenhouseClimateManager.getInstance();
CamouflageManager.camouflageAccess = new CamouflageAccess();
}
@Override
public void registerItemsAndBlocks() {
blocks = new BlockRegistryGreenhouse();
@@ -128,7 +128,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
ICircuitLayout layoutManaged = new CircuitLayout("greenhouse.climatiser", CircuitSocketType.GREENHOUSE_CLIMATISER);
ChipsetManager.circuitRegistry.registerLayout(layoutManaged);
}
@Override
public void doInit() {
super.doInit();
@@ -156,10 +156,10 @@ public class PluginGreenhouse extends BlankForestryPlugin {
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);
Circuits.greenhouseClimatiserHumidity1 = new CircuitClimateSource("climatiser.humidity.1", ClimateType.HUMIDITY, 0.125F, 0.125F);
Circuits.greenhouseClimatiserHumidity2 = new CircuitClimateSource("climatiser.humidity.2", ClimateType.HUMIDITY, 0.25F, 0.25F);
Circuits.climatiserTemperature1 = new CircuitClimateSource("climatiser.temperature.1", ClimateType.TEMPERATURE, 0.125F, 0.125F);
Circuits.climatiserTemperature2 = new CircuitClimateSource("climatiser.temperature.2", ClimateType.TEMPERATURE, 0.25F, 0.25F);
Circuits.climatiserHumidity1 = new CircuitClimateSource("climatiser.humidity.1", ClimateType.HUMIDITY, 0.125F, 0.125F);
Circuits.climatiserHumidity2 = new CircuitClimateSource("climatiser.humidity.2", ClimateType.HUMIDITY, 0.25F, 0.25F);
proxy.inti();
}
@@ -257,10 +257,10 @@ public class PluginGreenhouse extends BlankForestryPlugin {
}
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout("forestry.greenhouse.climatiser");
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.greenhouseClimatiserTemperature1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.BLAZE, 1), Circuits.greenhouseClimatiserTemperature2);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.LAPIS, 1), Circuits.greenhouseClimatiserHumidity1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuits.greenhouseClimatiserHumidity2);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.climatiserTemperature1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.BLAZE, 1), Circuits.climatiserTemperature2);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.LAPIS, 1), Circuits.climatiserHumidity1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuits.climatiserHumidity2);
}
@Override
@@ -18,44 +18,44 @@ import forestry.api.core.INbtWritable;
import forestry.api.greenhouse.IClimateHousing;
public interface IClimateContainer extends INbtReadable, INbtWritable, IClimateSourceContainer {
/**
* @return The parent of this container.
*/
IClimateHousing getParent();
/**
* @return The current climate state.
*/
IClimateState getState();
World getWorld();
/**
* Update the climate in a region.
*/
void updateClimate(int ticks);
/**
* Add a listener to this container.
*/
void addListener(IClimateContainerListener listener);
/**
* Remove a listener to this container.
*/
void removeListener(IClimateContainerListener listener);
/**
* All listeners of this container.
*/
Collection<IClimateContainerListener> getListeners();
/**
* @return only not present if the controller never was assembled.
*/
IClimateState getTargetedState();
void setTargetedState(IClimateState state);
@SideOnly(Side.CLIENT)
@@ -11,5 +11,5 @@ public interface IClimateContainerListener {
* Test if the container is closed.
*/
boolean isClosed(IClimateContainer container);
}
@@ -11,9 +11,8 @@ public interface IClimateFactory {
/**
* @param climatedRegion
*
* @return Creates a climate container.
*/
IClimateContainer createContainer(IClimateHousing climatedRegion);
}
@@ -16,29 +16,29 @@ import forestry.api.climate.IClimateState;
* This modifier is used by {@link IClimateContainer}s.
*/
public interface IClimateModifier {
/**
* Is called every 20 ticks by the {@link IClimateContainer} to change its climate state.
*
*
* @param container the climate container
* @param newState the new climate state
* @param oldState the climate static of the previous modification.
* @param data A {@link NBTTagCompound} that can be used to save custom data or to send it to the client to add it to the {@link IClimateData}.
* @param newState the new climate state
* @param oldState the climate static of the previous modification.
* @param data A {@link NBTTagCompound} that can be used to save custom data or to send it to the client to add it to the {@link IClimateData}.
* @return a modify newState or the newState.
*/
default IClimateState modifyTarget(IClimateContainer container, IClimateState newState, IClimateState oldState, NBTTagCompound data){
default IClimateState modifyTarget(IClimateContainer container, IClimateState newState, IClimateState oldState, NBTTagCompound data) {
return newState;
}
@SideOnly(Side.CLIENT)
default void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data){
default void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
}
/**
* @return The priority of this modifier. The modifier with the highest priority is called first and the modifier with the lowest at last.
*/
default int getPriority() {
return 0;
}
}
@@ -17,40 +17,39 @@ import forestry.api.climate.IClimateState;
* In forestry it is used in a part of a {@link IClimateModifier}.
*/
public interface IClimateSource {
/**
* The owner of this source.
*/
@Nullable
IClimateSourceOwner getOwner();
/**
* The range of this source.
*/
float getBoundaryModifier(ClimateType type, boolean boundaryUp);
/**
* @return true if this source affects this sourceType of climate.
*/
boolean affectClimateType(ClimateType type);
/**
* @param state the {@link IClimateState} that the source has to work on.
* @param state the {@link IClimateState} that the source has to work on.
* @param target the by the {@link IClimateContainer} targeted {@link IClimateState}.
*
*/
IClimateState work(IClimateState state, IClimateState target);
/**
* @return true if source has changed the climate at the last work cicle.
*/
boolean isActive();
/**
* Called if the source is added to a {@link IClimateContainer}.
*/
void onAdded(IClimateContainer container);
/**
* Called if the source is removed form a {@link IClimateContainer}.
*/
@@ -11,7 +11,6 @@ import forestry.api.climate.IClimateState;
/**
* @since 5.3.4
*
*/
public interface IClimateSourceContainer {
@@ -24,25 +23,25 @@ public interface IClimateSourceContainer {
* Remove a climate source from this container.
*/
void removeClimateSource(IClimateSource source);
/**
* @return All climate sources of this container.
*/
Collection<IClimateSource> getClimateSources();
/**
* The climate of the {@link IClimateContainer} that results out of the {@link IClimateState} modifications of the {@link IClimateSource}s can not be higher than this bound.
*/
IClimateState getBoundaryUp();
/**
* The climate of the {@link IClimateContainer} that results out of the {@link IClimateState} modifications of the {@link IClimateSource}s can not be lower than this bound.
*/
IClimateState getBoundaryDown();
/**
* Has to be called if any range of a {@link IClimateSource} changes. It calculates the range of all {@link IClimateSource}s together.
*/
void recalculateBoundaries(double sizeModifier);
}
@@ -15,12 +15,12 @@ import forestry.api.core.ILocatable;
public interface IClimateSourceOwner extends ILocatable {
IClimateSource getClimateSource();
@SideOnly(Side.CLIENT)
ItemStack getItemStack();
boolean isActive();
/**
* @return true if this climate source owner can hold a {@link ICircuit}
*/
@@ -10,35 +10,35 @@ import javax.annotation.Nullable;
import net.minecraft.util.EnumFacing;
public interface IBlankBlock extends IGreenhouseBlock {
@Override
@Nullable
IBlankBlock getRoot();
/**
* @return test if a face was already tested, false if not.
*/
boolean isFaceTested(EnumFacing facing);
void setFaceTested(EnumFacing facing, boolean isTested);
/**
* @return if this block has a {@link IWallBlock} next to him.
*/
boolean isNearWall();
void setNearWall(boolean nearWall);
/**
* Called after the block is created.
*/
void validate();
/**
* Called before the block will be removed.
*/
void invalidate(boolean chunkUnloading);
boolean isValid();
}
@@ -12,34 +12,34 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public interface IGreenhouseBlock {
/**
* @return the position of this block.
*/
BlockPos getPos();
/**
* @return the root block of this block.
*/
@Nullable
IGreenhouseBlock getRoot();
/**
* @return the side of this block that shows to the root block.
*/
@Nullable
EnumFacing getRootFace();
/**
* @return the manager of this block.
*/
IGreenhouseProvider getProvider();
/**
* Called if a neighbor block of this block is removed.
*/
void onNeighborRemoved(IBlankBlock changedBlock, EnumFacing facing, boolean forcedRemove, Set<IGreenhouseBlock> blocksToCheck);
IGreenhouseBlockHandler getHandler();
}
@@ -14,7 +14,7 @@ import net.minecraft.util.math.BlockPos;
import forestry.api.core.IErrorState;
public interface IGreenhouseBlockHandler<B extends IGreenhouseBlock, R extends IGreenhouseBlock> {
void onRemoveBlock(IGreenhouseBlockStorage storage, B blockToRemove);
B createBlock(IGreenhouseBlockStorage storage, @Nullable R root, @Nullable EnumFacing rootFacing, @Nullable BlockPos position);
@@ -23,8 +23,8 @@ public interface IGreenhouseBlockHandler<B extends IGreenhouseBlock, R extends I
@Nullable
IErrorState checkNeighborBlocks(IGreenhouseBlockStorage storage, B blockToCheck, List<IGreenhouseBlock> newBlocksToCheck);
boolean onCheckPosition(IGreenhouseBlockStorage storage, R rootBlock, BlockPos position, EnumFacing facing, IGreenhouseBlock block, List<IGreenhouseBlock> newBlocksToCheck);
Class<? extends B> getBlockClass();
}
@@ -13,17 +13,17 @@ import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
public interface IGreenhouseBlockManager {
/**
* @return the {@link IGreenhouseBlockHandler} that is used to handle blank blocks in the {@link IGreenhouseProvider}
*/
IGreenhouseBlockHandler<IBlankBlock, IBlankBlock> getBlankBlockHandler();
/**
* @return the {@link IGreenhouseBlockHandler} that is used to handle wall blocks in the {@link IGreenhouseProvider}
*/
IGreenhouseBlockHandler<IWallBlock, IBlankBlock> getWallBlockHandler();
/**
* Tries to get a {@link IGreenhouseBlock} from all managers that are located at the chunk of the pos.
*
@@ -31,42 +31,41 @@ public interface IGreenhouseBlockManager {
*/
@Nullable
IGreenhouseBlock getBlock(World world, BlockPos pos);
/**
*
* @return the chunk that is at this position.
*/
@Nullable
IGreenhouseChunk getChunk(World world, long chunkPos);
/**
* @return the chunk that is at this position or if there is no it creates one.
*/
IGreenhouseChunk getOrCreateChunk(World world, long chunkPos);
/**
* @return creates a chunk and add it at this position
*/
IGreenhouseChunk createChunk(World world, long chunkPos);
default IGreenhouseChunk getChunk(World world, int xPos, int yPos){
default IGreenhouseChunk getChunk(World world, int xPos, int yPos) {
return getChunk(world, ChunkPos.asLong(xPos, yPos));
}
default IGreenhouseChunk getOrCreateChunk(World world, int xPos, int yPos){
default IGreenhouseChunk getOrCreateChunk(World world, int xPos, int yPos) {
return getOrCreateChunk(world, ChunkPos.asLong(xPos, yPos));
}
default IGreenhouseChunk createChunk(World world, int xPos, int yPos){
default IGreenhouseChunk createChunk(World world, int xPos, int yPos) {
return createChunk(world, ChunkPos.asLong(xPos, yPos));
}
@Nullable
void markChunkDirty(World world, long pos);
@Nullable
List<Long> getDirtyChunks(World world);
@Nullable
void markBlockDirty(World world, BlockPos pos);
@@ -18,17 +18,17 @@ public interface IGreenhouseChunk {
* @return a {@link Collection} with all greenhouse managers of the greenhouses that are located in the world chunk on this chunk position.
*/
Collection<IGreenhouseProvider> getProviders();
/**
* Marks the manager, that has a {@link IGreenhouseBlock} on this position, as dirty.
*/
void markProviderDirty(BlockPos pos);
/**
* @return A {@link java.util.Collection} with all managers that were modified in the last tick.
*/
Collection<IGreenhouseProvider> getDirtyProviders();
/**
* Tries to get a {@link IGreenhouseBlock} from all managers that are located in this chunk.
*
@@ -36,12 +36,12 @@ public interface IGreenhouseChunk {
*/
@Nullable
IGreenhouseBlock get(BlockPos pos);
/**
* Adds a manager to this chunk.
*/
void add(IGreenhouseProvider manager);
/**
* Removed a manager from this chunk.
*/
@@ -14,17 +14,17 @@ import forestry.api.greenhouse.IGreenhouseLogicFactory;
import forestry.api.multiblock.IGreenhouseController;
public interface IGreenhouseHelper {
void registerWindowGlass(String name, ItemStack item, String texture);
ItemStack getGlassItem(String name);
String getGlassTexture(String name);
Collection<String> getWindowGlasses();
void registerLogic(IGreenhouseLogicFactory logicFactory);
Collection<IGreenhouseLogic> createLogics(IGreenhouseController controller);
}
@@ -18,21 +18,20 @@ import forestry.greenhouse.api.climate.IClimateContainer;
/**
* Can be used to test if a space is closed. Is used by the greenhouse.
*
*/
public interface IGreenhouseProvider extends IErrorLogicSource {
public interface IGreenhouseProvider extends IErrorLogicSource {
/**
* @return the climate container of this provider.
*/
@Nullable
IClimateContainer getClimateContainer();
/**
* Adds a listener to this provider.
*/
void addListener(IGreenhouseProviderListener listener);
/**
* @return All listeners that this provider has.
*/
@@ -42,26 +41,26 @@ public interface IGreenhouseProvider extends IErrorLogicSource {
* @param centerPos The position at that the provider starts to test.
*/
void init(BlockPos centerPos, IGreenhouseLimits limits);
/**
* Invalidate and delete all {@link IGreenhouseBlock}s of this provider.
*/
void clear(boolean chunkUnloading);
/**
* Called from the thread if a {@link IGreenhouseBlock} was modified by the player.
*/
void recreate();
void onUnloadChunk(long chunkPos);
void onLoadChunk(long chunkPos);
/**
* @return True if the provider waits for a chunk to be loaded, before he can test if it is closed.
*/
boolean hasUnloadedChunks();
/**
* @return The position from that the provider tests if it is closed.
*/
@@ -82,21 +81,21 @@ public interface IGreenhouseProvider extends IErrorLogicSource {
IGreenhouseLimits getUsedLimits();
GreenhouseState getState();
World getWorld();
/**
* @return true if the space is closed.
*/
boolean isClosed();
/**
* Test if the provider is closed.
*/
IErrorState checkPosition(BlockPos position);
int getSize();
/**
* @return All {@link IGreenhouseBlockHandler}s that this provider uses.
*/
@@ -8,7 +8,7 @@ package forestry.greenhouse.api.greenhouse;
import net.minecraft.util.math.BlockPos;
public interface IGreenhouseProviderListener {
void onCheckPosition(BlockPos pos);
}
@@ -10,15 +10,15 @@ import net.minecraft.util.EnumFacing;
import forestry.greenhouse.api.climate.IClimateSource;
public interface IWallBlock extends IGreenhouseBlock {
void setRoot(IBlankBlock parent);
void setRootFace(EnumFacing facing);
void onCreate();
void onRemove();
void add(IClimateSource source);
}
@@ -49,7 +49,6 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.greenhouse.api.climate.IClimateContainer;
import forestry.api.climate.IClimateState;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ICamouflageHandler;
@@ -57,7 +56,6 @@ import forestry.api.core.ICamouflagedTile;
import forestry.api.core.IModelManager;
import forestry.api.core.ISpriteRegister;
import forestry.api.core.ITextureManager;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.api.multiblock.IGreenhouseComponent;
import forestry.api.multiblock.IMultiblockComponent;
import forestry.api.multiblock.IMultiblockController;
@@ -74,6 +72,8 @@ import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.ItemTooltipUtil;
import forestry.core.utils.Translator;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.api.climate.IClimateContainer;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.greenhouse.models.ModelCamouflaged;
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
import forestry.greenhouse.tiles.TileGreenhouseControl;
@@ -49,7 +49,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
import forestry.core.blocks.IBlockRotatable;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
@@ -57,6 +56,7 @@ import forestry.core.tiles.IActivatable;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.Log;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
import forestry.greenhouse.tiles.TileGreenhouseWindow;
import forestry.greenhouse.tiles.TileGreenhouseWindow.WindowMode;
@@ -13,10 +13,10 @@ package forestry.greenhouse.circuits;
import javax.annotation.Nullable;
import forestry.api.climate.ClimateType;
import forestry.core.circuits.Circuit;
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 {
private ClimateType type;
@@ -11,10 +11,10 @@
package forestry.greenhouse.climate;
import forestry.api.climate.ClimateType;
import forestry.greenhouse.api.climate.IClimateSourceCircuitable;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
import forestry.core.climate.ClimateSource;
import forestry.core.climate.ClimateSourceType;
import forestry.greenhouse.api.climate.IClimateSourceCircuitable;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
public abstract class ClimateSourceCircuitable<O extends IClimateSourceOwner> extends ClimateSource<O> implements IClimateSourceCircuitable {
protected float changeMultiplierTemperature = 1.0f;
@@ -7,10 +7,10 @@ import java.util.Map;
import net.minecraft.util.math.BlockPos;
import forestry.greenhouse.api.greenhouse.Position2D;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
import forestry.greenhouse.api.greenhouse.Position2D;
public class ClimateSourceWorldManager{
public class ClimateSourceWorldManager {
private final Map<Position2D, Map<Integer, IClimateSourceOwner>> owners;
@@ -18,14 +18,14 @@ public class ClimateSourceWorldManager{
this.owners = new HashMap<>();
}
public void addSource(IClimateSourceOwner owner){
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){
public void removeSource(IClimateSourceOwner owner) {
BlockPos pos = owner.getCoordinates();
Position2D position = new Position2D(pos);
Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k -> new HashMap<>());
@@ -34,7 +34,7 @@ public class ClimateSourceWorldManager{
public Collection<IClimateSourceOwner> getSources(Position2D position) {
Map<Integer, IClimateSourceOwner> positionedOwners = owners.get(position);
if(positionedOwners == null){
if (positionedOwners == null) {
return Collections.emptyList();
}
return positionedOwners.values();
@@ -26,20 +26,20 @@ public class GreenhouseClimateManager implements IGreenhouseClimateManager {
private final Set<IClimateModifier> modifiers;
private GreenhouseClimateManager() {
managers = new World2ObjectMap(world->new ClimateSourceWorldManager());
managers = new World2ObjectMap(world -> new ClimateSourceWorldManager());
modifiers = new TreeSet<IClimateModifier>((firstModifier, secondModifier) -> firstModifier.getPriority() > secondModifier.getPriority() ? 1 : -1);
}
public static GreenhouseClimateManager getInstance(){
public static GreenhouseClimateManager getInstance() {
return INSTANCE;
}
@Override
public IClimateContainer getContainer(World world, BlockPos pos) {
IGreenhouseBlock logicBlock = GreenhouseBlockManager.getInstance().getBlock(world, pos);
if(logicBlock != null){
if (logicBlock != null) {
IGreenhouseProvider provider = logicBlock.getProvider();
if(!provider.isClosed()) {
if (!provider.isClosed()) {
return null;
}
return provider.getClimateContainer();
@@ -48,20 +48,20 @@ public class GreenhouseClimateManager implements IGreenhouseClimateManager {
}
@Override
public void addSource(IClimateSourceOwner owner){
public void addSource(IClimateSourceOwner owner) {
World world = owner.getWorldObj();
ClimateSourceWorldManager manager = managers.get(world);
if(manager == null){
if (manager == null) {
return;
}
manager.addSource(owner);
}
@Override
public void removeSource(IClimateSourceOwner owner){
public void removeSource(IClimateSourceOwner owner) {
World world = owner.getWorldObj();
ClimateSourceWorldManager manager = managers.get(world);
if(manager == null){
if (manager == null) {
return;
}
manager.removeSource(owner);
@@ -70,7 +70,7 @@ public class GreenhouseClimateManager implements IGreenhouseClimateManager {
@Override
public Collection<IClimateSourceOwner> getSources(World world, Position2D position) {
ClimateSourceWorldManager manager = managers.get(world);
if(manager == null){
if (manager == null) {
return Collections.emptyList();
}
return manager.getSources(position);
@@ -54,7 +54,7 @@ public class ClimateSourceModifier implements IClimateModifier {
data.setTag("rangeDown", boundaryDown.writeToNBT(new NBTTagCompound()));
IClimateState targetedState = container.getTargetedState();
if(!targetedState.isPresent()){
if (!targetedState.isPresent()) {
return newState;
}
int workedSources = 0;
@@ -33,7 +33,7 @@ public class TimeModifier implements IClimateModifier {
int lightValue = EnumSkyBlock.SKY.defaultLightValue - world.getSkylightSubtracted();
float sunAngle = world.getCelestialAngleRadians(1.0F);
if(!world.isDaytime()){
if (!world.isDaytime()) {
lightValue = EnumSkyBlock.SKY.defaultLightValue - lightValue;
}
@@ -52,7 +52,7 @@ public class GuiGreenhouse extends GuiForestryTitled<ContainerGreenhouse> {
//Add the camouflage tab
widgetManager.add(new WidgetCamouflageTab(widgetManager, xSize / 4 - WidgetCamouflageTab.WIDTH / 2, -WidgetCamouflageTab.HEIGHT, controller, tile));
if(container.getTargetedState().isPresent()) {
if (container.getTargetedState().isPresent()) {
widgetManager.add(new WidgetClimateBar(widgetManager, xSize / 3 + WidgetClimateBar.WIDTH / 3, -WidgetClimateBar.HEIGHT));
}
widgetManager.add(temperaturePanel = new WidgetClimatePanel(widgetManager, this, 9, 18, ClimateType.TEMPERATURE));
@@ -61,7 +61,7 @@ public class GuiGreenhouse extends GuiForestryTitled<ContainerGreenhouse> {
public void sendNetworkUpdate() {
IClimateState climateState = container.getTargetedState();
if(climateState.isPresent()) {
if (climateState.isPresent()) {
BlockPos pos = controller.getCoordinates();
float temp = temperaturePanel.parseValue();
float hum = humidityPanel.parseValue();
@@ -44,7 +44,7 @@ public class WidgetClimateBar extends Widget {
super(manager, xPos, yPos);
this.width = WIDTH;
this.height = HEIGHT;
for(EnumClimate climate : EnumClimate.values()){
for (EnumClimate climate : EnumClimate.values()) {
buttons.add(new ClimateButton(this, climate, xPos + 5 + climate.ordinal() * 16, yPos + 5));
}
}
@@ -68,9 +68,9 @@ public class WidgetClimatePanel extends Widget {
textField.setValidator(NUMBER_FILTER);
textField.setEnableBackgroundDrawing(false);
IClimateState climateState = gui.container.getTargetedState();
if(climateState.isPresent()) {
if (climateState.isPresent()) {
textField.setText(Float.toString(climateState.get(type)));
}else{
} else {
textField.setVisible(false);
textField.setEnabled(false);
}
@@ -97,8 +97,8 @@ public class WidgetClimatePanel extends Widget {
private int updateTimer = 0;
private void updateData(){
if(updateTimer > 0){
private void updateData() {
if (updateTimer > 0) {
updateTimer--;
return;
}
@@ -107,8 +107,8 @@ public class WidgetClimatePanel extends Widget {
IClimateData data = gui.container.getData();
for (Map.Entry<String, Float> entry : data.getData(type).entrySet()) {
float value = entry.getValue();
int percent = (int)(value * 100);
if(percent != 0) {
int percent = (int) (value * 100);
if (percent != 0) {
table.addValueEntry(entry.getKey(), percent + " %");
}
}
@@ -121,7 +121,7 @@ public class ItemGreenhouseScreen extends ItemForestry implements IColoredItem {
return handleSneaking(world, pos, player, itemStack, itemPos);
}
private EnumActionResult handleSneaking(World world, BlockPos pos,EntityPlayer player, ItemStack itemStack, BlockPos itemPos){
private EnumActionResult handleSneaking(World world, BlockPos pos, EntityPlayer player, ItemStack itemStack, BlockPos itemPos) {
IGreenhouseComponent component = MultiblockUtil.getComponent(world, pos, IGreenhouseComponent.class);
if (component != null) {
IGreenhouseController controller = component.getMultiblockLogic().getController();
@@ -103,7 +103,9 @@ public class ModelCamouflageSprayCan extends BlankModel {
return PerspectiveMapWrapper.handlePerspective(originalModel, state, cameraTransformType);
}
} @Override
}
@Override
protected ItemOverrideList createOverrides() {
return new SprayCanOverrideList();
}
@@ -25,13 +25,13 @@ import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
import forestry.core.models.DefaultTextureGetter;
import forestry.core.models.ModelBlockCustomCached;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ModelUtil;
import forestry.greenhouse.api.greenhouse.GreenhouseManager;
import forestry.greenhouse.blocks.BlockGreenhouseWindow;
import forestry.greenhouse.blocks.State;
import forestry.greenhouse.tiles.TileGreenhouseWindow;
@@ -399,7 +399,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
createDefaultState();
limits = createLimits();
if(!climateContainer.getTargetedState().isPresent()) {
if (!climateContainer.getTargetedState().isPresent()) {
IClimateState defaultClimate = getDefaultClimate();
climateContainer.setState(defaultClimate.toState(ClimateStateType.MUTABLE));
climateContainer.setTargetedState(defaultClimate);
@@ -14,9 +14,9 @@ import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
import forestry.core.network.PacketBufferForestry;
import forestry.greenhouse.api.greenhouse.IGreenhouseLimits;
import forestry.greenhouse.api.greenhouse.Position2D;
import forestry.core.network.PacketBufferForestry;
public class GreenhouseLimits implements IGreenhouseLimits {
private final Position2D maximumCoordinates;
@@ -50,6 +50,7 @@ public interface IGreenhouseControllerInternal extends IGreenhouseController, IM
IClimateContainer getClimateContainer();
/* IGreenhouseHousing */
/**
* @return the manager of this housing.
*/
@@ -18,9 +18,9 @@ import java.util.Set;
import net.minecraft.util.math.BlockPos;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.core.network.IStreamable;
import forestry.core.network.PacketBufferForestry;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.greenhouse.network.packets.PacketGreenhouseData;
/**
@@ -58,7 +58,7 @@ public class BlankBlockHandler implements IGreenhouseBlockHandler<IBlankBlock, I
if (storage.setBlock(position, blockToCheck)) {
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
IErrorState errorState = checkBlockFacing(storage, blockToCheck, position, facing, newBlocksToCheck);
if(errorState != null){
if (errorState != null) {
return errorState;
}
}
@@ -90,13 +90,13 @@ public class BlankBlockHandler implements IGreenhouseBlockHandler<IBlankBlock, I
IGreenhouseProvider provider = storage.getProvider();
IErrorState errorState = provider.checkPosition(facingPosition);
if(errorState != null){
if (errorState != null) {
return errorState;
}
IGreenhouseBlock logicBlock = storage.getBlock(facingPosition);
for (IGreenhouseBlockHandler handler : provider.getHandlers()) {
if(handler.onCheckPosition(storage, blockToCheck, facingPosition, facing, logicBlock, newBlocksToCheck)){
if (handler.onCheckPosition(storage, blockToCheck, facingPosition, facing, logicBlock, newBlocksToCheck)) {
break;
}
}
@@ -24,14 +24,14 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.core.network.IStreamable;
import forestry.core.network.PacketBufferForestry;
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;
import forestry.greenhouse.multiblock.blocks.client.ClientBlock;
import forestry.greenhouse.multiblock.blocks.client.ClientBlockHandler;
@@ -229,7 +229,7 @@ public class GreenhouseProviderServer extends GreenhouseProvider {
builder.recalculate(position);
List<IGreenhouseBlock> newBlocksToCheck = new LinkedList<>();
IErrorState errorState = handler.checkNeighborBlocks(storage, blockToCheck, newBlocksToCheck);
if(errorState != null){
if (errorState != null) {
errorLogic.setCondition(true, errorState);
}
blocksToCheck.addAll(newBlocksToCheck);
@@ -255,9 +255,9 @@ public class GreenhouseProviderServer extends GreenhouseProvider {
errorLogic.setCondition(true, EnumErrorCode.NOT_LOADED);
return GreenhouseState.UNLOADED_CHUNK;
}
if(errorLogic.hasErrors()){
if (errorLogic.hasErrors()) {
//Remove the state NOT_CLOSED if the logic has the state TOO_LARGE because the state NOT_CLOSED can be caused by the TOO_LARGE state
if(errorLogic.getErrorStates().contains(EnumErrorCode.TOO_LARGE)){
if (errorLogic.getErrorStates().contains(EnumErrorCode.TOO_LARGE)) {
errorLogic.setCondition(false, EnumErrorCode.NOT_CLOSED);
}
return GreenhouseState.OPEN;
@@ -16,15 +16,15 @@ import java.util.List;
import net.minecraft.util.math.BlockPos;
import forestry.greenhouse.api.climate.IClimateContainer;
import forestry.greenhouse.api.climate.IClimateSource;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
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 {
@@ -24,8 +24,8 @@ import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.core.utils.Log;
import forestry.greenhouse.api.greenhouse.IGreenhouseProvider;
import forestry.greenhouse.multiblock.blocks.storage.GreenhouseChunk;
public class ChunkThread implements Runnable {
@@ -18,11 +18,11 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import forestry.core.utils.World2ObjectMap;
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;
import forestry.greenhouse.multiblock.blocks.wall.WallBlockHandler;
@@ -28,14 +28,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.greenhouse.api.climate.IClimateContainer;
import forestry.api.climate.IClimateState;
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
import forestry.core.models.BlockModelEntry;
import forestry.core.models.ModelEntry;
import forestry.core.models.ModelManager;
import forestry.greenhouse.GreenhouseEventHandler;
import forestry.greenhouse.PluginGreenhouse;
import forestry.greenhouse.api.climate.IClimateContainer;
import forestry.greenhouse.api.greenhouse.IGreenhouseBlock;
import forestry.greenhouse.blocks.BlockClimatiser;
import forestry.greenhouse.blocks.BlockGreenhouse;
import forestry.greenhouse.blocks.BlockRegistryGreenhouse;
@@ -27,8 +27,6 @@ import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitBoard;
import forestry.api.circuits.ICircuitSocketType;
import forestry.api.climate.ClimateType;
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;
@@ -42,6 +40,8 @@ import forestry.core.tiles.IActivatable;
import forestry.core.tiles.TileForestry;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.NetworkUtil;
import forestry.greenhouse.api.climate.IClimateSource;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
import forestry.greenhouse.blocks.BlockClimatiser;
import forestry.greenhouse.camouflage.CamouflageHandlerType;
import forestry.greenhouse.climate.ClimateSourceClimatiser;
@@ -14,10 +14,10 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.greenhouse.api.greenhouse.DefaultGreenhouseListener;
import forestry.api.greenhouse.IGreenhouseListener;
import forestry.api.multiblock.IGreenhouseComponent;
import forestry.api.multiblock.IGreenhouseController;
import forestry.greenhouse.api.greenhouse.DefaultGreenhouseListener;
public class TileGreenhouseControl extends TileGreenhouse implements IGreenhouseComponent.Listener {
@@ -23,11 +23,11 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
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;
import forestry.greenhouse.api.climate.IClimateSource;
import forestry.greenhouse.api.climate.IClimateSourceOwner;
import forestry.greenhouse.blocks.BlockGreenhouseWindow;
import forestry.greenhouse.climate.ClimateSourceWindow;
@@ -1,5 +0,0 @@
package forestry.lepidopterology.blocks;
public class BlockButterflyNursery {
}