Fix player damage and health potions

Vanilla player damage and health potions are scaled to TFC health
This commit is contained in:
JAWolfe04 2016-01-30 21:33:23 -06:00
parent e4b7abe4a7
commit f72606f44c
7 changed files with 24 additions and 1 deletions

View File

@ -1,6 +1,6 @@
minecraft_version=1.7.10
forge_version=10.13.4.1558-1.7.10
tfc_version=0.79.27
mod_version=1.01
mod_version=1.02
mod_id=TerraFirmaPunkTweaks
group_name=com.onewolfe.tfptweaks

Binary file not shown.

Binary file not shown.

View File

@ -5,11 +5,15 @@ import java.util.Random;
import com.bioxx.tfc.api.TFCBlocks;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
public class PlayerHandler
@ -33,4 +37,23 @@ public class PlayerHandler
player.inventory.addItemStackToInventory(new ItemStack(TFCBlocks.chest, 1, 0));
}
}
@SubscribeEvent
public void onDamaged(LivingHurtEvent event)
{
if(event.ammount <= 20 && event.entity instanceof EntityPlayer)
{
event.ammount = event.ammount * 50;
if(event.source == DamageSource.magic && (event.entityLiving.getHealth() - event.ammount) <= 0)
event.setCanceled(true);
}
}
@SubscribeEvent
public void onHeal(LivingHealEvent event)
{
if(event.amount > 1 && event.amount < 9)
event.amount = event.amount * 50;
}
}