use of baubles.common.container.InventoryBaubles in project NewHorizonsCoreMod by GTNewHorizons.
the class OvenGlove method onWornTick.
@Override
public void onWornTick(ItemStack arg0, EntityLivingBase pEntity) {
try {
if (!(pEntity instanceof EntityPlayer))
return;
if (// MetaItem 0 is running this loop only
arg0.getItemDamage() == 1)
return;
EntityPlayer tPlayer = (EntityPlayer) pEntity;
InventoryBaubles tBaubles = baubles.common.lib.PlayerHandler.getPlayerBaubles(tPlayer);
if (// no fire/lava cheat!
tPlayer.isBurning()) {
if (isGlovesResistActive(tPlayer))
RemoveFireProtection(pEntity);
return;
}
if (_mRnd.nextInt(20) == 0) {
// Player must wear OvenGloves in both slots
ItemStack tBaubleRing1 = tBaubles.stackList[1];
ItemStack tBaubleRing2 = tBaubles.stackList[2];
if (tBaubleRing1 == null || tBaubleRing2 == null) {
// Log("Bauble 1 or 2 is null");
return;
}
if (tBaubleRing1.getUnlocalizedName().contains(_mItemName) && tBaubleRing2.getUnlocalizedName().contains(_mItemName)) {
if (tBaubleRing1.getItemDamage() != 0 || tBaubleRing2.getItemDamage() != 1) {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
if (!WrongSidePopupShown) {
WrongSidePopupShown = true;
eu.usrv.yamcore.client.Notification noti = new eu.usrv.yamcore.client.Notification(tBaubleRing1, "Wrong place", "The gloves feel weird...");
NotificationTickHandler.guiNotification.queueNotification(noti);
}
}
// Log("Gloves in wrong spots");
return;
}
if (// Cheated gloves don't have NBT tags sometimes
tBaubleRing1.stackTagCompound == null || tBaubleRing2.stackTagCompound == null)
return;
if (tBaubleRing1.stackTagCompound.getInteger(NBTTAG_DURABILITY) <= 1 || tBaubleRing2.stackTagCompound.getInteger(NBTTAG_DURABILITY) <= 1)
return;
ItemStack tHeldItem = tPlayer.getCurrentEquippedItem();
if (tHeldItem != null) {
// Update 12.01.2017: Player must hold any item containing Lava
if (isValidLavaContainerItem(tHeldItem)) {
if (!isResistActive(tPlayer) || isGlovesResistActive(tPlayer)) {
tPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, potionDuration, potionAmplifier, potionAmbient));
// Randomly damage gloves while giving the protection effect
int tRandomDamage = _mRnd.nextInt(10);
if (tRandomDamage == 1)
DamageItem(tBaubleRing1);
else if (tRandomDamage == 2)
DamageItem(tBaubleRing2);
}
}
}
}
}
} catch (// Fail-safe for all future crashes
Exception e) {
e.printStackTrace();
}
}
use of baubles.common.container.InventoryBaubles in project NewHorizonsCoreMod by GTNewHorizons.
the class WitherProtectionRing method onWornTick.
/*
private void CreateOrInitNBTTag(ItemStack pItemStack)
{
if( pItemStack.stackTagCompound == null )
{
pItemStack.setTagCompound( new NBTTagCompound( ) );
pItemStack.stackTagCompound.setInteger(NBTTAG_VISVICTUS, 10000);
pItemStack.stackTagCompound.setInteger(NBTTAG_PotionEffectID, Potion.heal.getId());
pItemStack.stackTagCompound.setInteger(NBTTAG_PotionLevel, 5);
}
}
// ------------------ NBT End
*/
@Override
public void onWornTick(ItemStack arg0, EntityLivingBase pEntity) {
if (!(pEntity instanceof EntityPlayer))
return;
if (_mRnd.nextInt(20) == 0) {
EntityPlayer tPlayer = (EntityPlayer) pEntity;
InventoryBaubles tBaubles = baubles.common.lib.PlayerHandler.getPlayerBaubles(tPlayer);
//PotionEffect tEff = getNBTPotionEffect(arg0);
//int tStoredVictus = GetNBTVictusVis(arg0);
/*if (tEff == null || tStoredVictus < 1)
{
return;
}
*/
Potion tPot = Potion.wither;
if (tPlayer.isPotionActive(tPot)) {
tPlayer.removePotionEffect(tPot.id);
//DamageItem(arg0);
}
}
}
Aggregations