Restore compatibility with MFR, fixes #86
This commit is contained in:
parent
15ea622866
commit
9cde7c5ba5
3 changed files with 4 additions and 139 deletions
|
@ -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<? extends Block> 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()))
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<MobDrop> drops;
|
||||
|
||||
public Grindable(Class<?> entityToGrind, MobDrop[] dropStacks)
|
||||
{
|
||||
grindableClass = entityToGrind;
|
||||
drops = new ArrayList<MobDrop>();
|
||||
for(MobDrop d : dropStacks)
|
||||
{
|
||||
drops.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getGrindableEntity()
|
||||
{
|
||||
return grindableClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobDrop> grind(World world, EntityLiving entity, Random random)
|
||||
{
|
||||
return drops;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue