summaryrefslogtreecommitdiff
path: root/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2019-08-22 19:54:41 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2019-08-22 19:54:41 -0400
commitc918a1b6d8008773e9beebb48ba1a770405aee20 (patch)
tree7588d9e570addc61d2f318697662e6f2156fa04e /YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java
parent3eb8c7a8fca3f22475d53e30f0b90a6737f313fa (diff)
Bulk update back to sanity
Diffstat (limited to 'YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java')
-rwxr-xr-xYWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java150
1 files changed, 36 insertions, 114 deletions
diff --git a/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java b/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java
index 6c4eef5..975e18b 100755
--- a/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java
+++ b/YWD/src/main/java/fyresmodjam/entities/EntityMysteryPotion.java
@@ -28,23 +28,18 @@ public class EntityMysteryPotion extends EntityThrowable {
super(par1World);
}
- public EntityMysteryPotion(World par1World,
- EntityLivingBase par2EntityLivingBase, int par3) {
+ public EntityMysteryPotion(World par1World, EntityLivingBase par2EntityLivingBase, int par3) {
this(par1World, par2EntityLivingBase, null);
}
- public EntityMysteryPotion(World par1World,
- EntityLivingBase par2EntityLivingBase,
- ItemStack par4ItemStack) {
+ public EntityMysteryPotion(World par1World, EntityLivingBase par2EntityLivingBase, ItemStack par4ItemStack) {
super(par1World, par2EntityLivingBase);
if (par4ItemStack != null) {
int damage = par4ItemStack.getItemDamage();
dataWatcher.updateObject(24, damage);
if (damage % 13 < 12) {
- dataWatcher.updateObject(25,
- CommonTickHandler.worldData.potionDurations[damage
- % 13]);
+ dataWatcher.updateObject(25, CommonTickHandler.worldData.potionDurations[damage % 13]);
}
}
}
@@ -58,23 +53,17 @@ public class EntityMysteryPotion extends EntityThrowable {
}
@SideOnly(Side.CLIENT)
- public EntityMysteryPotion(World par1World, double par2,
- double par4, double par6, int par8) {
- this(par1World, par2, par4, par6,
- new ItemStack(Items.potionitem, 1, par8));
+ public EntityMysteryPotion(World par1World, double par2, double par4, double par6, int par8) {
+ this(par1World, par2, par4, par6, new ItemStack(Items.potionitem, 1, par8));
}
- public EntityMysteryPotion(World par1World, double par2,
- double par4, double par6,
- ItemStack par4ItemStack) {
+ public EntityMysteryPotion(World par1World, double par2, double par4, double par6, ItemStack par4ItemStack) {
super(par1World, par2, par4, par6);
if (par4ItemStack != null) {
int damage = par4ItemStack.getItemDamage();
dataWatcher.updateObject(24, damage);
- dataWatcher.updateObject(25,
- CommonTickHandler.worldData.potionDurations[damage
- % 13]);
+ dataWatcher.updateObject(25, CommonTickHandler.worldData.potionDurations[damage % 13]);
}
}
@@ -95,36 +84,21 @@ public class EntityMysteryPotion extends EntityThrowable {
@Override
@SuppressWarnings("rawtypes")
- protected void onImpact(
- MovingObjectPosition par1MovingObjectPosition) {
+ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
if (!worldObj.isRemote) {
- AxisAlignedBB axisalignedbb = boundingBox
- .expand(4.0D, 2.0D, 4.0D);
- List list1 = worldObj.getEntitiesWithinAABB(
- EntityLivingBase.class,
- axisalignedbb);
+ AxisAlignedBB axisalignedbb = boundingBox.expand(4.0D, 2.0D, 4.0D);
+ List list1 = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (list1 != null && !list1.isEmpty()) {
- int type = getDataWatcher()
- .getWatchableObjectInt(24)
- % 13;
- int j = type >= 12
- ? (5 + ModjamMod.r.nextInt(
- 26))
- : getDataWatcher()
- .getWatchableObjectInt(
- 25);
+ int type = getDataWatcher().getWatchableObjectInt(24) % 13;
+ int j = type >= 12 ? (5 + ModjamMod.r.nextInt(26)) : getDataWatcher().getWatchableObjectInt(25);
int damage = 0;
- if (type >= 12 || (BlessingUtils
- .hasBlessing(getThrower(),
- "BlessingAlchemist"))) {
- damage = ModjamMod.r.nextInt(
- Potion.potionTypes.length);
+ if (type >= 12 || (BlessingUtils.hasBlessing(getThrower(), "BlessingAlchemist"))) {
+ damage = ModjamMod.r.nextInt(Potion.potionTypes.length);
while (Potion.potionTypes[damage] == null) {
- damage = ModjamMod.r
- .nextInt(Potion.potionTypes.length);
+ damage = ModjamMod.r.nextInt(Potion.potionTypes.length);
}
} else {
damage = CommonTickHandler.worldData.potionValues[type];
@@ -133,26 +107,14 @@ public class EntityMysteryPotion extends EntityThrowable {
Iterator iterator = list1.iterator();
while (iterator.hasNext()) {
- EntityLivingBase entitylivingbase = (EntityLivingBase) iterator
- .next();
- double d0 = getDistanceSqToEntity(
- entitylivingbase);
+ EntityLivingBase entitylivingbase = (EntityLivingBase) iterator.next();
+ double d0 = getDistanceSqToEntity(entitylivingbase);
if (d0 < 16.0D) {
- if (Potion.potionTypes[damage]
- .isInstant()) {
- Potion.potionTypes[damage]
- .affectEntity(getThrower(),
- entitylivingbase,
- 1,
- 1);
+ if (Potion.potionTypes[damage].isInstant()) {
+ Potion.potionTypes[damage].affectEntity(getThrower(), entitylivingbase, 1, 1);
} else {
- entitylivingbase.addPotionEffect(
- new PotionEffect(
- damage,
- j * 20,
- 1,
- false));
+ entitylivingbase.addPotionEffect(new PotionEffect(damage, j * 20, 1, false));
}
}
}
@@ -160,83 +122,43 @@ public class EntityMysteryPotion extends EntityThrowable {
if (getThrower() instanceof EntityPlayer) {
EntityPlayer par3EntityPlayer = (EntityPlayer) getThrower();
- if (type < 12 && (!BlessingUtils
- .hasBlessing(getThrower(),
- "BlessingAlchemist"))) {
- if (!par3EntityPlayer
- .getEntityData()
- .hasKey("PotionKnowledge")) {
- par3EntityPlayer.getEntityData()
- .setIntArray("PotionKnowledge",
- new int[] {
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1
- });
+ if (type < 12 && (!BlessingUtils.hasBlessing(getThrower(), "BlessingAlchemist"))) {
+ if (!par3EntityPlayer.getEntityData().hasKey("PotionKnowledge")) {
+ par3EntityPlayer.getEntityData().setIntArray("PotionKnowledge",
+ new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 });
}
- if (par3EntityPlayer
- .getEntityData()
- .getIntArray("PotionKnowledge")[type] == -1) {
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge")[type] = 1;
+ if (par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[type] == -1) {
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[type] = 1;
- NewPacketHandler.UPDATE_POTION_KNOWLEDGE
- .sendToPlayer(par3EntityPlayer,
- par3EntityPlayer.getEntityData()
- .getIntArray("PotionKnowledge"));
+ NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(par3EntityPlayer,
+ par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge"));
Potion potion = Potion.potionTypes[CommonTickHandler.worldData.potionValues[type]];
- String name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
int time = CommonTickHandler.worldData.potionDurations[type];
- name += " (" + time
- + " seconds)";
+ name += " (" + time + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par3EntityPlayer,
- "\u00A7oYou learnt Mystery Potion #"
- + (type + 1)
- + " was a "
- + name
- + "!");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer,
+ "\u00A7oYou learnt Mystery Potion #" + (type + 1) + " was a " + name + "!");
}
} else {
Potion potion = Potion.potionTypes[damage];
- String name = StatCollector
- .translateToLocal(
- potion.getName())
- + " Potion";
+ String name = StatCollector.translateToLocal(potion.getName()) + " Potion";
if (!potion.isInstant()) {
name += " (" + j + " seconds)";
}
- NewPacketHandler.SEND_MESSAGE
- .sendToPlayer(par3EntityPlayer,
- "\u00A7oYou threw a "
- + name
- + ".");
+ NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer,
+ "\u00A7oYou threw a " + name + ".");
}
}
}
- worldObj.playAuxSFX(2002, (int) Math.round(posX),
- (int) Math.round(posY),
- (int) Math.round(posZ), 1);
+ worldObj.playAuxSFX(2002, (int) Math.round(posX), (int) Math.round(posY), (int) Math.round(posZ), 1);
setDead();
}
}