Added an AgriCraft Harvest Handler for their crops (uses reflection, so will be pulled as soon as the official one is made on their side)

Added the checks required for Strength to affect the damage of the Tool Paradigms.
This commit is contained in:
WayofTime 2015-04-21 12:33:20 -04:00
parent 201c70a766
commit 34f779563e
11 changed files with 136 additions and 34 deletions

View file

@ -1,12 +1,12 @@
#
#Thu Apr 16 16:19:02 EDT 2015
#Mon Apr 20 14:42:19 EDT 2015
mod_name=BloodMagic
forge_version=10.13.3.1374-1.7.10
ccc_version=1.0.4.29
nei_version=1.0.3.64
//=Dependency Information
package_group=com.wayoftime.bloodmagic
mod_version=1.3.2
mod_version=1.3.2aBeta
minetweaker_version=Dev-1.7.10-3.0.9B
mc_version=1.7.10
build_number=2
build_number=3

View file

@ -104,6 +104,7 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
import WayofTime.alchemicalWizardry.common.harvest.AgriCraftCropHarvestHandler;
import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler;
import WayofTime.alchemicalWizardry.common.harvest.CactusReedHarvestHandler;
import WayofTime.alchemicalWizardry.common.harvest.GourdHarvestHandler;
@ -1199,6 +1200,12 @@ public class AlchemicalWizardry
AlchemicalWizardry.logger.info("Loaded MineTweaker 3 Integration");
}
if(Loader.isModLoaded("AgriCraft"))
{
HarvestRegistry.registerHarvestHandler(new AgriCraftCropHarvestHandler());
AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!");
}
this.isBotaniaLoaded = Loader.isModLoaded("Botania");
this.isFMPLoaded = Loader.isModLoaded("ForgeMultipart");

View file

@ -11,6 +11,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@ -48,12 +49,16 @@ public class ItemSpellMultiTool extends Item
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundTool");
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
float damage = this.getCustomItemAttack(par1ItemStack);
float f = (float)par3EntityLivingBase.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
damage *= f;
SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack);
if (parad != null)
@ -149,7 +154,7 @@ public class ItemSpellMultiTool extends Item
{
if (isEffective)
{
if (localBlock.removedByPlayer(world, player, x, y, z))
if (localBlock.removedByPlayer(world, player, x, y, z, true))
{
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
}
@ -194,8 +199,8 @@ public class ItemSpellMultiTool extends Item
}
}
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
// if (!world.isRemote)
// world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
return true;
}

View file

@ -0,0 +1,83 @@
package WayofTime.alchemicalWizardry.common.harvest;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler;
import cpw.mods.fml.common.registry.GameRegistry;
public class AgriCraftCropHarvestHandler implements IHarvestHandler
{
public Block harvestBlock;
public Method isMature;
public Method harvest;
public AgriCraftCropHarvestHandler()
{
this.harvestBlock = getBlockForString("AgriCraft:crops");
if(this.harvestBlock != null)
{
try {
Class clazz = Class.forName("com.InfinityRaider.AgriCraft.blocks.BlockCrop");
if(clazz != null)
{
isMature = clazz.getMethod("isMature", World.class, int.class, int.class, int.class);
harvest = clazz.getMethod("harvest", World.class, int.class, int.class, int.class);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public boolean isHarvesterValid()
{
return harvestBlock != null && isMature != null && harvest != null;
}
public static Block getBlockForString(String str)
{
String[] parts = str.split(":");
String modId = parts[0];
String name = parts[1];
return GameRegistry.findBlock(modId, name);
}
public boolean canHandleBlock(Block block)
{
return block == harvestBlock;
}
@Override
public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta)
{
if (!this.canHandleBlock(block))
{
return false;
}
try {
return (Boolean)(isMature.invoke(block, world, xCoord, yCoord, zCoord)) && (Boolean)(harvest.invoke(block, world, xCoord, yCoord, zCoord));
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}

View file

@ -1,7 +1,9 @@
package WayofTime.alchemicalWizardry.common.harvest;
import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -9,8 +11,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import java.util.List;
import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler;
public class BloodMagicHarvestHandler implements IHarvestHandler
{
@ -21,6 +22,10 @@ public class BloodMagicHarvestHandler implements IHarvestHandler
public int getHarvestMeta(Block block)
{
if(block instanceof BlockCrops)
{
}
if (block == Blocks.wheat)
{
return 7;

View file

@ -118,11 +118,11 @@ public class OmegaArmourWind extends OmegaArmour
public float getHealthBoostModifierForLevel(int yLevel)
{
return 0.05f * ((((float)yLevel)/64f) * 1.5f - 1);
return 0.05f * ((((float)Math.min(yLevel, 255))/64f) * 1.5f - 1);
}
public float getDamageModifierForLevel(int yLevel)
{
return 0.02f * ((((float)yLevel)/64f) * 1.5f - 1);
return 0.02f * ((((float)Math.min(yLevel, 255))/64f) * 1.5f - 1);
}
}

View file

@ -1,15 +1,16 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.List;
import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SelfEnvironmentalEarth extends SelfSpellEffect
{
@ -28,9 +29,9 @@ public class SelfEnvironmentalEarth extends SelfSpellEffect
for (Entity entity : entities)
{
if (entity instanceof EntityLiving)
if (entity instanceof EntityLivingBase)
{
((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, dur, this.potencyUpgrades));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, dur, this.potencyUpgrades));
}
}
}

View file

@ -1,10 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect;
public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect
{
@ -21,7 +21,7 @@ public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect
{
double wantedVel = -(0.5d + 0.7d * this.powerUpgrades);
if (entity instanceof EntityLiving)
if (entity instanceof EntityLivingBase)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel * (entity.posX - player.posX) / dist;

View file

@ -1,10 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.spell.ExtrapolatedMeleeEntityEffect;
public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect
{
@ -21,7 +21,7 @@ public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect
{
double wantedVel = 1.0d + 1.0d * this.powerUpgrades;
if (entity instanceof EntityLiving)
if (entity instanceof EntityLivingBase)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel * (entity.posX - player.posX) / dist;

View file

@ -1,12 +1,13 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.spell.ProjectileImpactEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.spell.ProjectileImpactEffect;
public class ProjectileOffensiveWind extends ProjectileImpactEffect
{
@ -19,9 +20,9 @@ public class ProjectileOffensiveWind extends ProjectileImpactEffect
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
if (mop instanceof EntityLiving)
if (mop instanceof EntityLivingBase)
{
((EntityLiving) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, (int) (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), this.potencyUpgrades));
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, (int) (100 * (2 * this.powerUpgrades + 1) * (1 / (this.potencyUpgrades + 1))), this.potencyUpgrades));
}
}

View file

@ -1,13 +1,13 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import java.util.List;
import WayofTime.alchemicalWizardry.api.spell.SelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SelfEnvironmentalWind extends SelfSpellEffect
{
@ -29,7 +29,7 @@ public class SelfEnvironmentalWind extends SelfSpellEffect
for (Entity entity : entities)
{
if ((!entity.equals(player)) && entity instanceof EntityLiving)
if ((!entity.equals(player)) && entity instanceof EntityLivingBase)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel * (entity.posX - posX) / dist;