mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
Merge branch 'Greenhouse' of https://github.com/ForestryMC/ForestryMC into mc-1.12
This commit is contained in:
commit
26bf69effc
413 files changed
+13569
-7506
No files matched your search
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
|
||||
public class ArboricultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorNaturalist}.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@@ -8,6 +8,7 @@ package forestry.api.circuits;
|
||||
public enum CircuitSocketType implements ICircuitSocketType {
|
||||
NONE("none"),
|
||||
FARM("forestry.farm"),
|
||||
GREENHOUSE_CLIMATISER("forestry.greenhouse.climatiser"),
|
||||
ELECTRIC_ENGINE("forestry.electric.engine"),
|
||||
MACHINE("forestry.machine");
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class BlankClimateModifier implements IClimateModifier {
|
||||
@Override
|
||||
public IClimateState modifyTarget(IClimateContainer container, IClimateState newState, ImmutableClimateState oldState, NBTTagCompound data) {
|
||||
return newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} that has a range from 0.0F to 2.0F and can be positiv an negativ.
|
||||
*
|
||||
*
|
||||
* It is mainly used by {@link IClimateSource} to change the {@link IClimateState} of the {@link IClimateContainer}.
|
||||
*/
|
||||
public class ClimateChange implements IClimateState, INbtReadable{
|
||||
|
||||
private static final String TEMPERATURE_NBT_KEY = "TEMP";
|
||||
private static final String HUMIDITY_NBT_KEY = "HUMID";
|
||||
public static final ClimateChange ORIGIN = new ClimateChange(0.0F, 0.0F);
|
||||
|
||||
|
||||
public float temperature;
|
||||
public float humidity;
|
||||
|
||||
public ClimateChange(float temperature, float humidity) {
|
||||
addTemperature(temperature);
|
||||
addHumidity(humidity);
|
||||
}
|
||||
|
||||
public ClimateChange(NBTTagCompound compound) {
|
||||
readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setFloat(TEMPERATURE_NBT_KEY, temperature);
|
||||
compound.setFloat(HUMIDITY_NBT_KEY, humidity);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.temperature = compound.getFloat(TEMPERATURE_NBT_KEY);
|
||||
this.humidity = compound.getFloat(HUMIDITY_NBT_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setTemperature(float temperature) {
|
||||
this.temperature = 0;
|
||||
addTemperature(temperature);
|
||||
}
|
||||
|
||||
public void setHumidity(float humidity) {
|
||||
this.humidity = 0;
|
||||
addHumidity(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateChange add(IClimateState state){
|
||||
addTemperature(state.getTemperature());
|
||||
addHumidity(state.getHumidity());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateChange remove(IClimateState state){
|
||||
addTemperature(-state.getTemperature());
|
||||
addHumidity(-state.getHumidity());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateChange addTemperature(float temperature){
|
||||
this.temperature = MathHelper.clamp(this.temperature + temperature, -2.0F, 2.0F);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateChange addHumidity(float humidity){
|
||||
this.humidity = MathHelper.clamp(this.humidity + humidity, -2.0F, 2.0F);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState toImmutable() {
|
||||
return new ImmutableClimateState(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState toMutable() {
|
||||
return new ClimateState(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("temperature", temperature).add("humidity", humidity).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
|
||||
import static forestry.api.climate.ImmutableClimateState.MAX;
|
||||
import static forestry.api.climate.ImmutableClimateState.MIN;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} that has a range from 0.0F to 2.0F.
|
||||
*/
|
||||
public class ClimateState implements IClimateState, INbtReadable{
|
||||
|
||||
private static final String TEMPERATURE_NBT_KEY = "TEMP";
|
||||
private static final String HUMIDITY_NBT_KEY = "HUMID";
|
||||
|
||||
protected float temperature;
|
||||
protected float humidity;
|
||||
|
||||
public ClimateState(float temperature, float humidity) {
|
||||
addTemperature(temperature);
|
||||
addHumidity(humidity);
|
||||
}
|
||||
|
||||
public ClimateState(NBTTagCompound compound) {
|
||||
readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setFloat(TEMPERATURE_NBT_KEY, temperature);
|
||||
compound.setFloat(HUMIDITY_NBT_KEY, humidity);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.temperature = compound.getFloat(TEMPERATURE_NBT_KEY);
|
||||
this.humidity = compound.getFloat(HUMIDITY_NBT_KEY);
|
||||
}
|
||||
|
||||
public void setTemperature(float temperature) {
|
||||
this.temperature = MathHelper.clamp(temperature, MIN.temperature, MAX.temperature);
|
||||
}
|
||||
|
||||
public void setHumidity(float humidity) {
|
||||
this.humidity = MathHelper.clamp(humidity, MIN.humidity, MAX.humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState addTemperature(float temperature){
|
||||
setTemperature(this.temperature + temperature);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState addHumidity(float humidity){
|
||||
setHumidity(this.humidity + humidity);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState add(IClimateState state){
|
||||
addTemperature(state.getTemperature());
|
||||
addHumidity(state.getHumidity());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState remove(IClimateState state){
|
||||
addTemperature(-state.getTemperature());
|
||||
addHumidity(-state.getHumidity());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState toImmutable(){
|
||||
return new ImmutableClimateState(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState toMutable(){
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof IClimateState)){
|
||||
return false;
|
||||
}
|
||||
IClimateState otherState = (IClimateState) obj;
|
||||
return otherState.getTemperature() == temperature && otherState.getHumidity() == humidity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Float.hashCode(temperature) + Float.hashCode(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("temperature", temperature).add("humidity", humidity).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
public enum ClimateType {
|
||||
TEMPERATURE, HUMIDITY;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite() {
|
||||
return ForestryAPI.textureManager.getDefault("misc/" + getName());
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserModes {
|
||||
|
||||
POSITIVE, NEGATIVE, BOTH
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserTypes {
|
||||
|
||||
TEMPERATURE, HUMIDITY, BOTH
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum GreenhouseState {
|
||||
CLOSED,
|
||||
//If the greenhouse is not closed.
|
||||
OPEN,
|
||||
//If one chunk of the greenhouse is unloaded.
|
||||
UNLOADED_CHUNK,
|
||||
//The greenhouse has this state 20 ticks after all chunks are loaded, needed to load all climate sources.
|
||||
UNLOADED,
|
||||
//If the greenhouse is not assembled.
|
||||
UNREADY
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
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 addListaner(IClimateContainerListener listener);
|
||||
|
||||
/**
|
||||
* Remove a listener to this container.
|
||||
*/
|
||||
void removeListener(IClimateContainerListener listener);
|
||||
|
||||
/**
|
||||
* All listeners of this container.
|
||||
*/
|
||||
Collection<IClimateContainerListener> getListeners();
|
||||
|
||||
/**
|
||||
* @return the state that the container targets to get his climate state to.
|
||||
*/
|
||||
ImmutableClimateState getTargetedState();
|
||||
|
||||
void setTargetedState(ImmutableClimateState state);
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
IClimateData getData();
|
||||
|
||||
}
|
||||
+7
-8
@@ -5,14 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.Set;
|
||||
public interface IClimateContainerListener {
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IClimateSourceProvider extends ILocatable {
|
||||
|
||||
IClimateSource getClimateSource();
|
||||
/**
|
||||
* Test if the container is closed.
|
||||
*
|
||||
* @return true to let the container slowly set his climate state back to the default climate state.
|
||||
*/
|
||||
boolean isClosed(IClimateContainer container);
|
||||
|
||||
Set<BlockPos> getPositionsInRange();
|
||||
}
|
||||
+4
-7
@@ -5,14 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimatiserDefinition {
|
||||
import java.util.Map;
|
||||
|
||||
float getChange();
|
||||
public interface IClimateData {
|
||||
|
||||
float getRange();
|
||||
|
||||
EnumClimatiserModes getMode();
|
||||
|
||||
EnumClimatiserTypes getType();
|
||||
IClimateData addData(ClimateType type, String displayName, float value);
|
||||
|
||||
Map<String, Float> getData(ClimateType type);
|
||||
}
|
||||
+7
-6
@@ -5,12 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
public interface IClimateFactory {
|
||||
|
||||
public interface IClimateControlProvider extends ILocatable {
|
||||
|
||||
IClimateInfo getControlClimate();
|
||||
/**
|
||||
* @param climatedRegion
|
||||
*
|
||||
* @return Creates a climate container.
|
||||
*/
|
||||
IClimateContainer createContainer(IClimateHousing climatedRegion);
|
||||
|
||||
void setControlClimate(IClimateInfo climateControl);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateHousing {
|
||||
|
||||
/**
|
||||
* @return The climate container of this region.
|
||||
*/
|
||||
IClimateContainer getClimateContainer();
|
||||
|
||||
/**
|
||||
* @return The size of the region in blocks.
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
void onUpdateClimate();
|
||||
|
||||
/**
|
||||
* @return The default climate state. It is calculated out of all biomedata that this region contains.
|
||||
*/
|
||||
ImmutableClimateState getDefaultClimate();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The position at that the housing is.
|
||||
*/
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The world in that the housing is.
|
||||
*/
|
||||
World getWorldObj();
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimateInfo {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
}
|
||||
@@ -6,36 +6,42 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.greenhouse.Position2D;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
IClimateInfo createInfo(float temperature, float humidity);
|
||||
|
||||
IClimateInfo getInfo(World world, BlockPos pos);
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
IClimateState getClimateState(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Creates a climate state with the help of the biome on this position.
|
||||
*/
|
||||
ImmutableClimateState getBiomeState(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return Create a climate manager.
|
||||
*/
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
|
||||
void removeRegion(IClimateRegion region);
|
||||
|
||||
void addSource(IClimateSourceProvider source);
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
void onWorldUnload(World world);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
void addSource(IClimateSourceOwner owner);
|
||||
|
||||
void removeSource(IClimateSourceOwner owner);
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
|
||||
Map<World, List<IClimateRegion>> getRegions();
|
||||
Collection<IClimateSourceOwner> getSources(World world, Position2D position);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* 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}.
|
||||
* @return a modify newState or the newState.
|
||||
*/
|
||||
IClimateState modifyTarget(IClimateContainer container, IClimateState newState, ImmutableClimateState oldState, NBTTagCompound data);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
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.
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* A IClimatePosition contains the climate infos (temperature and humidity) of one position.
|
||||
*/
|
||||
public interface IClimatePosition extends INbtReadable, INbtWritable {
|
||||
|
||||
IClimateRegion getClimateRegion();
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
void setTemperature(float temperature);
|
||||
|
||||
void addTemperature(float temperature);
|
||||
|
||||
float getTemperature();
|
||||
|
||||
void setHumidity(float humidity);
|
||||
|
||||
void addHumidity(float humidity);
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateInfo getInfo();
|
||||
|
||||
}
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateRegion extends INbtReadable, INbtWritable {
|
||||
|
||||
World getWorld();
|
||||
|
||||
int getTicksPerUpdate();
|
||||
|
||||
void setPosition(BlockPos pos, float temperature, float humidity);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(BlockPos pos);
|
||||
|
||||
Collection<IClimatePosition> getPositions();
|
||||
|
||||
void addSource(IClimateSource source);
|
||||
|
||||
void removeSource(IClimateSource source);
|
||||
|
||||
Collection<IClimateSource> getSources();
|
||||
|
||||
void calculateAverageClimate();
|
||||
|
||||
float getAverageTemperature();
|
||||
|
||||
float getAverageHumidity();
|
||||
|
||||
/**
|
||||
* Update the climate in a region.
|
||||
*/
|
||||
void updateClimate(int ticks);
|
||||
|
||||
}
|
||||
@@ -8,23 +8,49 @@ package forestry.api.climate;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
* 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}.
|
||||
*/
|
||||
public interface IClimateSource {
|
||||
|
||||
|
||||
/**
|
||||
* @param tickCount The current tick count.
|
||||
* @param region The climate region, in that the source stands.
|
||||
* @return Return true if the the climate has changed.
|
||||
* The owner of this source.
|
||||
*/
|
||||
boolean changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
/**
|
||||
* @return The ticks that are required for one change.
|
||||
*/
|
||||
int getTicksForChange(IClimateRegion region);
|
||||
|
||||
@Nullable
|
||||
IClimateSourceProvider getProvider();
|
||||
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 target the by the {@link IClimateContainer} targeted {@link IClimateState}.
|
||||
*
|
||||
*/
|
||||
ClimateChange work(IClimateState state, ImmutableClimateState 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}.
|
||||
*/
|
||||
void onRemoved(IClimateContainer container);
|
||||
|
||||
}
|
||||
+6
-13
@@ -5,18 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimateControl {
|
||||
|
||||
IClimateInfo getControlClimate();
|
||||
|
||||
void setControlClimate(IClimateInfo climateInfo);
|
||||
|
||||
float getControlTemperature();
|
||||
|
||||
float getControlHumidity();
|
||||
|
||||
void setControlTemperature(float temperature);
|
||||
|
||||
void setControlHumidity(float humidity);
|
||||
import forestry.api.circuits.ICircuit;
|
||||
|
||||
public interface IClimateSourceCircuitable extends IClimateSource {
|
||||
/**
|
||||
* Called by the {@link IClimateSourceOwner} if its {@link ICircuit} changes.
|
||||
*/
|
||||
void changeSourceConfig(ClimateType type, float changeChange, float rangeChange);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @since 5.3.4
|
||||
*
|
||||
*/
|
||||
public interface IClimateSourceContainer {
|
||||
|
||||
/**
|
||||
* Add a climate source to this container.
|
||||
*/
|
||||
void addClimateSource(IClimateSource source);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
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}
|
||||
*/
|
||||
boolean isCircuitable();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} is used to store and handle temperature and humidity.
|
||||
*
|
||||
* 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}.
|
||||
*/
|
||||
public interface IClimateState extends INbtWritable {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateState addTemperature(float temperature);
|
||||
|
||||
IClimateState addHumidity(float humidity);
|
||||
|
||||
IClimateState add(IClimateState state);
|
||||
|
||||
IClimateState remove(IClimateState state);
|
||||
|
||||
default float get(ClimateType type){
|
||||
return type == ClimateType.HUMIDITY ? getHumidity() : getTemperature();
|
||||
}
|
||||
|
||||
ImmutableClimateState toImmutable();
|
||||
|
||||
ClimateState toMutable();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} that has a range from 0.0F to 2.0F and can not be changed.
|
||||
*/
|
||||
public class ImmutableClimateState implements IClimateState, INbtWritable{
|
||||
|
||||
// The minimum climate state.
|
||||
public static final ImmutableClimateState MIN = new ImmutableClimateState(0.0F, 0.0F);
|
||||
// The climate state of a plain biome.
|
||||
public static final ImmutableClimateState PLAIN = new ImmutableClimateState(0.8F, 0.4F);
|
||||
// The maximum climate state.
|
||||
public static final ImmutableClimateState MAX = new ImmutableClimateState(2.0F, 2.0F);
|
||||
|
||||
private static final String TEMPERATURE_NBT_KEY = "TEMP";
|
||||
private static final String HUMIDITY_NBT_KEY = "HUMID";
|
||||
|
||||
protected final float temperature;
|
||||
protected final float humidity;
|
||||
|
||||
public ImmutableClimateState(float temperature, float humidity) {
|
||||
this.temperature = MathHelper.clamp(temperature, 0.0F, 2.0F);
|
||||
this.humidity = MathHelper.clamp(humidity, 0.0F, 2.0F);
|
||||
|
||||
}
|
||||
|
||||
public ImmutableClimateState(NBTTagCompound compound) {
|
||||
float temperature = compound.getFloat(TEMPERATURE_NBT_KEY);
|
||||
float humidity = compound.getFloat(HUMIDITY_NBT_KEY);
|
||||
this.temperature = MathHelper.clamp(temperature, 0.0F, 2.0F);
|
||||
this.humidity = MathHelper.clamp(humidity, 0.0F, 2.0F);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setFloat(TEMPERATURE_NBT_KEY, temperature);
|
||||
compound.setFloat(HUMIDITY_NBT_KEY, humidity);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState addTemperature(float temperature){
|
||||
return new ImmutableClimateState(this.temperature + temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState addHumidity(float humidity){
|
||||
return new ImmutableClimateState(this.temperature, this.humidity + humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState remove(IClimateState state) {
|
||||
return new ImmutableClimateState(temperature - state.getTemperature(), humidity - state.getHumidity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState add(IClimateState state) {
|
||||
return new ImmutableClimateState(temperature + state.getTemperature(), humidity + state.getHumidity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableClimateState toImmutable(){
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState toMutable(){
|
||||
return new ClimateState(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof IClimateState)){
|
||||
return false;
|
||||
}
|
||||
IClimateState otherState = (IClimateState) obj;
|
||||
return otherState.getTemperature() == temperature && otherState.getHumidity() == humidity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Float.hashCode(temperature) + Float.hashCode(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("temperature", temperature).add("humidity", humidity).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
@API(apiVersion = "5.0.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -9,12 +9,4 @@ public class CamouflageManager {
|
||||
|
||||
public static ICamouflageAccess camouflageAccess;
|
||||
|
||||
public static final String BLOCK = "block";
|
||||
|
||||
public static final String GLASS = "glass";
|
||||
|
||||
public static final String DOOR = "door";
|
||||
|
||||
public static final String NONE = "none";
|
||||
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public enum EnumHumidity {
|
||||
*/
|
||||
DAMP("Damp");
|
||||
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
EnumHumidity(String name) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -73,7 +74,8 @@ public enum EnumTemperature {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = ForestryAPI.climateManager.getInfo(world, pos).getTemperature();
|
||||
IClimateState state = ForestryAPI.climateManager.getClimateState(world, pos);
|
||||
float temperature = state.getTemperature();
|
||||
return getFromValue(temperature);
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@ package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateFactory;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
@@ -48,6 +50,12 @@ public class ForestryAPI {
|
||||
public static IModelManager modelManager;
|
||||
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
/**
|
||||
* A factory to create climate related things.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
public static IClimateFactory climateFactory;
|
||||
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
|
||||
|
||||
@@ -7,6 +7,8 @@ package forestry.api.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICamouflageAccess {
|
||||
@@ -16,21 +18,20 @@ public interface ICamouflageAccess {
|
||||
*
|
||||
* @param itemHandler The handler that is to register.
|
||||
*/
|
||||
void registerCamouflageItemHandler(ICamouflageItemHandler itemHandler);
|
||||
void registerItemHandler(ICamouflageItemHandler itemHandler);
|
||||
|
||||
/**
|
||||
* @return A list of all item camouflage handler's that are registered for that camouflage type.
|
||||
*/
|
||||
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
|
||||
List<ICamouflageItemHandler> getItemHandlers();
|
||||
|
||||
void addItemToBlackList(String type, ItemStack camouflageBlock);
|
||||
void addItemToBlackList(ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(String type, String modID);
|
||||
void addModIdToBlackList(String modID);
|
||||
|
||||
boolean isItemBlackListed(String type, ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getNoneItemHandler();
|
||||
boolean isItemBlackListed(ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
|
||||
@Nullable
|
||||
ICamouflageItemHandler getHandler(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -12,22 +12,17 @@ public interface ICamouflageHandler extends ILocatable {
|
||||
/**
|
||||
* @return The item of the block that is the camouflage of this handler for the type.
|
||||
*/
|
||||
ItemStack getCamouflageBlock(String type);
|
||||
ItemStack getCamouflageBlock();
|
||||
|
||||
/**
|
||||
* @return The default camouflage block item for the type.
|
||||
*/
|
||||
ItemStack getDefaultCamouflageBlock(String type);
|
||||
|
||||
/**
|
||||
* @return True if the handler can handle this type of camouflage.
|
||||
*/
|
||||
boolean canHandleType(String type);
|
||||
ItemStack getDefaultCamouflageBlock();
|
||||
|
||||
/**
|
||||
* Set the camouflage block item for the type.
|
||||
*
|
||||
* @return True if the block has chanced.
|
||||
*/
|
||||
boolean setCamouflageBlock(String type, ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
}
|
||||
@@ -5,21 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public interface ICamouflageItemHandler {
|
||||
|
||||
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
String getType();
|
||||
|
||||
float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
|
||||
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface ICamouflagedTile {
|
||||
|
||||
String getCamouflageType();
|
||||
|
||||
BlockPos getCoordinates();
|
||||
public interface ICamouflagedTile extends ILocatable {
|
||||
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Interface for things, that have a location.
|
||||
* Must not be named "getWorld" and "getPos" to avoid
|
||||
* SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
World getWorldObj();
|
||||
}
|
||||
@@ -34,6 +34,8 @@ public interface IModelBaker {
|
||||
|
||||
void addBakedModel(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addBakedModelPost(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addFace(EnumFacing facing, TextureAtlasSprite sprite);
|
||||
|
||||
void setModelState(@Nullable IModelState modelState);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +23,10 @@ public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*
|
||||
* @return Null if the farming plugin is not active.
|
||||
*/
|
||||
@Nullable
|
||||
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
public interface IAlleleProperty<A extends IAlleleProperty<A>> extends IAllele, Comparable<A> {
|
||||
|
||||
@@ -207,7 +207,7 @@ public interface IAlleleRegistry {
|
||||
* @param handler IAlleleHandler to register.
|
||||
*/
|
||||
void registerAlleleHandler(IAlleleHandler handler);
|
||||
|
||||
|
||||
/* BLACKLIST */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* @author Nedelosk
|
||||
* @since 5.12.16
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class GreenhouseEvents extends Event {
|
||||
|
||||
public final IGreenhouseController controller;
|
||||
|
||||
public GreenhouseEvents(IGreenhouseController state) {
|
||||
this.controller = state;
|
||||
}
|
||||
|
||||
public static class InternalBlockEvent extends GreenhouseEvents {
|
||||
public final IInternalBlock internalBlock;
|
||||
|
||||
public InternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller);
|
||||
|
||||
this.internalBlock = internalBlock;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CreateInternalBlockEvent extends InternalBlockEvent {
|
||||
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller, internalBlock);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent {
|
||||
public final IInternalBlockFace face;
|
||||
|
||||
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, IInternalBlockFace face) {
|
||||
super(controller, internalBlock);
|
||||
|
||||
this.face = face;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,5 +8,7 @@ package forestry.api.greenhouse;
|
||||
public class GreenhouseManager {
|
||||
|
||||
public static IGreenhouseHelper greenhouseHelper;
|
||||
|
||||
public static IGreenhouseBlockManager greenhouseBlockManager;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Set;
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.greenhouse.multiblock.blocks.GreenhouseException;
|
||||
|
||||
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);
|
||||
|
||||
B getBlock(IGreenhouseBlockStorage storage, BlockPos position);
|
||||
|
||||
List<IGreenhouseBlock> checkNeighborBlocks(IGreenhouseBlockStorage storage, B blockToCheck) throws GreenhouseException;
|
||||
|
||||
boolean onCheckPosition(IGreenhouseBlockStorage storage, R rootBlock, BlockPos position, EnumFacing facing, IGreenhouseBlock block, List<IGreenhouseBlock> newBlocksToCheck) throws GreenhouseException;
|
||||
|
||||
Class<? extends B> getBlockClass();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.
|
||||
*
|
||||
* @return a {@link IGreenhouseBlock} if any manager of the chunk at this position has one block at this position, otherwise null.
|
||||
*/
|
||||
@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){
|
||||
return getChunk(world, ChunkPos.asLong(xPos, 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){
|
||||
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);
|
||||
|
||||
void markProviderDirty(World world, BlockPos pos, IGreenhouseProvider provider);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IGreenhouseBlockStorage {
|
||||
/**
|
||||
* @return a {@link IGreenhouseBlock} if there is one on this position.
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseBlock getBlock(BlockPos pos);
|
||||
|
||||
/**
|
||||
* Sets a {@link IGreenhouseBlock} to a position in the world.
|
||||
*/
|
||||
boolean setBlock(BlockPos pos, @Nullable IGreenhouseBlock block);
|
||||
|
||||
/**
|
||||
* @return The number of {@link IBlankBlock}s that this provider contains.
|
||||
*/
|
||||
int getBlockCount();
|
||||
|
||||
/**
|
||||
* Removes a {@link IGreenhouseBlock} from this provider and add its neighbor blocks to the set.
|
||||
*/
|
||||
<B extends IGreenhouseBlock> void removeBlock(IGreenhouseBlock block);
|
||||
|
||||
IGreenhouseProvider getProvider();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* A greenhouse chunk is used to save the greenhouse managers from the greenhouses that are located in the world chunk on this chunk position.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @return A {@link IGreenhouseBlock} if any manager has one block at this position, otherwise null.
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseBlock get(BlockPos pos);
|
||||
|
||||
/**
|
||||
* Adds a manager to this chunk.
|
||||
*/
|
||||
void add(IGreenhouseProvider manager);
|
||||
|
||||
/**
|
||||
* Removed a manager from this chunk.
|
||||
*/
|
||||
void remove(IGreenhouseProvider manager);
|
||||
}
|
||||
@@ -5,17 +5,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.climate.IClimateModifier;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseHelper {
|
||||
|
||||
/**
|
||||
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
|
||||
|
||||
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);
|
||||
|
||||
void registerModifier(IClimateModifier modifier);
|
||||
|
||||
Collection<IClimateModifier> getModifiers();
|
||||
|
||||
}
|
||||
@@ -5,26 +5,43 @@
|
||||
******************************************************************************/
|
||||
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;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseHousing extends IErrorLogicSource {
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
float getExactTemperature();
|
||||
|
||||
float getExactHumidity();
|
||||
|
||||
public interface IGreenhouseHousing extends IErrorLogicSource, IClimateHousing{
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The world in that the housing is.
|
||||
* @return The current tempreture as an enum.
|
||||
*/
|
||||
World getWorldObj();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
/**
|
||||
* @return The current humidity as an enum.
|
||||
*/
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
/**
|
||||
* @return The current tempreture as an float. Range: 0.0F ~ 2.0F
|
||||
*/
|
||||
float getExactTemperature();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
/**
|
||||
* The limits that a greenhouse has. Used in the {@link IGreenhouseProvider} to test if the greenhouse is tested.
|
||||
* At the test the provider stops if the currently tested position is out of this limits and marks the greenhouse as open.
|
||||
*/
|
||||
public interface IGreenhouseLimits {
|
||||
|
||||
/**
|
||||
* @return The maximum bounding-box coordinate.
|
||||
*/
|
||||
Position2D getMaximumCoordinates();
|
||||
|
||||
/**
|
||||
* @return The minimum bounding-box coordinate.
|
||||
*/
|
||||
Position2D getMinimumCoordinates();
|
||||
|
||||
/**
|
||||
* @return the maximal height of the manager on the y axis.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* @return the maximal depth of the manager on the y axis.
|
||||
*/
|
||||
int getDepth();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
public interface IGreenhouseLogic extends INbtReadable, INbtWritable{
|
||||
|
||||
void work(int ticks);
|
||||
|
||||
String getUID();
|
||||
|
||||
}
|
||||
+4
-12
@@ -5,18 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IInternalBlock {
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
@Nullable
|
||||
IInternalBlock getRoot();
|
||||
|
||||
Collection<IInternalBlockFace> getFaces();
|
||||
public interface IGreenhouseLogicFactory {
|
||||
|
||||
IGreenhouseLogic createLogic(IGreenhouseController controller);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
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.multiblock.blocks.GreenhouseException;
|
||||
|
||||
/**
|
||||
* Can be used to test if a space is closed. Is used by the greenhouse.
|
||||
*
|
||||
*/
|
||||
public interface IGreenhouseProvider {
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
Collection<IGreenhouseProviderListener> getListeners();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @return The last error that has coded that the provider is not closed.
|
||||
*/
|
||||
String getLastNotClosedError();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
BlockPos getCenterPos();
|
||||
|
||||
/**
|
||||
* @return The limits that a greenhouse has. Used to test if the greenhouse is tested.
|
||||
* At the test the provider stops if the currently tested position is out of this limits and marks the greenhouse as open.
|
||||
*/
|
||||
IGreenhouseLimits getLimits();
|
||||
|
||||
/**
|
||||
* Null if the provider is not created.
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseLimits getUsedLimits();
|
||||
|
||||
GreenhouseState getState();
|
||||
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
* @return true if the space is closed.
|
||||
*/
|
||||
boolean isClosed();
|
||||
|
||||
/**
|
||||
* Test if the provider is closed.
|
||||
*/
|
||||
void checkPosition(BlockPos position) throws GreenhouseException;
|
||||
|
||||
int getSize();
|
||||
|
||||
/**
|
||||
* @return All {@link IGreenhouseBlockHandler}s that this provider uses.
|
||||
*/
|
||||
Collection<IGreenhouseBlockHandler> getHandlers();
|
||||
|
||||
IGreenhouseBlockStorage getStorage();
|
||||
|
||||
void onBlockChange();
|
||||
|
||||
void scheduledUpdate();
|
||||
}
|
||||
+4
-11
@@ -5,17 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IInternalBlockFace {
|
||||
|
||||
boolean isTested();
|
||||
|
||||
void setTested(boolean tested);
|
||||
|
||||
EnumFacing getFace();
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
public interface IGreenhouseProviderListener {
|
||||
|
||||
void onCheckPosition(BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import forestry.api.climate.IClimateSource;
|
||||
|
||||
public interface IWallBlock extends IGreenhouseBlock {
|
||||
|
||||
void setRoot(IBlankBlock parent);
|
||||
|
||||
void setRootFace(EnumFacing facing);
|
||||
|
||||
void onCreate();
|
||||
|
||||
void onRemove();
|
||||
|
||||
void add(IClimateSource source);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
@Immutable
|
||||
public class Position2D implements Comparable<Position2D>, INbtWritable {
|
||||
public static final Position2D NULL_POSITION = new Position2D(0, 0);
|
||||
/** X coordinate */
|
||||
private final int x;
|
||||
/** Z coordinate */
|
||||
private final int z;
|
||||
|
||||
public Position2D(Vec3i pos) {
|
||||
this(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
public Position2D(Position2D pos) {
|
||||
this(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
public Position2D(int xIn, int zIn) {
|
||||
this.x = xIn;
|
||||
this.z = zIn;
|
||||
}
|
||||
|
||||
public Position2D(NBTTagCompound nbtTagCompound) {
|
||||
this.x = nbtTagCompound.getInteger("xPosition");
|
||||
this.z = nbtTagCompound.getInteger("zPosition");
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
} else if (o instanceof Vec3i) {
|
||||
Vec3i position = (Vec3i) o;
|
||||
return this.getX() == position.getX() && this.getZ() == position.getZ();
|
||||
} else if (!(o instanceof Position2D)) {
|
||||
return false;
|
||||
} else {
|
||||
Position2D position = (Position2D) o;
|
||||
return this.getX() == position.getX() && this.getZ() == position.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
public Position2D clamp(Position2D min, Position2D max) {
|
||||
int x = MathHelper.clamp(this.x, min.getX(), max.getX());
|
||||
int z = MathHelper.clamp(this.z, min.getZ(), max.getZ());
|
||||
return new Position2D(x, z);
|
||||
}
|
||||
|
||||
public Position2D add(int x, int z) {
|
||||
return x == 0 && z == 0 ? this : new Position2D(this.getX() + x, this.getZ() + z);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (this.getZ() + this.getX() * 31);
|
||||
}
|
||||
|
||||
public int compareTo(Position2D o) {
|
||||
return this.getZ() == o.getZ() ? this.getX() - o.getX() : this.getZ() - o.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("xPosition", x);
|
||||
nbt.setInteger("zPosition", z);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the X coordinate.
|
||||
*/
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Z coordinate.
|
||||
*/
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public double getDistance(int xIn, int zIn) {
|
||||
double d0 = (double) (this.getX() - xIn);
|
||||
double d2 = (double) (this.getZ() - zIn);
|
||||
return Math.sqrt(d0 * d0 + d2 * d2);
|
||||
}
|
||||
|
||||
public double distanceSq(double toX, double toZ) {
|
||||
double d0 = (double) this.getX() - toX;
|
||||
double d2 = (double) this.getZ() - toZ;
|
||||
return d0 * d0 + d2 * d2;
|
||||
}
|
||||
|
||||
public double distanceSqToCenter(double xIn, double zIn) {
|
||||
double d0 = (double) this.getX() + 0.5D - xIn;
|
||||
double d2 = (double) this.getZ() + 0.5D - zIn;
|
||||
return d0 * d0 + d2 * d2;
|
||||
}
|
||||
|
||||
public double distanceSq(Position2D to) {
|
||||
return this.distanceSq((double) to.getX(), (double) to.getZ());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("x", this.getX()).add("z", this.getZ()).toString();
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,6 @@ package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -5,14 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateSourceProvider;
|
||||
import forestry.api.climate.IClimatiserDefinition;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> extends IMultiblockComponent {
|
||||
@Override
|
||||
@@ -21,22 +14,7 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
interface Listener extends IGreenhouseComponent {
|
||||
IGreenhouseListener getGreenhouseListener();
|
||||
}
|
||||
|
||||
interface ClimateControl extends IGreenhouseComponent, IClimateControlProvider {
|
||||
|
||||
}
|
||||
|
||||
interface Door extends IGreenhouseComponent {
|
||||
}
|
||||
|
||||
interface Climatiser extends IGreenhouseComponent, IClimateSourceProvider {
|
||||
IClimatiserDefinition getDefinition();
|
||||
}
|
||||
|
||||
interface Nursery extends IGreenhouseComponent, IButterflyNursery {
|
||||
void addCocoonLoot(IButterflyCocoon cocoon, NonNullList<ItemStack> loot);
|
||||
}
|
||||
|
||||
|
||||
interface Active extends IGreenhouseComponent {
|
||||
void updateServer(int tickCount);
|
||||
|
||||
|
||||
@@ -5,35 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import java.util.Set;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateRegion;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler {
|
||||
|
||||
/**
|
||||
* @return All internal blocks of the greenhouse.
|
||||
*
|
||||
* @return the position of the block at the top of the greenhouse structure that shows the state of the greenhouse.
|
||||
*/
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
BlockPos getCenterCoordinates();
|
||||
|
||||
/**
|
||||
* spawns a butterfly in a greenhouse
|
||||
* @return true if it has spawned it, and false if it has not
|
||||
*/
|
||||
boolean spawnButterfly(IGreenhouseComponent.Nursery nursery);
|
||||
void setCenterCoordinates(BlockPos coordinates);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawnButterfly(IButterflyCocoon)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean spawnButterfly(IButterfly butterfly);
|
||||
|
||||
IClimateRegion getRegion();
|
||||
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
|
||||
@@ -49,4 +49,33 @@ public interface IFermenterManager extends ICraftingProvider<IFermenterRecipe> {
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
|
||||
|
||||
/**
|
||||
* Add a recipe to the fermenter
|
||||
*
|
||||
* @param resource String representing the resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
* @param fermentationValue Value of the given resource, i.e. how much needs
|
||||
* to be fermented for the output to be deposited into the product tank.
|
||||
* @param modifier Modifies the amount of liquid output per work cycle.
|
||||
* (water = 1.0f, honey = 1.5f)
|
||||
* @param output LiquidStack representing output liquid. Amount is
|
||||
* determined by fermentationValue*modifier.
|
||||
* @param liquid LiquidStack representing resource liquid and amount.
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(String resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid);
|
||||
|
||||
/**
|
||||
* Add a recipe to the fermenter. Defaults to water as input liquid.
|
||||
*
|
||||
* @param resource String representing the resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
* @param modifier Modifies the amount of liquid output per work cycle.
|
||||
* (water = 1.0f, honey = 1.5f)
|
||||
* @param fermentationValue Value of the given resource, i.e. how much needs
|
||||
* to be fermented for the output to be deposited into the product tank.
|
||||
* @param output LiquidStack representing output liquid. Amount is
|
||||
* determined by fermentationValue*modifier.
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(String resource, int fermentationValue, float modifier, FluidStack output);
|
||||
}
|
||||
@@ -5,16 +5,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IFermenterRecipe extends IForestryRecipe {
|
||||
public interface IFermenterRecipe extends IForestryRecipe, Comparable<IFermenterRecipe> {
|
||||
|
||||
/**
|
||||
* @return ItemStack representing the input resource.
|
||||
*/
|
||||
ItemStack getResource();
|
||||
|
||||
/**
|
||||
* @return String representing the input resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
*/
|
||||
@Nullable
|
||||
String getResourceOreName();
|
||||
|
||||
/**
|
||||
* @return FluidStack representing the input fluid resource.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
Reference in new issue
Block a user