From 9cde7c5ba5ff1ee63be15afdd5f59027081b08b9 Mon Sep 17 00:00:00 2001 From: samrg472 Date: Fri, 4 Oct 2013 20:56:20 -0400 Subject: [PATCH] Restore compatibility with MFR, fixes #86 --- .../integration/MFRIntegration.java | 35 ++-------- .../minefactoryreloaded/Grindable.java | 38 ---------- .../minefactoryreloaded/Plantable.java | 70 ------------------- 3 files changed, 4 insertions(+), 139 deletions(-) delete mode 100644 common/biomesoplenty/integration/minefactoryreloaded/Grindable.java delete mode 100644 common/biomesoplenty/integration/minefactoryreloaded/Plantable.java diff --git a/common/biomesoplenty/integration/MFRIntegration.java b/common/biomesoplenty/integration/MFRIntegration.java index 5e90fc985..6e05f3680 100644 --- a/common/biomesoplenty/integration/MFRIntegration.java +++ b/common/biomesoplenty/integration/MFRIntegration.java @@ -1,23 +1,17 @@ package biomesoplenty.integration; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import powercrystals.minefactoryreloaded.api.FarmingRegistry; -import powercrystals.minefactoryreloaded.api.HarvestType; -import powercrystals.minefactoryreloaded.api.MobDrop; import biomesoplenty.api.Biomes; import biomesoplenty.api.BlockReferences; import biomesoplenty.api.Blocks; -import biomesoplenty.api.Entities; import biomesoplenty.api.Items; import biomesoplenty.integration.minefactoryreloaded.Fertilizable; import biomesoplenty.integration.minefactoryreloaded.FruitLeaves; -import biomesoplenty.integration.minefactoryreloaded.Grindable; import biomesoplenty.integration.minefactoryreloaded.Harvestable; -import biomesoplenty.integration.minefactoryreloaded.Plantable; - import com.google.common.base.Optional; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import powercrystals.minefactoryreloaded.api.FarmingRegistry; +import powercrystals.minefactoryreloaded.api.HarvestType; public class MFRIntegration { @@ -26,7 +20,6 @@ public class MFRIntegration registerRubberTreeBiomes(); registerFarmables(); registerSludgeDrops(); - registerGrindables(); } private static void registerRubberTreeBiomes() @@ -77,7 +70,6 @@ public class MFRIntegration for(Optional sapling : bopSaplings) { - FarmingRegistry.registerPlantable(new Plantable(sapling.get().blockID, sapling.get().blockID)); FarmingRegistry.registerFertilizable(new Fertilizable(sapling.get().blockID)); } @@ -96,23 +88,4 @@ public class MFRIntegration FarmingRegistry.registerSludgeDrop(15, new ItemStack(Items.miscItems.get(), 4, 1)); FarmingRegistry.registerSludgeDrop(25, new ItemStack(Items.mudball.get(), 4)); } - - private static void registerGrindables() - { - FarmingRegistry.registerGrindable(new Grindable(Entities.JungleSpider, new MobDrop[] - { - new MobDrop(3, new ItemStack(Item.silk)), - new MobDrop(1, new ItemStack(Item.spiderEye)) - })); - FarmingRegistry.registerGrindable(new Grindable(Entities.Rosester, new MobDrop[] - { - new MobDrop(1, new ItemStack(Item.chickenRaw)), - new MobDrop(1, new ItemStack(Item.dyePowder, 1, 1)) - })); - FarmingRegistry.registerGrindable(new Grindable(Entities.Glob, new MobDrop[] - { - new MobDrop(1, new ItemStack(Item.slimeBall)), - new MobDrop(4, new ItemStack(Items.mudball.get())) - })); - } } diff --git a/common/biomesoplenty/integration/minefactoryreloaded/Grindable.java b/common/biomesoplenty/integration/minefactoryreloaded/Grindable.java deleted file mode 100644 index bd981d7e7..000000000 --- a/common/biomesoplenty/integration/minefactoryreloaded/Grindable.java +++ /dev/null @@ -1,38 +0,0 @@ -package biomesoplenty.integration.minefactoryreloaded; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import net.minecraft.entity.EntityLiving; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.api.IFactoryGrindable; -import powercrystals.minefactoryreloaded.api.MobDrop; - -public class Grindable implements IFactoryGrindable -{ - private Class grindableClass; - private List drops; - - public Grindable(Class entityToGrind, MobDrop[] dropStacks) - { - grindableClass = entityToGrind; - drops = new ArrayList(); - for(MobDrop d : dropStacks) - { - drops.add(d); - } - } - - @Override - public Class getGrindableEntity() - { - return grindableClass; - } - - @Override - public List grind(World world, EntityLiving entity, Random random) - { - return drops; - } -} diff --git a/common/biomesoplenty/integration/minefactoryreloaded/Plantable.java b/common/biomesoplenty/integration/minefactoryreloaded/Plantable.java deleted file mode 100644 index db807e430..000000000 --- a/common/biomesoplenty/integration/minefactoryreloaded/Plantable.java +++ /dev/null @@ -1,70 +0,0 @@ -package biomesoplenty.integration.minefactoryreloaded; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.common.IPlantable; -import powercrystals.minefactoryreloaded.api.IFactoryPlantable; - -public class Plantable implements IFactoryPlantable -{ - protected int sourceId; - protected int plantedBlockId; - - public Plantable(int sourceId, int plantedBlockId) - { - if(plantedBlockId >= Block.blocksList.length) - { - throw new IllegalArgumentException("Passed an Item ID to FactoryPlantableStandard's planted block argument"); - } - this.sourceId = sourceId; - this.plantedBlockId = plantedBlockId; - } - - @Override - public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack) - { - int groundId = world.getBlockId(x, y - 1, z); - if(!world.isAirBlock(x, y, z)) - { - return false; - } - return - (Block.blocksList[plantedBlockId].canPlaceBlockAt(world, x, y, z) && Block.blocksList[plantedBlockId].canBlockStay(world, x, y, z)) || - (Block.blocksList[plantedBlockId] instanceof IPlantable && Block.blocksList[groundId] != null && - Block.blocksList[groundId].canSustainPlant(world, x, y, z, ForgeDirection.UP, ((IPlantable)Block.blocksList[plantedBlockId]))); - } - - @Override - public void prePlant(World world, int x, int y, int z, ItemStack stack) - { - } - - @Override - public void postPlant(World world, int x, int y, int z, ItemStack stack) - { - } - - @Override - public int getPlantedBlockId(World world, int x, int y, int z, ItemStack stack) - { - if(stack.itemID != sourceId) - { - return -1; - } - return plantedBlockId; - } - - @Override - public int getPlantedBlockMetadata(World world, int x, int y, int z, ItemStack stack) - { - return stack.getItemDamage(); - } - - @Override - public int getSeedId() - { - return sourceId; - } -}