Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarri6343 committed May 8, 2024
1 parent 6bdc077 commit 152d446
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 66 deletions.
6 changes: 3 additions & 3 deletions src/main/java/mcp/mobius/waila/Waila.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import java.lang.reflect.Field;
import java.util.Map;

import cpw.mods.fml.common.*;
import mcp.mobius.waila.addons.harvestability.MissingHarvestInfo;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
import net.minecraftforge.common.MinecraftForge;

import org.apache.logging.log4j.LogManager;
Expand All @@ -14,6 +11,7 @@
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;

import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.*;
Expand All @@ -22,6 +20,8 @@
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.addons.harvestability.MissingHarvestInfo;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
import mcp.mobius.waila.addons.vanillamc.TestRegistrar;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.api.impl.elements.ProgressStyle;
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
import mcp.mobius.waila.utils.ModIdentification;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package mcp.mobius.waila.addons.harvestability;

import net.minecraftforge.common.config.Configuration;

import java.io.File;

public class Config {

public static final String MINIMAL_SEPARATOR_STRING = " : ";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
package mcp.mobius.waila.addons.harvestability;

import mcp.mobius.waila.addons.harvestability.helpers.*;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyCreativeBlocks;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyGregTech;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.ProbeMode;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.utils.Constants;
import java.util.*;

import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -32,7 +21,19 @@
import net.minecraftforge.common.IShearable;
import net.minecraftforge.common.config.Configuration;

import java.util.*;
import mcp.mobius.waila.addons.harvestability.helpers.*;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyCreativeBlocks;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyGregTech;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.ProbeMode;
import mcp.mobius.waila.api.elements.IProbeDataProvider;
import mcp.mobius.waila.api.elements.IProbeInfo;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.api.impl.elements.ModuleProbeRegistrar;
import mcp.mobius.waila.utils.Constants;

public class HUDHandlerHarvestability implements IWailaDataProvider, IProbeDataProvider {

Expand All @@ -50,7 +51,7 @@ public List<String> getWailaHead(ItemStack itemStack, List<String> toolTip, IWai
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> toolTip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if(!ConfigHandler.instance()
if (!ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
return toolTip;
}
Expand Down Expand Up @@ -291,7 +292,7 @@ public List<String> getWailaTail(ItemStack itemStack, List<String> toolTip, IWai
}

public void addProbeInfo(ProbeMode probeMode, ItemStack itemStack, IProbeInfo probeInfo,
IWailaDataAccessor accessor, IWailaConfigHandler config) {
IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
int meta = accessor.getMetadata();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package mcp.mobius.waila.addons.harvestability.helpers;

import mcp.mobius.waila.addons.harvestability.proxy.ProxyGregTech;
import java.util.HashMap;
import java.util.Map;

import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.world.World;

import java.util.HashMap;
import java.util.Map;

public class BlockHelper {

private static final HashMap<String, ItemStack> testTools = new HashMap<String, ItemStack>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mcp.mobius.waila.addons.harvestability.helpers;

import net.minecraft.client.Minecraft;

import org.lwjgl.input.Keyboard;

public class KeyHelper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package mcp.mobius.waila.addons.harvestability.helpers;

import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;
import java.lang.reflect.Method;
import java.util.List;

import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;

import java.lang.reflect.Method;
import java.util.List;
import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.addons.harvestability.proxy.ProxyIguanaTweaks;

public class StringHelper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package mcp.mobius.waila.addons.harvestability.helpers;

import cpw.mods.fml.common.Loader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeHooks;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import cpw.mods.fml.common.Loader;

public class ToolHelper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package mcp.mobius.waila.addons.harvestability.proxy;

import cpw.mods.fml.common.Loader;
import java.lang.reflect.Method;

import net.minecraft.block.Block;

import java.lang.reflect.Method;
import cpw.mods.fml.common.Loader;

public class ProxyCreativeBlocks {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package mcp.mobius.waila.addons.harvestability.proxy;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;

public class ProxyGregTech {

public static final String modID = "gregtech";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityFurnace;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/mcp/mobius/waila/api/impl/MetaDataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import java.util.Map;
import java.util.TreeMap;

import mcp.mobius.waila.utils.Constants;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;

import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaBlock;
Expand All @@ -22,8 +22,8 @@
import mcp.mobius.waila.network.Message0x01TERequest;
import mcp.mobius.waila.network.Message0x03EntRequest;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import net.minecraftforge.common.config.Configuration;

public class MetaDataProvider {

Expand Down Expand Up @@ -69,7 +69,8 @@ public List<String> handleBlockTextData(ItemStack itemStack, World world, Entity
if (accessor.getTileEntity() != null && Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
&& ConfigHandler.instance().showTooltip()
&& ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
&& ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
accessor.resetTimer();
HashSet<String> keys = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import java.util.HashSet;
import java.util.List;

import mcp.mobius.waila.utils.Constants;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;

import mcp.mobius.waila.Waila;
import mcp.mobius.waila.addons.DefaultProbeInfoProvider;
Expand All @@ -19,8 +19,8 @@
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.network.Message0x01TERequest;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import net.minecraftforge.common.config.Configuration;

public class MetaProbeDataProvider {

Expand All @@ -41,7 +41,8 @@ public ProbeInfo handleBlockElementData(ItemStack itemStack, World world, Entity
if (accessor.getTileEntity() != null && Waila.instance.serverPresent
&& accessor.isTimeElapsed(250)
&& ConfigHandler.instance().showTooltip()
&& !ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
&& !ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
accessor.resetTimer();
HashSet<String> keys = new HashSet<>();

Expand Down Expand Up @@ -82,9 +83,10 @@ public ProbeInfo handleBlockElementData(ItemStack itemStack, World world, Entity
return probeInfo;
}

//append legacy Tooltip into new ProbeInfo if possible
public ProbeInfo appendTooltipData(ProbeInfo probeInfo, List<String> tooltip, ItemStack itemStack, DataAccessorCommon accessor) {
if(tooltip.isEmpty()) {
// append legacy Tooltip into new ProbeInfo if possible
public ProbeInfo appendTooltipData(ProbeInfo probeInfo, List<String> tooltip, ItemStack itemStack,
DataAccessorCommon accessor) {
if (tooltip.isEmpty()) {
return probeInfo;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package mcp.mobius.waila.gui.screens.config;

import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import net.minecraft.client.gui.GuiScreen;

import org.lwjgl.util.Point;

import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfigRemote;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import mcp.mobius.waila.utils.Constants;
import org.lwjgl.util.Point;

public class ScreenModuleConfig extends ScreenBase {

public ScreenModuleConfig(GuiScreen parent, String modname) {
super(parent);

this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0){
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0) {

protected int scrollValue = 0;

Expand All @@ -35,7 +36,7 @@ public void onMouseWheel(MouseEvent event) {

@Override
public void draw(Point pos) {
if(scrollValue <= 0) {
if (scrollValue <= 0) {
geom.setPos(0, 20.0 + scrollValue, true, true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Message0x01TERequest msg)

}

//We will try to use old tooltips regardless of the mode
// We will try to use old tooltips regardless of the mode
if ((hasNBTBlock || hasNBTEnt)) {
tag.setInteger("x", msg.posX);
tag.setInteger("y", msg.posY);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/mcp/mobius/waila/overlay/TOPOverlayRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ public static void renderElements(ProbeInfo probeInfo) {
GL11.glPopMatrix();
}

private static void drawProgressBar(){
private static void drawProgressBar() {
float elapsedSecond = (float) (System.currentTimeMillis() - lastMilliSecond) / 1000;
float damage = Minecraft.getMinecraft().playerController.curBlockDamageMP;
if(damage == 0 && progressAlpha <= 0) {
if (damage == 0 && progressAlpha <= 0) {
lastMilliSecond = System.currentTimeMillis();
return;
}

int drawX = x + 1;
int drawY = y; //TODO: configurable top / bottom drawing
int drawY = y; // TODO: configurable top / bottom drawing

if (damage > 0) {
progressAlpha = Math.min(damage, 0.6F);
Expand All @@ -88,13 +88,13 @@ private static void drawProgressBar(){
progressAlpha -= elapsedSecond;
}

int color = applyAlpha(DEFAULT_COLOR, progressAlpha); //TODO: change color with harvestability
int color = applyAlpha(DEFAULT_COLOR, progressAlpha); // TODO: change color with harvestability
int width = (int) ((w - 1) * savedProgress);
DisplayUtil.drawGradientRect(drawX, drawY, width - 1, 2, color, color);
lastMilliSecond = System.currentTimeMillis();
}

private static int applyAlpha (int color, float alpha) {
private static int applyAlpha(int color, float alpha) {
int red = (color >> 16) & 0xFF;
int green = (color >> 8) & 0xFF;
int blue = color & 0xFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void tickClient(TickEvent.ClientTickEvent event) {
currenttip.addAll(currenttipTail);

this.tooltip = new Tooltip(currenttip, targetStack);
if(!ConfigHandler.instance()
if (!ConfigHandler.instance()
.getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FORCE_LEGACY_MODE, false)) {
probe = elementHandler.appendTooltipData(probe, currenttipBody, targetStack, accessor);
}
Expand Down

0 comments on commit 152d446

Please sign in to comment.