Added sugar cane support to the Farmer (#611)

This commit is contained in:
Daniel Mansfield 2017-01-31 17:49:42 +00:00 committed by Ellpeck
parent 23299bffc7
commit 75d2de8438
5 changed files with 80 additions and 1 deletions

View file

@ -213,7 +213,7 @@ public final class InitBooklet{
//RF Using Blocks //RF Using Blocks
new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFireworkBox), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial(); new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFireworkBox), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial();
new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockBatteryBox), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial(); new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockBatteryBox), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial();
new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemToPage(new ItemStack(InitItems.itemCanolaSeed)), new PagePicture(3, "page_farmer_cactus", 105).addItemToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemToPage(new ItemStack(Items.NETHER_WART)), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant(); new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemToPage(new ItemStack(InitItems.itemCanolaSeed)), new PagePicture(3, "page_farmer_cactus", 105).addItemToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemToPage(new ItemStack(Items.REEDS)), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant();
new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityGrinder.ENERGY_USE), new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText()); new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityGrinder.ENERGY_USE), new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());

View file

@ -11,12 +11,14 @@
package de.ellpeck.actuallyadditions.mod.crafting; package de.ellpeck.actuallyadditions.mod.crafting;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.CactusFarmerBehavior; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.CactusFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.NetherWartFarmerBehavior; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.NetherWartFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.ReedFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -45,6 +47,7 @@ public final class InitCrafting{
ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior());
ActuallyAdditionsAPI.addFarmerBehavior(new CactusFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new CactusFarmerBehavior());
ActuallyAdditionsAPI.addFarmerBehavior(new NetherWartFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new NetherWartFarmerBehavior());
ActuallyAdditionsAPI.addFarmerBehavior(new ReedFarmerBehavior());
RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShaped", RecipeKeepDataShaped.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped"); RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShaped", RecipeKeepDataShaped.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped");
RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShapeless", RecipeKeepDataShapeless.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShapeless", RecipeKeepDataShapeless.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");

View file

@ -0,0 +1,75 @@
/*
* This file ("CrusherRecipeHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockReed;
import net.minecraft.block.BlockSand;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class ReedFarmerBehavior implements IFarmerBehavior{
@Override
public boolean tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 250;
if(farmer.getEnergy() >= use){
if(seed.getItem() == Items.REEDS){
if(Blocks.REEDS.canPlaceBlockAt(world, pos)){
world.setBlockState(pos, Blocks.REEDS.getDefaultState(), 2);
farmer.extractEnergy(use);
return true;
}
}
}
return false;
}
@Override
public boolean tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 250;
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockReed){
for(int i = 2; i >= 1; --i){
if(farmer.getEnergy() >= use){
BlockPos up = pos.up(i);
IBlockState upState = world.getBlockState(up);
if(upState.getBlock() instanceof BlockReed){
List<ItemStack> drops = upState.getBlock().getDrops(world, up, upState, 0);
if(drops != null && !drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){
world.playEvent(2011, up, Block.getStateId(upState));
world.setBlockToAir(up);
farmer.extractEnergy(use);
farmer.addToOutputInventory(drops, true);
}
}
}
}
}
return true;
}
}
return false;
}
}

View file

@ -1098,6 +1098,7 @@ booklet.actuallyadditions.chapter.farmer.text.1=The <item>Farmer<r> is a block t
booklet.actuallyadditions.chapter.farmer.text.2=Farming basic crops <imp>crops<r> like <item>Wheat<r>, <item>Potatoes<r>, <item>Canola<r>, <item>Flax<r> and so on. Ground will be <imp>tilled<r> by the Farmer itself. booklet.actuallyadditions.chapter.farmer.text.2=Farming basic crops <imp>crops<r> like <item>Wheat<r>, <item>Potatoes<r>, <item>Canola<r>, <item>Flax<r> and so on. Ground will be <imp>tilled<r> by the Farmer itself.
booklet.actuallyadditions.chapter.farmer.text.3=Farming <item>Cactus<r>. Sand needs to be laid out for it to be planted. <imp><item>Cactus<r> higher than 2 blocks will have the <imp>top broken off<r> and placed inside of the Farmer. booklet.actuallyadditions.chapter.farmer.text.3=Farming <item>Cactus<r>. Sand needs to be laid out for it to be planted. <imp><item>Cactus<r> higher than 2 blocks will have the <imp>top broken off<r> and placed inside of the Farmer.
booklet.actuallyadditions.chapter.farmer.text.4=Farming <item>Nether Wart<r>. Soul Sand needs to be laid out for it to be planted. booklet.actuallyadditions.chapter.farmer.text.4=Farming <item>Nether Wart<r>. Soul Sand needs to be laid out for it to be planted.
booklet.actuallyadditions.chapter.farmer.text.5=Farming <item>Sugar Cane<r>. Sand and water need to be laid out for it to be planted. Harvested in the same way as <item>Cactus<r>.
booklet.actuallyadditions.chapter.lensMoreDeath.name=Lens of the Killer booklet.actuallyadditions.chapter.lensMoreDeath.name=Lens of the Killer
booklet.actuallyadditions.chapter.lensMoreDeath.text.1=The <item>Lens of the Killer<r> works much like the <item>Lens of Certain Death<r>, however it will also <imp>drop experience<r> and <imp>player-kill loot<r>. <n>This means, however, that it will use <imp>a lot more power<r>. <n><n>To pick up the experience it drops, you might want to try an <item>Experience Solidifier<r>. booklet.actuallyadditions.chapter.lensMoreDeath.text.1=The <item>Lens of the Killer<r> works much like the <item>Lens of Certain Death<r>, however it will also <imp>drop experience<r> and <imp>player-kill loot<r>. <n>This means, however, that it will use <imp>a lot more power<r>. <n><n>To pick up the experience it drops, you might want to try an <item>Experience Solidifier<r>.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB