Skip to content

Commit

Permalink
fuck off warnings 🦅🦅
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcat101 committed Nov 16, 2023
1 parent fd1d91e commit 788cb6d
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 14 deletions.
8 changes: 8 additions & 0 deletions src/main/java/mcp/mobius/waila/api/IRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public interface IRegistrar {
* @param dataProvider The data provider instance
* @param block The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerStackProvider(IComponentProvider dataProvider, Class block);

/**
Expand All @@ -42,6 +43,7 @@ public interface IRegistrar {
* @param position The position on the tooltip this applies to
* @param block The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerComponentProvider(IComponentProvider dataProvider, TooltipPosition position, Class block);

/**
Expand All @@ -51,6 +53,7 @@ public interface IRegistrar {
* @param dataProvider The data provider instance
* @param block The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerBlockDataProvider(IServerDataProvider<TileEntity> dataProvider, Class block);

/**
Expand All @@ -59,6 +62,7 @@ public interface IRegistrar {
* @param dataProvider The data provider instance
* @param entity The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerOverrideEntityProvider(IEntityComponentProvider dataProvider, Class entity);

/**
Expand All @@ -67,6 +71,7 @@ public interface IRegistrar {
* @param dataProvider The data provider instance
* @param entity The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerEntityStackProvider(IEntityComponentProvider dataProvider, Class entity);

/**
Expand All @@ -77,6 +82,7 @@ public interface IRegistrar {
* @param position The position on the tooltip this applies to
* @param entity The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerComponentProvider(IEntityComponentProvider dataProvider, TooltipPosition position, Class entity);

/**
Expand All @@ -85,6 +91,7 @@ public interface IRegistrar {
* @param dataProvider The data provider instance
* @param entity The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerEntityDataProvider(IServerDataProvider<Entity> dataProvider, Class entity);

/**
Expand All @@ -93,6 +100,7 @@ public interface IRegistrar {
* @param decorator The decorator instance
* @param block The highest level class to apply to
*/
@SuppressWarnings("rawtypes")
void registerDecorator(IBlockDecorator decorator, Class block);

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/mcp/mobius/waila/api/impl/DumpGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@SuppressWarnings("unchecked")
public class DumpGenerator {

@SuppressWarnings("rawtypes")
public static String generateInfoDump() {
StringBuilder builder = new StringBuilder("# Waila Handler Dump");

Expand All @@ -29,7 +29,8 @@ public static String generateInfoDump() {

return builder.toString();
}


@SuppressWarnings("rawtypes")
private static void createSection(StringBuilder builder, String subsection, Map<Class, List<Object>> providers) {
if (providers.isEmpty())
return;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mcp/mobius/waila/api/impl/WailaRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.util.*;

@SuppressWarnings("rawtypes")
public class WailaRegistrar implements IRegistrar {

public static final WailaRegistrar INSTANCE = new WailaRegistrar();
Expand Down Expand Up @@ -106,7 +107,7 @@ public void registerTooltipRenderer(ResourceLocation id, ITooltipRenderer render
this.tooltipRenderers.put(id, renderer);
}

private <T, V extends Class<?>> void registerProvider(T dataProvider, V clazz, Map<V, List<T>> target) {
private <T, V> void registerProvider(T dataProvider, V clazz, Map<V, List<T>> target) {
if (clazz == null || dataProvider == null)
throw new RuntimeException(String.format("Trying to register a null provider or null block ! Please check the stacktrace to know what was the original registration method. [Provider : %s, Target : %s]", dataProvider.getClass().getName(), clazz));

Expand Down
1 change: 1 addition & 0 deletions src/main/java/mcp/mobius/waila/gui/GuiConfigWaila.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public GuiConfigWaila(Screen parent) {
}

@Override
@SuppressWarnings("deprecation")
public OptionsListWidget getOptions() {
ConfigGeneral general = Waila.CONFIG.get().getGeneral();
ConfigOverlay overlay = Waila.CONFIG.get().getOverlay();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mcp/mobius/waila/gui/GuiOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void init(Minecraft client, int width, int height) {
}

@Override
@SuppressWarnings("rawtypes")
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack);
options.render(matrixStack, mouseX, mouseY, partialTicks);
Expand Down Expand Up @@ -93,7 +94,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partia
}

@Override
public IGuiEventListener addWidget(IGuiEventListener listener) {
public <T extends IGuiEventListener> T addWidget(T listener) {
children.add(listener);
return listener;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public int getRowWidth() {
}

@Override
@SuppressWarnings("deprecation")
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
this.renderBackground(matrixStack);
int scrollPosX = this.getScrollbarPosition();
Expand Down Expand Up @@ -117,12 +118,14 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta)
RenderSystem.disableBlend();
}

@SuppressWarnings("rawtypes")
public void save() {
children().stream().filter(e -> e instanceof OptionsEntryValue).map(e -> (OptionsEntryValue) e).forEach(OptionsEntryValue::save);
if (diskWriter != null)
diskWriter.run();
}

@SuppressWarnings("rawtypes")
public void add(Entry entry) {
if (entry instanceof OptionsEntryValue) {
IGuiEventListener element = ((OptionsEntryValue) entry).getListener();
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/mcp/mobius/waila/overlay/DisplayUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static void renderItemIntoGUI(ItemStack stack, int x, int y, float scale)
renderItemModelIntoGUI(stack, x, y, renderer.getModel(stack, (World) null, (LivingEntity) null), scale);
}

@SuppressWarnings("deprecation")
protected static void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBakedModel bakedmodel, float scale) {
ItemRenderer renderer = CLIENT.getItemRenderer();
TextureManager textureManager = CLIENT.textureManager;
Expand Down Expand Up @@ -99,18 +100,20 @@ protected static void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBak
RenderSystem.popMatrix();
}

@SuppressWarnings("deprecation")
public static void renderStackSize(MatrixStack matrixStack, FontRenderer fr, ItemStack stack, int xPosition, int yPosition) {
if (!stack.isEmpty() && stack.getCount() != 1) {
String s = shortHandNumber(stack.getCount());

if (stack.getCount() < 1)
s = TextFormatting.RED + String.valueOf(stack.getCount());

Minecraft mc = Minecraft.getInstance();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
matrixStack.pushPose();
matrixStack.translate(0, 0, Minecraft.getInstance().getItemRenderer().blitOffset + 200F);
matrixStack.translate(0, 0, mc.getItemRenderer().blitOffset + 200F);
fr.drawShadow(matrixStack, s, xPosition + 19 - 2 - fr.width(s), yPosition + 6 + 3, 16777215);
matrixStack.popPose();
RenderSystem.enableLighting();
Expand All @@ -128,16 +131,19 @@ private static String shortHandNumber(Number number) {
return shorthand;
}

@SuppressWarnings("deprecation")
public static void enable3DRender() {
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
}

@SuppressWarnings("deprecation")
public static void enable2DRender() {
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
}

@SuppressWarnings("deprecation")
public static void drawGradientRect(MatrixStack matrixStack, int left, int top, int right, int bottom, int startColor, int endColor) {
float zLevel = 0.0F;
Matrix4f matrix = matrixStack.last().pose();
Expand Down Expand Up @@ -204,6 +210,7 @@ public static List<ITextComponent> itemDisplayNameMultiline(ItemStack itemstack)
return namelist;
}

@SuppressWarnings("deprecation")
public static void renderIcon(MatrixStack matrixStack, int x, int y, int sx, int sy, IconUI icon) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
CLIENT.getTextureManager().bind(AbstractGui.GUI_ICONS_LOCATION);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mcp/mobius/waila/overlay/OverlayRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static void renderOverlay() {
renderOverlay(WailaTickHandler.instance().tooltip, new MatrixStack());
}

@SuppressWarnings("deprecation")
public static void enableGUIStandardItemLighting() {
RenderSystem.pushMatrix();
RenderSystem.rotatef(-30.0F, 0.0F, 1.0F, 0.0F);
Expand All @@ -87,6 +88,7 @@ public static void enableGUIStandardItemLighting() {
RenderSystem.popMatrix();
}

@SuppressWarnings("deprecation")
public static void renderOverlay(Tooltip tooltip, MatrixStack matrixStack) {
Minecraft.getInstance().getProfiler().push("Waila Overlay");
RenderContext.matrixStack = matrixStack;
Expand Down Expand Up @@ -160,6 +162,7 @@ public static void saveGLState() {
GL11.glPushAttrib(GL11.GL_CURRENT_BIT); // Leave me alone :(
}

@SuppressWarnings("deprecation")
public static void loadGLState() {
RenderSystem.depthMask(depthMask);
RenderSystem.depthFunc(depthFunc);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mcp/mobius/waila/overlay/Tooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void addPadding() {
totalSize.height += 8;
}

@SuppressWarnings("deprecation")
public void draw() {
Rectangle position = getPosition();
WailaConfig.ConfigOverlay.ConfigOverlayColor color = Waila.CONFIG.get().getOverlay().getColor();
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/mcp/mobius/waila/overlay/WailaTickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,21 @@ public static WailaTickHandler instance() {

@SubscribeEvent
public static void onTooltip(WailaTooltipEvent event) {
Minecraft mc = Minecraft.getInstance();

if (event.getCurrentTip().isEmpty())
return;

if (!getNarrator().active() || !Waila.CONFIG.get().getGeneral().shouldEnableTextToSpeech())
return;

if (Minecraft.getInstance().screen != null && Minecraft.getInstance().options.chatVisibility != ChatVisibility.HIDDEN)
if (mc.screen != null && mc.options.chatVisibility != ChatVisibility.HIDDEN)
return;

if (event.getAccessor().getBlock() == Blocks.AIR && event.getAccessor().getEntity() == null)
return;

if (Minecraft.getInstance().level != null && Minecraft.getInstance().level.getGameTime() % 5 > 0) {
if (mc.level != null && mc.level.getGameTime() % 5 > 0) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public Dimension getSize(CompoundNBT tag, ICommonAccessor accessor) {
if (component == null) {
return new Dimension();
}
FontRenderer fontRenderer = Minecraft.getInstance().font;
Minecraft mc = Minecraft.getInstance();
FontRenderer fontRenderer = mc.font;
return new Dimension(fontRenderer.width(component.getString()), fontRenderer.lineHeight + 1);
}

Expand All @@ -35,7 +36,8 @@ public void draw(CompoundNBT tag, ICommonAccessor accessor, int x, int y) {
if (component == null) {
return;
}
FontRenderer fontRenderer = Minecraft.getInstance().font;
Minecraft mc = Minecraft.getInstance();
FontRenderer fontRenderer = mc.font;
WailaConfig.ConfigOverlay.ConfigOverlayColor color = Waila.CONFIG.get().getOverlay().getColor();
IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuilder());
fontRenderer.drawInBatch(component.getVisualOrderText(), x, y, color.getFontColor(), true, new MatrixStack().last().pose(), irendertypebuffer$impl, false, 0, 15728880);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/snownee/jade/addon/create/SpeedProvider.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package snownee.jade.addon.create;

import java.util.Arrays;
import java.util.List;

import com.google.common.collect.Iterables;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.goggles.GogglesItem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@
public class StringTooltipRenderer implements ITooltipRenderer {
@Override
public Dimension getSize(CompoundNBT tag, ICommonAccessor accessor) {
Minecraft mc = Minecraft.getInstance();
int ox = tag.getInt("x");
int oy = tag.getInt("y");
String s = tag.getString("text");
FontRenderer fontRenderer = Minecraft.getInstance().font;
FontRenderer fontRenderer = mc.font;
return new Dimension(ox + fontRenderer.width(s), oy + (s.isEmpty() ? 0 : 8));
}

@Override
public void draw(CompoundNBT tag, ICommonAccessor accessor, int x, int y) {
Minecraft mc = Minecraft.getInstance();
int ox = tag.getInt("x");
int oy = tag.getInt("y");
String s = tag.getString("text");
FontRenderer fontRenderer = Minecraft.getInstance().font;
FontRenderer fontRenderer = mc.font;
WailaConfig.ConfigOverlay.ConfigOverlayColor color = Waila.CONFIG.get().getOverlay().getColor();
fontRenderer.drawShadow(new MatrixStack(), s, x + ox, y + oy, color.getFontColor());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public Dimension getSize(CompoundNBT tag, ICommonAccessor accessor) {

@Override
public void draw(CompoundNBT tag, ICommonAccessor accessor, int x, int y) {
Minecraft mc = Minecraft.getInstance();
String s = tag.getString("text");
FontRenderer fontRenderer = Minecraft.getInstance().font;
FontRenderer fontRenderer = mc.font;
WailaConfig.ConfigOverlay.ConfigOverlayColor color = Waila.CONFIG.get().getOverlay().getColor();
MatrixStack matrixStack = new MatrixStack();
if (PluginConfig.INSTANCE.get(JadePlugin.HARVEST_TOOL_NEW_LINE)) {
Expand Down

0 comments on commit 788cb6d

Please sign in to comment.