Skip to content

Commit

Permalink
Agricraft; make bloomery furnace automation-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Aug 25, 2015
1 parent 4ba8d16 commit fa378c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repositories {

apply plugin: 'forge'

version = "1.7.10-1.6.3"
version = "1.7.10-1.6.5"
group= "com.jaquadro.gardenstuff" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "GardenStuff"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
package com.jaquadro.minecraft.gardencommon.integration.mods;

import com.InfinityRaider.AgriCraft.api.API;
import com.InfinityRaider.AgriCraft.api.APIBase;
import com.InfinityRaider.AgriCraft.api.APIStatus;
import com.InfinityRaider.AgriCraft.api.v1.APIv1;
import com.InfinityRaider.AgriCraft.api.v1.BlockWithMeta;
import com.jaquadro.minecraft.gardencommon.integration.IntegrationModule;
import com.jaquadro.minecraft.gardencore.core.ModBlocks;
import net.minecraft.block.Block;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Set;

public class AgriCraft extends IntegrationModule
{
static Class classGrowthRequirements;
static Class classBlockWithMeta;

static Constructor constBlockWithMeta;

static Field fieldDefaultSoils;

@Override
public String getModID () {
return "AgriCraft";
}

@Override
public void init () throws Throwable {
classGrowthRequirements = Class.forName("com.InfinityRaider.AgriCraft.farming.GrowthRequirements");
classBlockWithMeta = Class.forName("com.InfinityRaider.AgriCraft.utility.BlockWithMeta");
APIBase api = API.getAPI(1);
if (api.getStatus() == APIStatus.OK && api.getVersion() == 1) {
APIv1 agricraft = (APIv1)api;

constBlockWithMeta = classBlockWithMeta.getConstructor(Block.class, int.class);

fieldDefaultSoils = classGrowthRequirements.getField("defaultSoils");
agricraft.registerDefaultSoil(new BlockWithMeta(ModBlocks.gardenFarmland));
}
}

@Override
public void postInit () throws Throwable {
Set defaultSoils = (Set) fieldDefaultSoils.get(null);

defaultSoils.add(constBlockWithMeta.newInstance(ModBlocks.gardenFarmland, 0));
}
public void postInit () throws Throwable { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ private boolean canSmelt () {
if (furnaceItemStacks[SLOT_PRIMARY] == null || furnaceItemStacks[SLOT_SECONDARY] == null)
return false;

if (furnaceItemStacks[SLOT_PRIMARY].getItem() != Items.iron_ingot && furnaceItemStacks[SLOT_PRIMARY].getItem() != Item.getItemFromBlock(Blocks.iron_ore))
if (!isItemPrimaryInput(furnaceItemStacks[SLOT_PRIMARY]))
return false;
if (furnaceItemStacks[SLOT_SECONDARY].getItem() != Item.getItemFromBlock(Blocks.sand))
if (!isItemSecondaryInput(furnaceItemStacks[SLOT_SECONDARY]))
return false;

ItemStack itemOutput = new ItemStack(ModItems.wroughtIronIngot);
Expand Down Expand Up @@ -319,7 +319,11 @@ public boolean isItemValidForSlot (int slot, ItemStack stack) {
return false;
if (slot == SLOT_FUEL)
return isItemFuel(stack);
if (slot == SLOT_PRIMARY)
return isItemPrimaryInput(stack);
if (slot == SLOT_SECONDARY)
return isItemSecondaryInput(stack);

return true;
return false;
}
}

0 comments on commit fa378c7

Please sign in to comment.