Run formatter

This commit is contained in:
Nicholas Ignoffo 2017-08-15 21:30:48 -07:00
parent 61c44a831b
commit 08258fd6ef
606 changed files with 13464 additions and 22975 deletions

View file

@ -1,11 +1,9 @@
package WayofTime.bloodmagic.potion;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionAugmentRecipe;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
@ -17,24 +15,22 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionAugmentRecipe;
public class BMPotionUtils
{
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
public class BMPotionUtils {
public static Random rand = new Random();
public static double damageMobAndGrowSurroundingPlants(EntityLivingBase entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown)
{
public static double damageMobAndGrowSurroundingPlants(EntityLivingBase entity, int horizontalRadius, int verticalRadius, double damageRatio, int maxPlantsGrown) {
World world = entity.getEntityWorld();
if (world.isRemote)
{
if (world.isRemote) {
return 0;
}
if (entity.isDead)
{
if (entity.isDead) {
return 0;
}
@ -42,22 +38,18 @@ public class BMPotionUtils
List<BlockPos> growList = new ArrayList<BlockPos>();
for (int i = 0; i < maxPlantsGrown; i++)
{
for (int i = 0; i < maxPlantsGrown; i++) {
BlockPos blockPos = entity.getPosition().add(rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius, rand.nextInt(verticalRadius * 2 + 1) - verticalRadius, rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius);
IBlockState state = world.getBlockState(blockPos);
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (state.getBlock() instanceof IGrowable)
{
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state)) {
if (state.getBlock() instanceof IGrowable) {
growList.add(blockPos);
}
}
}
for (BlockPos blockPos : growList)
{
for (BlockPos blockPos : growList) {
Block block = world.getBlockState(blockPos).getBlock();
// if (world.rand.nextInt(50) == 0)
{
@ -66,34 +58,29 @@ public class BMPotionUtils
block.updateTick(world, blockPos, world.getBlockState(blockPos), world.rand);
IBlockState newState = world.getBlockState(blockPos);
if (!newState.equals(preBlockState))
{
if (!newState.equals(preBlockState)) {
world.playEvent(2001, blockPos, Block.getIdFromBlock(newState.getBlock()) + (newState.getBlock().getMetaFromState(newState) << 12));
incurredDamage += damageRatio;
}
}
}
if (incurredDamage > 0)
{
if (incurredDamage > 0) {
entity.attackEntityFrom(WayofTime.bloodmagic.api.BloodMagicAPI.damageSource, (float) incurredDamage);
}
return incurredDamage;
}
public static double getLengthAugment(ItemStack flaskStack, Potion potion)
{
public static double getLengthAugment(ItemStack flaskStack, Potion potion) {
NBTHelper.checkNBT(flaskStack);
NBTTagCompound tag = flaskStack.getTagCompound();
return tag.getDouble(Constants.NBT.POTION_AUGMENT_LENGHT + potion.getName());
}
public static void setLengthAugment(ItemStack flaskStack, Potion potion, double value)
{
if (value < 0)
{
public static void setLengthAugment(ItemStack flaskStack, Potion potion, double value) {
if (value < 0) {
value = 0;
}
@ -103,30 +90,25 @@ public class BMPotionUtils
tag.setDouble(Constants.NBT.POTION_AUGMENT_LENGHT + potion.getName(), value);
}
public static int getAugmentedLength(int originalLength, double lengthAugment, double powerAugment)
{
public static int getAugmentedLength(int originalLength, double lengthAugment, double powerAugment) {
return Math.max((int) (originalLength * (Math.pow(8f / 3f, lengthAugment) * Math.pow(0.5, powerAugment))), 1);
}
/**
* Copied from PotionUtils
*
*
* @param stack
* @param effects
* @return
*/
public static ItemStack setEffects(ItemStack stack, Collection<PotionEffect> effects)
{
if (effects.isEmpty())
{
public static ItemStack setEffects(ItemStack stack, Collection<PotionEffect> effects) {
if (effects.isEmpty()) {
return stack;
} else
{
} else {
NBTTagCompound nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
for (PotionEffect potioneffect : effects)
{
for (PotionEffect potioneffect : effects) {
nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
}
@ -136,23 +118,19 @@ public class BMPotionUtils
}
}
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, double lengthAugment)
{
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, double lengthAugment) {
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItems, baseEffect, lengthAugment, 0);
}
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, int powerAugment)
{
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, int powerAugment) {
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItems, baseEffect, 0, powerAugment);
}
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, double lengthAugment)
{
public static AlchemyTablePotionAugmentRecipe getLengthAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, double lengthAugment) {
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItem, baseEffect, lengthAugment, 0);
}
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, int powerAugment)
{
public static AlchemyTablePotionAugmentRecipe getPowerAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem, PotionEffect baseEffect, int powerAugment) {
return new AlchemyTablePotionAugmentRecipe(lpDrained, ticksRequired, tierRequired, inputItem, baseEffect, 0, powerAugment);
}
}

View file

@ -9,55 +9,46 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PotionBloodMagic extends Potion
{
public class PotionBloodMagic extends Potion {
public static ResourceLocation texture = new ResourceLocation(BloodMagic.MODID, "textures/misc/potions.png");
public PotionBloodMagic(String name, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
{
public PotionBloodMagic(String name, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY) {
super(badEffect, potionColor);
this.setPotionName(name);
this.setIconIndex(iconIndexX, iconIndexY);
}
@Override
public boolean shouldRenderInvText(PotionEffect effect)
{
public boolean shouldRenderInvText(PotionEffect effect) {
return true;
}
public PotionEffect apply(EntityLivingBase entity, int duration)
{
public PotionEffect apply(EntityLivingBase entity, int duration) {
return apply(entity, duration, 0);
}
public PotionEffect apply(EntityLivingBase entity, int duration, int level)
{
public PotionEffect apply(EntityLivingBase entity, int duration, int level) {
PotionEffect effect = new PotionEffect(this, duration, level, false, false);
entity.addPotionEffect(effect);
return effect;
}
public int getLevel(EntityLivingBase entity)
{
public int getLevel(EntityLivingBase entity) {
PotionEffect effect = entity.getActivePotionEffect(this);
if (effect != null)
{
if (effect != null) {
return effect.getAmplifier();
}
return 0;
}
@Override
public boolean shouldRender(PotionEffect effect)
{
public boolean shouldRender(PotionEffect effect) {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex()
{
public int getStatusIconIndex() {
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
return super.getStatusIconIndex();

View file

@ -19,14 +19,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.List;
@Mod.EventBusSubscriber
public class PotionEventHandlers
{
public class PotionEventHandlers {
@SubscribeEvent
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
event.getEntityLiving().motionY += (0.1f) * (2 + i);
}
@ -37,8 +34,7 @@ public class PotionEventHandlers
}
@SubscribeEvent
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
// if (event.getEntityLiving().isPotionActive(ModPotions.boost))
// {
// int i = event.getEntityLiving().getActivePotionEffect(ModPotions.boost).getAmplifier();
@ -55,14 +51,12 @@ public class PotionEventHandlers
// }
// }
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND))
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND)) {
int d0 = 3;
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(event.getEntityLiving().posX - 0.5, event.getEntityLiving().posY - 0.5, event.getEntityLiving().posZ - 0.5, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5).expand(d0, d0, d0);
List<Entity> entityList = event.getEntityLiving().getEntityWorld().getEntitiesWithinAABB(Entity.class, axisAlignedBB);
for (Entity projectile : entityList)
{
for (Entity projectile : entityList) {
if (projectile == null)
continue;
if (!(projectile instanceof IProjectile))
@ -89,8 +83,7 @@ public class PotionEventHandlers
if (angle < 3 * (Math.PI / 4))
continue; // angle is < 135 degrees
if (throwingEntity != null)
{
if (throwingEntity != null) {
delX = -projectile.posX + throwingEntity.posX;
delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight());
delZ = -projectile.posZ + throwingEntity.posZ;
@ -110,31 +103,26 @@ public class PotionEventHandlers
}
@SubscribeEvent
public static void onPlayerRespawn(PlayerEvent.Clone event)
{
public static void onPlayerRespawn(PlayerEvent.Clone event) {
if (event.isWasDeath())
event.getEntityPlayer().addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 400));
}
@SubscribeEvent
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event)
{
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event) {
if (event.player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY))
event.lpAdded = (int) (event.lpAdded * 0.1D);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onPlayerDamageEvent(LivingAttackEvent event)
{
public static void onPlayerDamageEvent(LivingAttackEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND) && event.isCancelable() && event.getSource().isProjectile())
event.setCanceled(true);
}
@SubscribeEvent
public static void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable())
{
public static void onEndermanTeleportEvent(EnderTeleportEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable()) {
event.setCanceled(true);
}
}