potion cleanup
This commit is contained in:
parent
460a58e062
commit
e108650cd4
30 changed files with 644 additions and 968 deletions
|
@ -34,16 +34,16 @@ public class ItemAppleGold extends ItemFood
|
|||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
player.addEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
|
||||
player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0));
|
||||
}
|
||||
|
||||
if (stack.getMetadata() > 0)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
player.addEffect(new PotionEffect(Potion.regeneration.id, 600, 4));
|
||||
player.addEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
|
||||
player.addEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
|
||||
player.addEffect(new PotionEffect(Potion.REGENERATION, 600, 4));
|
||||
player.addEffect(new PotionEffect(Potion.RESISTANCE, 6000, 0));
|
||||
player.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, 6000, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -40,8 +40,8 @@ public class ItemFishFood extends ItemFood
|
|||
|
||||
if (itemfishfood$fishtype == ItemFishFood.FishType.PUFFERFISH)
|
||||
{
|
||||
player.addEffect(new PotionEffect(Potion.poison.id, 1200, 3));
|
||||
player.addEffect(new PotionEffect(Potion.confusion.id, 300, 1));
|
||||
player.addEffect(new PotionEffect(Potion.POISON, 1200, 3));
|
||||
player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1));
|
||||
}
|
||||
|
||||
super.onFoodEaten(stack, worldIn, player);
|
||||
|
|
|
@ -2,6 +2,7 @@ package game.item;
|
|||
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.init.SoundEvent;
|
||||
import game.potion.Potion;
|
||||
import game.potion.PotionEffect;
|
||||
import game.world.World;
|
||||
|
||||
|
@ -10,7 +11,7 @@ public class ItemFood extends Item
|
|||
public final int itemUseDuration;
|
||||
private final int healAmount;
|
||||
private final boolean isWolfsFavoriteMeat;
|
||||
private int potionId;
|
||||
private Potion potionId;
|
||||
private int potionDuration;
|
||||
private int potionAmplifier;
|
||||
private float potionEffectProbability;
|
||||
|
@ -40,7 +41,7 @@ public class ItemFood extends Item
|
|||
|
||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||
{
|
||||
if (!worldIn.client && this.potionId > 0 && worldIn.rand.floatv() < this.potionEffectProbability)
|
||||
if (!worldIn.client && this.potionId != null && worldIn.rand.floatv() < this.potionEffectProbability)
|
||||
{
|
||||
player.addEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
|
||||
}
|
||||
|
@ -88,7 +89,7 @@ public class ItemFood extends Item
|
|||
* sets a potion effect on the item. Args: int potionId, int duration (will be multiplied by 20), int amplifier,
|
||||
* float probability of effect happening
|
||||
*/
|
||||
public ItemFood setPotionEffect(int id, int duration, int amplifier, float probability)
|
||||
public ItemFood setPotionEffect(Potion id, int duration, int amplifier, float probability)
|
||||
{
|
||||
this.potionId = id;
|
||||
this.potionDuration = duration;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ItemPotion extends Item
|
|||
|
||||
if (list == null)
|
||||
{
|
||||
list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
|
||||
list = PotionHelper.getPotionEffects(stack.getMetadata());
|
||||
this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class ItemPotion extends Item
|
|||
|
||||
if (list == null)
|
||||
{
|
||||
list = PotionHelper.getPotionEffects(meta, false);
|
||||
list = PotionHelper.getPotionEffects(meta);
|
||||
this.effectCache.put(Integer.valueOf(meta), list);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ItemPotion extends Item
|
|||
{
|
||||
for (PotionEffect potioneffect : list)
|
||||
{
|
||||
if (Potion.POTION_TYPES[potioneffect.getPotionID()].isInstant())
|
||||
if (potioneffect.getPotion().isInstant())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -254,15 +254,15 @@ public class ItemPotion extends Item
|
|||
for (PotionEffect potioneffect : list)
|
||||
{
|
||||
String s1 = potioneffect.getEffectName().trim();
|
||||
Potion potion = Potion.POTION_TYPES[potioneffect.getPotionID()];
|
||||
Map<Attribute, AttributeModifier> map = potion.getAttributeModifierMap();
|
||||
Potion potion = potioneffect.getPotion();
|
||||
Map<Attribute, AttributeModifier> map = potion.getModifiers();
|
||||
|
||||
if (map != null && map.size() > 0)
|
||||
{
|
||||
for (Entry<Attribute, AttributeModifier> entry : map.entrySet())
|
||||
{
|
||||
AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
|
||||
AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierAmount(potioneffect.getAmplifier(), attributemodifier), attributemodifier.isMultiplied());
|
||||
AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAmount(potioneffect.getAmplifier(), attributemodifier), attributemodifier.isMultiplied());
|
||||
Set<AttributeModifier> set = multimap.get(entry.getKey());
|
||||
if(set == null)
|
||||
multimap.put(entry.getKey(), set = Sets.newHashSet());
|
||||
|
@ -283,7 +283,7 @@ public class ItemPotion extends Item
|
|||
|
||||
if (potioneffect.getDuration() > 20)
|
||||
{
|
||||
s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")";
|
||||
s1 = s1 + " (" + potioneffect.getDurationString() + ")";
|
||||
}
|
||||
|
||||
if (potion.isBadEffect())
|
||||
|
@ -384,7 +384,7 @@ public class ItemPotion extends Item
|
|||
}
|
||||
}
|
||||
|
||||
List<PotionEffect> list = PotionHelper.getPotionEffects(i1, false);
|
||||
List<PotionEffect> list = PotionHelper.getPotionEffects(i1);
|
||||
|
||||
if (list != null && !list.isEmpty())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue