Add missing farm logic localisation

This commit is contained in:
Nedelosk committed 2018-01-22 18:56:25 +01:00
1 parent 533c9d0b2a
commit cd7250604e
37 files changed
+233 -160

No files matched your search

@@ -7,11 +7,17 @@ package forestry.api.circuits;
import java.util.List;
import net.minecraft.util.text.translation.I18n;
public interface ICircuit {
String getUID();
String getUnlocalizedName();
default String getLocalizedName(){
return I18n.translateToLocal(getUnlocalizedName());
}
boolean isCircuitable(Object tile);
void onInsertion(int slot, Object tile);
@@ -5,14 +5,16 @@
******************************************************************************/
package forestry.api.farming;
import java.util.LinkedHashMap;
import java.util.Map;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import java.util.LinkedHashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
//TODO: Remove this class in 1.13
@Deprecated
public class Farmables {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
@@ -20,6 +20,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.ForestryAPI;
/**
* The IFarmLogic is used by farm blocks and multi-blocks to cultivate and harvest crops and plants.
*
* Every farm block has only ony one logic a multi-block farm has four, one for every direction.
*/
public interface IFarmLogic {
/**
@@ -29,21 +34,72 @@ public interface IFarmLogic {
int getFertilizerConsumption();
/**
* @param hydrationModifier A modifier that depends on the weather and the biome of the farm.
*
* @return The amount of water that the {@link IFarmHousing} automatically removes after this logic cultivated
* a block or harvested a crop.
*/
int getWaterConsumption(float hydrationModifier);
/**
* Checks if the given stack is a resource or a soil that this logic uses to grow plants on or to create other
* products like peat.
*/
boolean isAcceptedResource(ItemStack itemstack);
/**
* Checks if the given stack is a germling (plantable sapling, seed, etc.) for any {@link IFarmable} of this farm.
*/
boolean isAcceptedGermling(ItemStack itemstack);
/**
* Collects all items that are laying on the ground and are in the {@link IFarmHousing#getArea()} of the farm.
*
* @param world The world of the farm.
* @param farmHousing The farm that uses this logic.
*
* @return A collection that contains all items that were collected.
*/
NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing);
/**
* Tries to cultivate one or more blocks at the given position and with the given extent.
*
* @param world The world of the farm.
* @param farmHousing The farm that uses this logic.
* @param pos The position at that the logic should start to cultivate.
* @param direction The direction of the extension.
* @param extent How many blocks this logic has to cultivate after it cultivated the block at the given position.
* The positions of the next blocks are having a offset in the given direction.
* @return True if the logic has cultivated any block.
*/
boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent);
/**
* Tries to harvest one or more blocks at the given position and with the given extent.
*
* @param world The world of the farm.
* @param pos The position at that the logic should start to harvest.
* @param direction The direction of the extension.
* @param extent How many blocks this logic tries to harvest after it has tried to harvested the block at the given position.
* The positions of the next blocks are having a offset in the given direction.
* @return True if the logic has cultivated any block.
*/
Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent);
/**
* Returns the {@link IFarmProperties} that created this logic.
*
* @since Forestry 5.8
*
* @return Returns the {@link IFarmProperties} that created this logic. Returns a fake instance from
* {@link IFarmRegistry#createFakeInstance(IFarmLogic)} if the logic is older that Forestry 5.8.
* TODO: Remove "default" from this method in 1.13
*/
default IFarmProperties getProperties(){
return ForestryAPI.farmRegistry.createFakeInstance(this);
}
/**
* @deprecated Since Forestry 5.8 logic instances are created at the constructor of the {@link IFarmProperties} and
* have a immutable manual state. TODO Remove this method in 1.13
@@ -53,16 +109,6 @@ public interface IFarmLogic {
return this;
}
/**
* @since Forestry 5.8
*
* @return Returns the {@link IFarmProperties} that created this logic. Returns a fake instance from
* {@link IFarmRegistry#createFakeInstance(IFarmLogic)} if the logic is older that Forestry 5.8.
*/
default IFarmProperties getInstance(){
return ForestryAPI.farmRegistry.createFakeInstance(this);
}
/**
* Use {@link IFarmRegistry#getProperties(String)} to get the {@link IFarmProperties} for the farm logic and register the soil
* with {@link IFarmProperties#registerSoil(ItemStack, IBlockState, boolean)}.
@@ -72,8 +118,12 @@ public interface IFarmLogic {
//
}
default String getUnlocalizedName(){
return "";
}
/**
* @return A short localized name for this logic.
* @return Localized short, human-readable identifier used in the farm gui and in tooltips.
*/
String getName();
@@ -5,10 +5,11 @@
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "2.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
@API(apiVersion = "5.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
package forestry.api.farming;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;