Run code formatter

🦀 Way is gone 🦀
This commit is contained in:
Nicholas Ignoffo 2019-04-14 08:22:42 -07:00
parent 7c1565a68c
commit 53b6030ba9
77 changed files with 1289 additions and 2232 deletions

View file

@ -7,10 +7,8 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries;
import java.util.Locale;
public class Constants
{
public static class NBT
{
public class Constants {
public static class NBT {
public static final String OWNER_UUID = "ownerUUID";
public static final String OWNER_NAME = "ownerNAME";
public static final String USES = "uses";
@ -133,13 +131,11 @@ public class Constants
public static final String BREATH = "breath";
}
public static class Mod
{
public static class Mod {
public static final String DOMAIN = BloodMagic.MODID.toLowerCase(Locale.ENGLISH) + ":";
}
public static final class Gui
{
public static final class Gui {
public static final int TELEPOSER_GUI = 0;
public static final int SOUL_FORGE_GUI = 1;
public static final int ROUTING_NODE_GUI = 2;
@ -148,8 +144,7 @@ public class Constants
public static final int SIGIL_HOLDING_GUI = 5;
}
public static class Compat
{
public static class Compat {
public static final String JEI_CATEGORY_ALTAR = BloodMagic.MODID + ":altar";
public static final String JEI_CATEGORY_BINDING = BloodMagic.MODID + ":binding";
public static final String JEI_CATEGORY_ALCHEMYARRAY = BloodMagic.MODID + ":alchemyArray";
@ -166,8 +161,7 @@ public class Constants
public static final Item THAUMCRAFT_GOGGLES = ForgeRegistries.ITEMS.getValue(new ResourceLocation("Thaumcraft", "goggles"));
}
public static class Misc
{
public static class Misc {
public static final int POTION_ARRAY_SIZE = 256;
public static final float ALTERED_STEP_HEIGHT = 1.00314159f;
public static final int NIGHT_VISION_CONSTANT_BEGIN = 30020;

View file

@ -5,8 +5,10 @@ import net.minecraftforge.fluids.FluidStack;
public interface ISigilFluidItem {
FluidStack getFluid(ItemStack sigil);
int getCapacity(ItemStack sigil);
int fill(ItemStack sigil, FluidStack resource, boolean doFill);
FluidStack drain(ItemStack sigil, int maxDrain, boolean doDrain);
}

View file

@ -45,7 +45,7 @@ public class PluginUtil {
// Bring core plugin up to top
discoveredAnnotations.sort((o1, o2) -> {
if (o1.getLeft().getClass() == BloodMagicCorePlugin.class)
return -1;
return -1;
return o1.getClass().getCanonicalName().compareToIgnoreCase(o2.getClass().getCanonicalName());
});
@ -120,8 +120,7 @@ public class PluginUtil {
public enum RegistrationStep {
PLUGIN_REGISTER(p -> p.getLeft().register(BloodMagicAPI.INSTANCE)),
RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar()))
;
RECIPE_REGISTER(p -> p.getLeft().registerRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar()));
private final Consumer<Pair<IBloodMagicPlugin, BloodMagicPlugin>> consumer;

View file

@ -360,7 +360,7 @@ public class GenericHandler {
BindableHelper.applyBinding(held, player); // Bind item to the player
}
// If the binding exists, we'll check if the player's name has changed since they last used it and update that if so.
// If the binding exists, we'll check if the player's name has changed since they last used it and update that if so.
} else if (binding.getOwnerId().equals(player.getGameProfile().getId()) && !binding.getOwnerName().equals(player.getGameProfile().getName())) {
binding.setOwnerName(player.getGameProfile().getName());
BindableHelper.applyBinding(held, binding);
@ -419,9 +419,9 @@ public class GenericHandler {
}
@SubscribeEvent
public static void onRitualDeath(LivingDropsEvent event){
if(!ConfigHandler.values.wellOfSufferingDrops){
if(event.getSource().equals(RitualManager.RITUAL_DAMAGE)) {
public static void onRitualDeath(LivingDropsEvent event) {
if (!ConfigHandler.values.wellOfSufferingDrops) {
if (event.getSource().equals(RitualManager.RITUAL_DAMAGE)) {
event.getDrops().clear();
}
}

View file

@ -45,31 +45,24 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class LivingArmourHandler
{
public class LivingArmourHandler {
@SubscribeEvent
public static void onEntityHealed(LivingHealEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
public static void onEntityHealed(LivingHealEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntity();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
double modifier = 1;
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.slowHeal", chestStack);
if (upgrade instanceof LivingArmourUpgradeSlowHeal)
{
if (upgrade instanceof LivingArmourUpgradeSlowHeal) {
modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier();
}
if (modifier != 1)
{
if (modifier != 1) {
event.setAmount((float) (event.getAmount() * modifier));
}
}
@ -78,23 +71,18 @@ public class LivingArmourHandler
}
@SubscribeEvent
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event)
{
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) {
EntityPlayer player = event.getEntityPlayer();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
double modifier = 1;
for (LivingArmourUpgrade upgrade : armour.upgradeMap.values())
{
for (LivingArmourUpgrade upgrade : armour.upgradeMap.values()) {
modifier *= upgrade.getMiningSpeedModifier(player);
}
if (modifier != 1)
{
if (modifier != 1) {
event.setNewSpeed((float) (event.getOriginalSpeed() * modifier));
}
}
@ -103,31 +91,24 @@ public class LivingArmourHandler
// Applies: Storm Trooper
@SubscribeEvent
public static void onEntityJoinedWorld(EntityJoinWorldEvent event)
{
public static void onEntityJoinedWorld(EntityJoinWorldEvent event) {
Entity owner = null;
if (event.getEntity() instanceof EntityArrow)
{
if (event.getEntity() instanceof EntityArrow) {
owner = ((EntityArrow) event.getEntity()).shootingEntity;
} else if (event.getEntity() instanceof EntityThrowable)
{
} else if (event.getEntity() instanceof EntityThrowable) {
owner = ((EntityThrowable) event.getEntity()).getThrower();
}
if (owner instanceof EntityPlayer)
{
if (owner instanceof EntityPlayer) {
Entity projectile = event.getEntity();
EntityPlayer player = (EntityPlayer) owner;
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stormTrooper", chestStack);
if (upgrade instanceof LivingArmourUpgradeStormTrooper)
{
if (upgrade instanceof LivingArmourUpgradeStormTrooper) {
float velocityModifier = (float) (((LivingArmourUpgradeStormTrooper) upgrade).getArrowJiggle(player) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ));
projectile.motionX += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
@ -140,37 +121,28 @@ public class LivingArmourHandler
}
@SubscribeEvent
public static void onPlayerClick(PlayerInteractEvent event)
{
if (event.isCancelable())
{
public static void onPlayerClick(PlayerInteractEvent event) {
if (event.isCancelable()) {
EntityPlayer player = event.getEntityPlayer();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (event.getHand() == EnumHand.OFF_HAND)
{
if (armour != null) {
if (event.getHand() == EnumHand.OFF_HAND) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.crippledArm", chestStack);
if (upgrade instanceof LivingArmourUpgradeCrippledArm)
{
if (upgrade instanceof LivingArmourUpgradeCrippledArm) {
event.setCanceled(true);
}
}
if (event.getItemStack().getItemUseAction() == EnumAction.DRINK)
{
if (event.getItemStack().getItemUseAction() == EnumAction.DRINK) {
ItemStack drinkStack = event.getItemStack();
if (!(drinkStack.getItem() instanceof ItemSplashPotion))
{
if (!(drinkStack.getItem() instanceof ItemSplashPotion)) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.quenched", chestStack);
if (upgrade instanceof LivingArmourUpgradeQuenched)
{
if (upgrade instanceof LivingArmourUpgradeQuenched) {
event.setCanceled(true);
}
}
@ -182,24 +154,19 @@ public class LivingArmourHandler
// Applies: Grim Reaper
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onEntityDeath(LivingDeathEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
public static void onEntityDeath(LivingDeathEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
StatTrackerGrimReaperSprint.incrementCounter(armour);
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.grimReaper", chestStack);
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player))
{
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint && ((LivingArmourUpgradeGrimReaperSprint) upgrade).canSavePlayer(player)) {
((LivingArmourUpgradeGrimReaperSprint) upgrade).applyEffectOnRebirth(player);
event.setCanceled(true);
event.setResult(Event.Result.DENY);
@ -213,26 +180,20 @@ public class LivingArmourHandler
// Applies: Jump
@SubscribeEvent
public static void onJumpEvent(LivingEvent.LivingJumpEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
public static void onJumpEvent(LivingEvent.LivingJumpEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
StatTrackerJump.incrementCounter(armour);
if (!player.isSneaking())
{
if (!player.isSneaking()) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.jump", chestStack);
if (upgrade instanceof LivingArmourUpgradeJump)
{
if (upgrade instanceof LivingArmourUpgradeJump) {
player.motionY += ((LivingArmourUpgradeJump) upgrade).getJumpModifier();
}
}
@ -243,34 +204,25 @@ public class LivingArmourHandler
// Applies: Step Assist, Speed Boost
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
boolean hasAssist = false;
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
hasAssist = true;
player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT;
} else
{
if (LivingArmour.hasFullSet(player))
{
} else {
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
if (armour != null)
{
if (armour != null) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.stepAssist", chestStack);
if (upgrade instanceof LivingArmourUpgradeStepAssist)
{
if (!player.isSneaking())
{
if (upgrade instanceof LivingArmourUpgradeStepAssist) {
if (!player.isSneaking()) {
player.stepHeight = ((LivingArmourUpgradeStepAssist) upgrade).getStepAssist();
hasAssist = true;
} else
{
} else {
player.stepHeight = 0.6F;
}
}
@ -283,31 +235,26 @@ public class LivingArmourHandler
float percentIncrease = 0;
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
if (armour != null)
{
if (armour != null) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(BloodMagic.MODID + ".upgrade.movement", chestStack);
if (upgrade instanceof LivingArmourUpgradeSpeed)
{
if (upgrade instanceof LivingArmourUpgradeSpeed) {
percentIncrease += ((LivingArmourUpgradeSpeed) upgrade).getSpeedModifier();
}
}
}
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
{
percentIncrease += (i + 1) * 0.5f;
}
}
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
{
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) {
player.travel(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease);
}
}
@ -316,8 +263,7 @@ public class LivingArmourHandler
// Applies: Arrow Shot
// Tracks: Arrow Shot
@SubscribeEvent
public static void onArrowFire(ArrowLooseEvent event)
{
public static void onArrowFire(ArrowLooseEvent event) {
World world = event.getEntityPlayer().getEntityWorld();
ItemStack stack = event.getBow();
EntityPlayer player = event.getEntityPlayer();
@ -326,17 +272,14 @@ public class LivingArmourHandler
if (world.isRemote)
return;
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
StatTrackerArrowShot.incrementCounter(armour);
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.arrowShot", chestStack);
if (upgrade instanceof LivingArmourUpgradeArrowShot)
{
if (upgrade instanceof LivingArmourUpgradeArrowShot) {
int charge = event.getCharge();
float velocity = (float) charge / 20.0F;
velocity = (velocity * velocity + velocity * 2.0F) / 3.0F;
@ -350,8 +293,7 @@ public class LivingArmourHandler
sentientShot = true;
}
int extraArrows = ((LivingArmourUpgradeArrowShot) upgrade).getExtraArrows();
for (int n = 0; n < extraArrows; n++)
{
for (int n = 0; n < extraArrows; n++) {
ItemStack arrowStack = new ItemStack(Items.ARROW);
ItemArrow itemarrow = (ItemArrow) ((stack.getItem() instanceof ItemArrow ? arrowStack.getItem() : Items.ARROW));
EntityArrow entityarrow;
@ -392,21 +334,19 @@ public class LivingArmourHandler
}
}
}
}
}
// Applies: Softfall
@SubscribeEvent
public static void onPlayerFall(LivingFallEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer)
{
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player))
{
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
if (armour != null) {
StatTrackerFallProtect.incrementCounter(armour, event.getDamageMultiplier() * (event.getDistance() - 3));
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.fallProtect", chestStack);
if (upgrade instanceof LivingArmourUpgradeFallProtect) {
@ -417,17 +357,14 @@ public class LivingArmourHandler
}
}
}
// Applies: Arrow Shot
@SubscribeEvent
public static void onProjectileImpact(ProjectileImpactEvent.Arrow event)
{
if (event.getArrow().removeTag("arrow_shot"))
{
public static void onProjectileImpact(ProjectileImpactEvent.Arrow event) {
if (event.getArrow().removeTag("arrow_shot")) {
Entity entity = event.getRayTraceResult().entityHit;
if (entity != null)
{
if (entity != null) {
entity.hurtResistantTime = 0;
}
}

View file

@ -21,7 +21,7 @@ public class IncenseHelper {
data.setDouble(Constants.NBT.CURRENT_INCENSE, amount);
}
public static void setMaxIncense(EntityPlayer player, double amount){
public static void setMaxIncense(EntityPlayer player, double amount) {
NBTTagCompound data = player.getEntityData();
data.setDouble(Constants.NBT.MAX_INCENSE, amount);
}
@ -38,6 +38,7 @@ public class IncenseHelper {
stack = NBTHelper.checkNBT(stack);
stack.getTagCompound().setBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax);
}
public static boolean getHasMaxIncense(ItemStack stack) {
stack = NBTHelper.checkNBT(stack);
return stack.getTagCompound().getBoolean(Constants.NBT.HAS_MAX_INCENSE);

View file

@ -115,12 +115,11 @@ public class NetworkHelper {
/**
* Syphons a player from within a container.
*
* @param stack - ItemStack in the Container.
* @param ticket - SoulTicket to syphon
* @param stack - ItemStack in the Container.
* @param ticket - SoulTicket to syphon
* @return - If the syphon was successful.
*/
public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket)
{
public static boolean syphonFromContainer(ItemStack stack, SoulTicket ticket) {
if (!(stack.getItem() instanceof IBindable))
return false;
@ -131,7 +130,7 @@ public class NetworkHelper {
SoulNetwork network = getSoulNetwork(binding);
SoulNetworkEvent.Syphon.Item event = new SoulNetworkEvent.Syphon.Item(network, ticket, stack);
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(),true) >= ticket.getAmount();
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(), true) >= ticket.getAmount();
}
/**

View file

@ -35,7 +35,7 @@ public class PlayerSacrificeHelper {
amount = amount + Math.min(increment, incenseAddition - amount);
setPlayerIncense(player, amount);
if(amount == incenseAddition) {
if (amount == incenseAddition) {
IncenseHelper.setMaxIncense(player, incenseAddition);
}
// System.out.println("Amount of incense: " + amount + ", Increment: " +