mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Add missing farm logic localisation
This commit is contained in:
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;
|
||||
@@ -37,7 +37,7 @@ public abstract class Circuit implements ICircuit {
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
list.add(Translator.translateToLocal(getUnlocalizedName()));
|
||||
list.add(getLocalizedName());
|
||||
|
||||
int i = 1;
|
||||
while (true) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron> {
|
||||
if (recipe == null) {
|
||||
description = "(" + Translator.translateToLocal("for.gui.noeffect") + ")";
|
||||
} else {
|
||||
description = Translator.translateToLocal(recipe.getCircuit().getUnlocalizedName());
|
||||
description = recipe.getCircuit().getLocalizedName();
|
||||
}
|
||||
|
||||
int row = i * 20;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class Config {
|
||||
|
||||
// Cultivation
|
||||
public static int planterExtend = 4;
|
||||
public static boolean ringFarms = false;
|
||||
public static boolean ringFarms = true;
|
||||
public static int ringSize = 4;
|
||||
|
||||
// Mail
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.cultivation.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import forestry.core.ModuleCore;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -21,9 +22,9 @@ public class GuiPlanter extends GuiForestryTitled<ContainerPlanter> {
|
||||
this.xSize = 202;
|
||||
this.ySize = 192;
|
||||
|
||||
ItemStack[] resourceStacks = tile.createResourceStacks();
|
||||
ItemStack[] germlingStacks = tile.createGermlingStacks();
|
||||
ItemStack[] productionStacks = tile.createProductionStacks();
|
||||
NonNullList<ItemStack> resourceStacks = tile.createResourceStacks();
|
||||
NonNullList<ItemStack> germlingStacks = tile.createGermlingStacks();
|
||||
NonNullList<ItemStack> productionStacks = tile.createProductionStacks();
|
||||
|
||||
widgetManager.add(new TankWidget(widgetManager, 178, 44, 0).setOverlayOrigin(xSize, 18));
|
||||
|
||||
@@ -31,8 +32,8 @@ public class GuiPlanter extends GuiForestryTitled<ContainerPlanter> {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
int index = j + i * 2;
|
||||
if(resourceStacks.length == 4) {
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 11 + j * 18, 65 + i * 18, resourceStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_RESOURCES_1 + index)));
|
||||
if(resourceStacks.size() == 4) {
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 11 + j * 18, 65 + i * 18, resourceStacks.get(index), inventorySlots.getSlot(36 + InventoryPlanter.SLOT_RESOURCES_1 + index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +42,8 @@ public class GuiPlanter extends GuiForestryTitled<ContainerPlanter> {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
int index = j + i * 2;
|
||||
if(germlingStacks.length == 4){
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 71 + j * 18, 65 + i * 18, germlingStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_GERMLINGS_1 + index)));
|
||||
if(germlingStacks.size() == 4){
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 71 + j * 18, 65 + i * 18, germlingStacks.get(index), inventorySlots.getSlot(36 + InventoryPlanter.SLOT_GERMLINGS_1 + index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,8 +52,8 @@ public class GuiPlanter extends GuiForestryTitled<ContainerPlanter> {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
int index = j + i * 2;
|
||||
if(productionStacks.length == 4) {
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 131 + j * 18, 65 + i * 18, productionStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_PRODUCTION_1 + j + i * 2)));
|
||||
if(productionStacks.size() == 4) {
|
||||
widgetManager.add(new GhostItemStackWidget(widgetManager, 131 + j * 18, 65 + i * 18, productionStacks.get(index), inventorySlots.getSlot(36 + InventoryPlanter.SLOT_PRODUCTION_1 + j + i * 2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -16,7 +17,6 @@ import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.render.ColourProperties;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.cultivation.inventory.InventoryPlanter;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GhostItemStackWidget extends ItemStackWidget {
|
||||
private final Slot slot;
|
||||
@@ -30,9 +30,10 @@ public class GhostItemStackWidget extends ItemStackWidget {
|
||||
if (!slot.getHasStack()) {
|
||||
super.draw(startX, startY);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
String directionString = getDirectionString();
|
||||
if (!directionString.isEmpty()){
|
||||
@@ -40,15 +41,16 @@ public class GhostItemStackWidget extends ItemStackWidget {
|
||||
fontRenderer.drawStringWithShadow(getDirectionString(), xPos + startX + 5, yPos + startY + 4, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
|
||||
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||
textureManager.bindTexture(manager.gui.textureFile);
|
||||
manager.gui.drawTexturedModalRect(xPos + startX, yPos + startY, 206, 0, 16, 16);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private String getDirectionString(){
|
||||
|
||||
@@ -3,6 +3,7 @@ package forestry.cultivation.tiles;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileArboretum extends TilePlanter {
|
||||
public TileArboretum() {
|
||||
@@ -10,32 +11,32 @@ public class TileArboretum extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.SAPLING),
|
||||
new ItemStack(Blocks.SAPLING, 1, 2),
|
||||
new ItemStack(Blocks.SAPLING, 1, 2),
|
||||
new ItemStack(Blocks.SAPLING)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.LOG),
|
||||
new ItemStack(Items.APPLE),
|
||||
new ItemStack(Items.APPLE),
|
||||
new ItemStack(Blocks.LOG)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package forestry.cultivation.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import forestry.core.ModuleCore;
|
||||
|
||||
@@ -10,27 +11,27 @@ public class TileBog extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(ModuleCore.getBlocks().bogEarth),
|
||||
new ItemStack(ModuleCore.getBlocks().bogEarth),
|
||||
new ItemStack(ModuleCore.getBlocks().bogEarth),
|
||||
new ItemStack(ModuleCore.getBlocks().bogEarth)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(ModuleCore.getItems().peat),
|
||||
new ItemStack(ModuleCore.getItems().peat),
|
||||
new ItemStack(ModuleCore.getItems().peat),
|
||||
new ItemStack(ModuleCore.getItems().peat)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package forestry.cultivation.tiles;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileFarmCrops extends TilePlanter {
|
||||
public TileFarmCrops() {
|
||||
@@ -10,32 +11,32 @@ public class TileFarmCrops extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return createList(
|
||||
new ItemStack(Items.WHEAT_SEEDS),
|
||||
new ItemStack(Items.POTATO),
|
||||
new ItemStack(Items.CARROT),
|
||||
new ItemStack(Items.BEETROOT_SEEDS)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT),
|
||||
new ItemStack(Blocks.DIRT)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Items.WHEAT),
|
||||
new ItemStack(Items.POTATO),
|
||||
new ItemStack(Items.CARROT),
|
||||
new ItemStack(Items.BEETROOT)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package forestry.cultivation.tiles;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileFarmEnder extends TilePlanter {
|
||||
public TileFarmEnder() {
|
||||
@@ -10,32 +11,32 @@ public class TileFarmEnder extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.CHORUS_FLOWER),
|
||||
new ItemStack(Blocks.CHORUS_FLOWER),
|
||||
new ItemStack(Blocks.CHORUS_FLOWER),
|
||||
new ItemStack(Blocks.CHORUS_FLOWER)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.END_STONE),
|
||||
new ItemStack(Blocks.END_STONE),
|
||||
new ItemStack(Blocks.END_STONE),
|
||||
new ItemStack(Blocks.END_STONE)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.CHORUS_FLOWER),
|
||||
new ItemStack(Items.CHORUS_FRUIT),
|
||||
new ItemStack(Items.CHORUS_FRUIT),
|
||||
new ItemStack(Blocks.CHORUS_FLOWER)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package forestry.cultivation.tiles;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileFarmGourd extends TilePlanter {
|
||||
public TileFarmGourd() {
|
||||
@@ -9,22 +10,22 @@ public class TileFarmGourd extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.MELON_BLOCK),
|
||||
new ItemStack(Blocks.PUMPKIN),
|
||||
new ItemStack(Blocks.PUMPKIN),
|
||||
new ItemStack(Blocks.MELON_BLOCK)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package forestry.cultivation.tiles;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileFarmMushroom extends TilePlanter {
|
||||
public TileFarmMushroom() {
|
||||
@@ -9,32 +10,32 @@ public class TileFarmMushroom extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.RED_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.RED_MUSHROOM)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.MYCELIUM),
|
||||
new ItemStack(Blocks.DIRT, 1, 2),
|
||||
new ItemStack(Blocks.DIRT, 1, 2),
|
||||
new ItemStack(Blocks.MYCELIUM)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.RED_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.RED_MUSHROOM)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package forestry.cultivation.tiles;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TileFarmNether extends TilePlanter {
|
||||
public TileFarmNether() {
|
||||
@@ -10,32 +11,32 @@ public class TileFarmNether extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return createList(
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return createList(
|
||||
new ItemStack(Blocks.SOUL_SAND),
|
||||
new ItemStack(Blocks.SOUL_SAND),
|
||||
new ItemStack(Blocks.SOUL_SAND),
|
||||
new ItemStack(Blocks.SOUL_SAND)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[]{
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return createList(
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.NETHER_WART)
|
||||
};
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package forestry.cultivation.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class TilePlantation extends TilePlanter {
|
||||
|
||||
@@ -9,17 +10,17 @@ public class TilePlantation extends TilePlanter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createGermlingStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createGermlingStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createResourceStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createResourceStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] createProductionStacks() {
|
||||
return new ItemStack[0];
|
||||
public NonNullList<ItemStack> createProductionStacks() {
|
||||
return NonNullList.create();
|
||||
}
|
||||
}
|
||||
@@ -501,10 +501,14 @@ public abstract class TilePlanter extends TilePowered implements IFarmHousing, I
|
||||
return tankManager;
|
||||
}
|
||||
|
||||
public abstract ItemStack[] createGermlingStacks();
|
||||
protected NonNullList<ItemStack> createList(ItemStack... stacks){
|
||||
return NonNullList.from(ItemStack.EMPTY, stacks);
|
||||
}
|
||||
|
||||
public abstract ItemStack[] createResourceStacks();
|
||||
public abstract NonNullList<ItemStack> createGermlingStacks();
|
||||
|
||||
public abstract ItemStack[] createProductionStacks();
|
||||
public abstract NonNullList<ItemStack> createResourceStacks();
|
||||
|
||||
public abstract NonNullList<ItemStack> createProductionStacks();
|
||||
|
||||
}
|
||||
@@ -145,13 +145,13 @@ public final class FarmRegistry implements IFarmRegistry {
|
||||
for(String entry : fertilizerList){
|
||||
String[] spited = entry.split(";");
|
||||
if(spited.length < 2){
|
||||
Log.error("Foretsry failed to parse a entry of the fertilizer config.");
|
||||
Log.error("Forestry failed to parse a entry of the fertilizer config.");
|
||||
continue;
|
||||
}
|
||||
String itemName = spited[0];
|
||||
ItemStack fertilizerItem = ItemStackUtil.parseItemStackString(itemName, OreDictionary.WILDCARD_VALUE);
|
||||
if(fertilizerItem == null || fertilizerItem.isEmpty()){
|
||||
Log.error("Foretsry failed to parse a entry of the fertilizer config, because the item doesn't exists.");
|
||||
Log.error("Forestry failed to parse a entry of the fertilizer config, because the item doesn't exists.");
|
||||
continue;
|
||||
}
|
||||
String value = spited[1];
|
||||
|
||||
@@ -246,7 +246,7 @@ public class ModuleFarming extends BlankForestryModule {
|
||||
Circuits.farmCocoaManual = new CircuitFarmLogic("manualCocoa", cocoaFarm, true);
|
||||
|
||||
Circuits.farmEnderManaged = new CircuitFarmLogic("managedEnder", enderFarm, false);
|
||||
Circuits.farmEnderManual = new CircuitFarmLogic("manualEnder", enderFarm, false);
|
||||
Circuits.farmEnderManual = new CircuitFarmLogic("manualEnder", enderFarm, true);
|
||||
enderFarm.registerSoil(new ItemStack(Blocks.END_STONE), Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,16 @@ public class CircuitFarmLogic extends Circuit {
|
||||
this.logic = logic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return logic.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName() {
|
||||
return logic.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated TODO: Remove this method in 1.13
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,7 @@ import forestry.api.farming.IFarmLogic;
|
||||
import forestry.api.farming.IFarmProperties;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.farming.ISoil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.core.utils.VectUtil;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic {
|
||||
@@ -55,6 +56,12 @@ public abstract class FarmLogic implements IFarmLogic {
|
||||
return properties.getSoils();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String unformatted = isManual ? "for.farm.grammar.manual" : "for.farm.grammar.managed";
|
||||
return Translator.translateToLocalFormatted(unformatted, Translator.translateToLocal(getUnlocalizedName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FarmLogic setManual(boolean flag) {
|
||||
return this;
|
||||
|
||||
@@ -52,8 +52,8 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Managed Arboretum";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.arboretum";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,8 +51,8 @@ public class FarmLogicCocoa extends FarmLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Cocoa Plantation";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.cocoa";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,12 +90,7 @@ public class FarmLogicCrops extends FarmLogicWatered {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Crop Farm";
|
||||
} else {
|
||||
return "Managed Crop Farm";
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.crops";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,8 +37,8 @@ public class FarmLogicEnder extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Manual Ender Farm";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.ender";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,8 +32,8 @@ public class FarmLogicGourd extends FarmLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Gourd Farm";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.gourd";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,8 +34,8 @@ public class FarmLogicInfernal extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Managed Infernal Farm";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.infernal";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,14 +23,9 @@ public class FarmLogicMushroom extends FarmLogicArboreal {
|
||||
public FarmLogicMushroom(IFarmProperties properties, boolean isManual) {
|
||||
super(properties, isManual);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Shroom Farm";
|
||||
} else {
|
||||
return "Managed Shroom Farm";
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.shroom";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -126,8 +126,8 @@ public class FarmLogicOrchard extends FarmLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Orchard";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.orchard";
|
||||
}
|
||||
|
||||
private Collection<ICrop> getHarvestBlocks(World world, BlockPos position) {
|
||||
|
||||
@@ -37,12 +37,8 @@ public class FarmLogicPeat extends FarmLogicWatered {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Peat Bog";
|
||||
} else {
|
||||
return "Managed Peat Bog";
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.peat";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,11 +29,8 @@ public class FarmLogicRedOrchid extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Orchid Farm";
|
||||
}
|
||||
return "Managed Orchid Farm";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.orchid";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,12 +31,8 @@ public class FarmLogicReeds extends FarmLogicSoil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Reed Farm";
|
||||
} else {
|
||||
return "Managed Reed Farm";
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.reed";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,8 +49,8 @@ public class FarmLogicRubber extends FarmLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Rubber Plantation";
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.rubber";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,12 +33,8 @@ public class FarmLogicSucculent extends FarmLogicSoil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isManual) {
|
||||
return "Manual Succulent Farm";
|
||||
} else {
|
||||
return "Managed Succulent Farm";
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "for.farm.succulent";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,10 @@ public final class FarmProperties implements IFarmProperties {
|
||||
@Override
|
||||
public Collection<IFarmable> getFarmables() {
|
||||
if (farmables == null) {
|
||||
farmables = farmablesIdentifiers.stream().map(FarmRegistry.getInstance()::getFarmables).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
farmables = farmablesIdentifiers.stream()
|
||||
.map(FarmRegistry.getInstance()::getFarmables)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
return farmables;
|
||||
}
|
||||
@@ -55,6 +58,7 @@ public final class FarmProperties implements IFarmProperties {
|
||||
soils.add(new Soil(resource, soilState, hasMetaData));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedSoil(IBlockState ground) {
|
||||
for (ISoil soil : soils) {
|
||||
IBlockState soilState = soil.getSoilState();
|
||||
|
||||
@@ -64,6 +64,7 @@ public class PluginExtraUtilities extends CompatPlugin {
|
||||
orchidFarm.registerSoil(new ItemStack(Blocks.LIT_REDSTONE_ORE), Blocks.LIT_REDSTONE_ORE.getDefaultState());
|
||||
|
||||
Circuits.farmOrchidManaged = new CircuitFarmLogic("managedOrchid", orchidFarm, false);
|
||||
Circuits.farmOrchidManual = new CircuitFarmLogic("manualOrchid", orchidFarm, true);
|
||||
|
||||
orchidStack = new ItemStack(item);
|
||||
}
|
||||
@@ -83,10 +84,12 @@ public class PluginExtraUtilities extends CompatPlugin {
|
||||
public void registerRecipes() {
|
||||
if(Circuits.farmOrchidManaged != null) {
|
||||
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
|
||||
if(layoutManaged == null){
|
||||
ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
|
||||
if(layoutManaged == null || layoutManual == null){
|
||||
return;
|
||||
}
|
||||
ChipsetManager.solderManager.addRecipe(layoutManaged, ModuleCore.getItems().tubes.get(EnumElectronTube.ORCHID, 1), Circuits.farmOrchidManaged);
|
||||
ChipsetManager.solderManager.addRecipe(layoutManual, ModuleCore.getItems().tubes.get(EnumElectronTube.ORCHID, 1), Circuits.farmOrchidManual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user