FlowerRegistry and AgriCraft compatibility update

Add to CLA agreement
This commit is contained in:
InfinityRaider authored and mezz committed 2015-10-03 13:35:27 -07:00
1 parent 55866d6a64
commit 8fb7d5eb67
2 files changed
+15 -7

No files matched your search

+1
View File
@@ -3,3 +3,4 @@ samtrion;samtrion@gmail.com;2015-01-18
GenuineSounds;GenuineSoundsLtd@gmail.com;2015-02-26
airbreather;airbreather@linux.com;2015-04-10
ganymedes01;foka_12@hotmail.com;2015-05-27
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
@@ -34,6 +34,7 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -190,15 +191,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
meta = world.getBlockMetadata(x, y, z);
}
if (PluginManager.Module.AGRICRAFT.isEnabled() && (flowerType.equals(FlowerManager.FlowerTypeWheat) || flowerType.equals(FlowerManager.FlowerTypeNether))) {
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
if (block == cropBlock) {
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
return true;
}
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
return true;
if(block instanceof IPlantable) {
//For agricraft versions which implement IPlantable in the BlockCrop class
block = ((IPlantable) block).getPlant(world, x, y, z);
} else {
//For earlier versions of AgriCraft
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
return true;
}
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
return true;
}
}
}
}