Small code cleanup

This commit is contained in:
glowredman committed 2023-06-15 21:26:44 +02:00
1 parent a8053e3181
commit 908a011cb3
5 files changed
+15 -29

No files matched your search

@@ -26,17 +26,4 @@ public class NEIBBABConfig implements IConfigureNEI {
public String getVersion() {
return BeeBetterAtBees.VERSION;
}
/*
Are you FOR REAL NEI?!?!
The class has to be called NEI_SOMETHING_Config ?!? WTF?
ClassDiscoverer classDiscoverer = new ClassDiscoverer(new IStringMatcher() {
public boolean matches(String test) {
return (test.startsWith("NEI")) && (test.endsWith("Config.class"));
}
}, new Class[] { IConfigureNEI.class });
*/
}
@@ -22,8 +22,8 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -94,7 +94,7 @@ public abstract class AbstractTreeGUIHandler implements ICraftingHandler, IUsage
public AbstractTreeGUIHandler newInstance() {
try {
return getClass().newInstance();
return getClass().getConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -181,7 +181,7 @@ public abstract class AbstractTreeGUIHandler implements ICraftingHandler, IUsage
}
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipe) {
if ((GuiContainerManager.shouldShowTooltip(gui)) && (currenttip.size() == 0)) {
Point offset = gui.getRecipePosition(recipe);
currenttip = transferRectTooltip(gui, this.transferRects, offset.x, offset.y, currenttip);
@@ -190,12 +190,12 @@ public abstract class AbstractTreeGUIHandler implements ICraftingHandler, IUsage
}
@Override
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack stack, List<String> currenttip, int recipe) {
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) {
return currenttip;
}
@Override
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) {
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) {
return transferRect(gui, recipe, false);
}
@@ -206,7 +206,7 @@ public abstract class AbstractTreeGUIHandler implements ICraftingHandler, IUsage
}
@Override
public boolean mouseClicked(GuiRecipe gui, int button, int recipe) {
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipe) {
if (button == 0) {
return transferRect(gui, recipe, false);
}
@@ -216,7 +216,7 @@ public abstract class AbstractTreeGUIHandler implements ICraftingHandler, IUsage
return false;
}
private boolean transferRect(GuiRecipe gui, int recipe, boolean usage) {
private boolean transferRect(GuiRecipe<?> gui, int recipe, boolean usage) {
Point offset = gui.getRecipePosition(recipe);
return transferRect(gui, this.transferRects, offset.x, offset.y, usage);
}
@@ -22,7 +22,9 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.HashMap;
@@ -211,7 +213,7 @@ public class BBABGuiRecipeTreeHandler extends AbstractTreeGUIHandler {
}
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipe) {
if(GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
Point pos = GuiDraw.getMousePosition();
Point guiOffset = getGuiOffset(gui);
@@ -40,7 +40,7 @@ public class SimpleBinaryTree<E> {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SimpleBinaryTree that = (SimpleBinaryTree) o;
SimpleBinaryTree<?> that = (SimpleBinaryTree<?>) o;
return !(root != null ? !root.equals(that.root) : that.root != null);
}
@@ -88,7 +88,7 @@ public class SimpleBinaryTree<E> {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Node node = (Node) o;
Node<?> node = (Node<?>) o;
return !(value != null ? !value.equals(node.value) : node.value != null);
}
@@ -2,8 +2,6 @@ package hellfirepvp.beebetteratbees.common;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
@@ -21,7 +19,7 @@ public class BeeBetterAtBees {
public static final String MODID = "beebetteratbees";
public static final String NAME = "BeeBetterAtBees";
public static final String VERSION = "0.3";
public static final String VERSION = Tags.VERSION;
private static final String PROXY_CLIENT = "hellfirepvp.beebetteratbees.client.ClientProxy";
private static final String PROXY_SERVER = "hellfirepvp.beebetteratbees.common.CommonProxy";
@@ -36,7 +34,6 @@ public class BeeBetterAtBees {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
event.getModMetadata().version = VERSION;
ModConfig.init(event.getSuggestedConfigurationFile());
}