aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_FoodStat.java
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
commit0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch)
tree1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/util/GT_FoodStat.java
parentf8cc82edeb9810c45cba762d733a2c909a302faa (diff)
downloadGT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_FoodStat.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_FoodStat.java58
1 files changed, 23 insertions, 35 deletions
diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java
index f9a0f50c5f..cc1616f866 100644
--- a/src/main/java/gregtech/api/util/GT_FoodStat.java
+++ b/src/main/java/gregtech/api/util/GT_FoodStat.java
@@ -1,16 +1,18 @@
package gregtech.api.util;
-import gregtech.api.damagesources.GT_DamageSources;
-import gregtech.api.enums.SoundResource;
-import gregtech.api.interfaces.IFoodStat;
-import gregtech.api.items.GT_MetaBase_Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
+import gregtech.api.damagesources.GT_DamageSources;
+import gregtech.api.enums.SoundResource;
+import gregtech.api.interfaces.IFoodStat;
+import gregtech.api.items.GT_MetaBase_Item;
+
public class GT_FoodStat implements IFoodStat {
+
private final int mFoodLevel;
private final int[] mPotionEffects;
private final float mSaturation;
@@ -26,21 +28,12 @@ public class GT_FoodStat implements IFoodStat {
* @param aEmptyContainer An empty Container (Optional)
* @param aAlwaysEdible If this Item is always edible, like Golden Apples or Potions
* @param aInvisibleParticles If the Particles of the Potion Effects are invisible
- * @param aPotionEffects An Array of Potion Effects with %4==0 Elements as follows
- * ID of a Potion Effect. 0 for none
- * Duration of the Potion in Ticks
- * Level of the Effect. [0, 1, 2] are for [I, II, III]
- * The likelihood that this Potion Effect takes place upon being eaten [1 - 100]
+ * @param aPotionEffects An Array of Potion Effects with %4==0 Elements as follows ID of a Potion Effect. 0 for
+ * none Duration of the Potion in Ticks Level of the Effect. [0, 1, 2] are for [I, II,
+ * III] The likelihood that this Potion Effect takes place upon being eaten [1 - 100]
*/
- public GT_FoodStat(
- int aFoodLevel,
- float aSaturation,
- EnumAction aAction,
- ItemStack aEmptyContainer,
- boolean aAlwaysEdible,
- boolean aInvisibleParticles,
- boolean aIsRotten,
- int... aPotionEffects) {
+ public GT_FoodStat(int aFoodLevel, float aSaturation, EnumAction aAction, ItemStack aEmptyContainer,
+ boolean aAlwaysEdible, boolean aInvisibleParticles, boolean aIsRotten, int... aPotionEffects) {
mFoodLevel = aFoodLevel;
mSaturation = aSaturation;
mAction = aAction == null ? EnumAction.eat : aAction;
@@ -78,13 +71,9 @@ public class GT_FoodStat implements IFoodStat {
if (tStack != null && !aPlayer.inventory.addItemStackToInventory(tStack))
aPlayer.dropPlayerItemWithRandomChoice(tStack, true);
- new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder()
- .setIdentifier(SoundResource.RANDOM_BURP)
- .setVolume(0.5F)
- .setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F)
- .setEntity(aPlayer)
- .setWorld(aPlayer.worldObj)
- .run();
+ new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder().setIdentifier(SoundResource.RANDOM_BURP)
+ .setVolume(0.5F).setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F).setEntity(aPlayer)
+ .setWorld(aPlayer.worldObj).run();
if (!aPlayer.worldObj.isRemote) {
if (mMilk) {
@@ -92,19 +81,18 @@ public class GT_FoodStat implements IFoodStat {
}
for (int i = 3; i < mPotionEffects.length; i += 4) {
if (aPlayer.worldObj.rand.nextInt(100) < mPotionEffects[i]) {
- aPlayer.addPotionEffect(new PotionEffect(
- mPotionEffects[i - 3], mPotionEffects[i - 2], mPotionEffects[i - 1], mInvisibleParticles));
+ aPlayer.addPotionEffect(
+ new PotionEffect(
+ mPotionEffects[i - 3],
+ mPotionEffects[i - 2],
+ mPotionEffects[i - 1],
+ mInvisibleParticles));
}
}
if (mExplosive) {
- new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder()
- .setSmoking(true)
- .setFlaming(true)
- .setStrength(4f)
- .setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ)
- .setEntity(aPlayer)
- .setWorld(aPlayer.worldObj)
- .run();
+ new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setSmoking(true).setFlaming(true)
+ .setStrength(4f).setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ).setEntity(aPlayer)
+ .setWorld(aPlayer.worldObj).run();
aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE);
}
}