diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-10-24 13:21:10 +0300 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-10-24 13:21:10 +0300 |
commit | b73908d47da7773a3a6076b1b241db1828ed1435 (patch) | |
tree | 8d1e066c616229782c6437a9b3ec6c866c162c20 | |
parent | b8add1552717ec7a8079da18cecb9439c2be0f1a (diff) | |
download | LibGui-b73908d47da7773a3a6076b1b241db1828ed1435.tar.gz LibGui-b73908d47da7773a3a6076b1b241db1828ed1435.tar.bz2 LibGui-b73908d47da7773a3a6076b1b241db1828ed1435.zip |
Update Loom to 0.5 and use Jetbrains annotations
19 files changed, 82 insertions, 88 deletions
diff --git a/build.gradle b/build.gradle index 3c45adc..fbb61fa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.5-SNAPSHOT' id 'maven-publish' id "com.jfrog.artifactory" version "4.9.0" } @@ -32,9 +32,6 @@ dependencies { modImplementation "io.github.cottonmc:Jankson-Fabric:${project.jankson_version}" include "io.github.cottonmc:Jankson-Fabric:${project.jankson_version}" - // TODO: When updating to Loom 0.5, swap this for Jetbrains annotations - compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false } - modRuntime(modCompileOnly("io.github.prospector:modmenu:$project.modmenu_version") { exclude group: 'net.fabricmc.fabric-api' }) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java index cf1226b..b192808 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java @@ -1,14 +1,14 @@ package io.github.cottonmc.cotton.gui; -import javax.annotation.Nullable; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.screen.PropertyDelegate; import io.github.cottonmc.cotton.gui.impl.FocusHandler; import io.github.cottonmc.cotton.gui.widget.WPanel; import io.github.cottonmc.cotton.gui.widget.WWidget; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.screen.PropertyDelegate; +import org.jetbrains.annotations.Nullable; /** * A GUI description represents a GUI without depending on screens. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index 4500d80..f7803f6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -1,14 +1,5 @@ package io.github.cottonmc.cotton.gui; -import java.util.ArrayList; -import java.util.function.Supplier; - -import javax.annotation.Nullable; - -import io.github.cottonmc.cotton.gui.client.BackgroundPainter; -import io.github.cottonmc.cotton.gui.client.LibGuiClient; -import io.github.cottonmc.cotton.gui.widget.*; -import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.Block; @@ -20,11 +11,28 @@ import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.ItemStack; -import net.minecraft.screen.*; +import net.minecraft.screen.ArrayPropertyDelegate; +import net.minecraft.screen.PropertyDelegate; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerContext; +import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import net.minecraft.world.World; +import io.github.cottonmc.cotton.gui.client.BackgroundPainter; +import io.github.cottonmc.cotton.gui.client.LibGuiClient; +import io.github.cottonmc.cotton.gui.widget.WGridPanel; +import io.github.cottonmc.cotton.gui.widget.WLabel; +import io.github.cottonmc.cotton.gui.widget.WPanel; +import io.github.cottonmc.cotton.gui.widget.WPlayerInvPanel; +import io.github.cottonmc.cotton.gui.widget.WWidget; +import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.function.Supplier; + /** * A screen handler-based GUI description for GUIs with slots. */ diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/LightweightGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/client/LightweightGuiDescription.java index 8a57551..41b8d49 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/LightweightGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/LightweightGuiDescription.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.client; -import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; import net.minecraft.screen.PropertyDelegate; import io.github.cottonmc.cotton.gui.GuiDescription; @@ -9,8 +8,8 @@ import io.github.cottonmc.cotton.gui.widget.WGridPanel; import io.github.cottonmc.cotton.gui.widget.WLabel; import io.github.cottonmc.cotton.gui.widget.WPanel; import io.github.cottonmc.cotton.gui.widget.WWidget; - -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; +import org.jetbrains.annotations.Nullable; /** * A GuiDescription without any associated Minecraft classes diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatch.java b/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatch.java index 9828715..c74e2aa 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatch.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatch.java @@ -11,8 +11,8 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.profiler.Profiler; import io.github.cottonmc.cotton.gui.widget.WWidget; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.InputStream; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java index a7f6027..3b9179d 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java @@ -3,11 +3,11 @@ package io.github.cottonmc.cotton.gui.widget; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.util.math.MathHelper; -import org.lwjgl.glfw.GLFW; import io.github.cottonmc.cotton.gui.widget.data.Axis; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.glfw.GLFW; -import javax.annotation.Nullable; import java.util.function.IntConsumer; /** diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java index 1d332ea..826950c 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.widget.data.Texture; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; @@ -9,12 +8,12 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; +import net.minecraft.util.math.MathHelper; import io.github.cottonmc.cotton.gui.GuiDescription; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; -import net.minecraft.util.math.MathHelper; - -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.widget.data.Texture; +import org.jetbrains.annotations.Nullable; /** * A bar that displays int values from a {@link PropertyDelegate}. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java index 016eceb..6bf65ff 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.widget.icon.Icon; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -8,12 +7,12 @@ import net.minecraft.client.gui.widget.AbstractButtonWidget; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.sound.SoundEvents; +import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; -import net.minecraft.text.Text; - -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.widget.icon.Icon; +import org.jetbrains.annotations.Nullable; public class WButton extends WWidget { private Text label; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java index 15e6916..45fc896 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java @@ -1,15 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.function.Predicate; - -import io.github.cottonmc.cotton.gui.GuiDescription; -import io.github.cottonmc.cotton.gui.ValidatedSlot; -import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -19,7 +9,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.SlotActionType; -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.GuiDescription; +import io.github.cottonmc.cotton.gui.ValidatedSlot; +import io.github.cottonmc.cotton.gui.client.BackgroundPainter; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.function.Predicate; /** * A widget that displays an item that can be interacted with. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java index 5c85c1a..b3ab678 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -9,14 +8,14 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.LiteralText; import net.minecraft.text.Style; +import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.client.TextHoverRendererScreen; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; -import net.minecraft.text.Text; - -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment; +import org.jetbrains.annotations.Nullable; /** * A single-line label widget. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java index 25bafb6..e7f7e3a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java @@ -8,10 +8,9 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; -import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; import io.github.cottonmc.cotton.gui.widget.data.Axis; - -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; +import org.jetbrains.annotations.Nullable; /** * A vanilla-style labeled slider widget. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java index 7265e8d..90ef5d6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java @@ -1,18 +1,17 @@ package io.github.cottonmc.cotton.gui.widget; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import io.github.cottonmc.cotton.gui.GuiDescription; -import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.GuiDescription; +import io.github.cottonmc.cotton.gui.client.BackgroundPainter; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Panels are widgets that contain other widgets. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java index 2a64a74..2bc7d15 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java @@ -1,12 +1,12 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.GuiDescription; -import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.entity.player.PlayerInventory; -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.GuiDescription; +import io.github.cottonmc.cotton.gui.client.BackgroundPainter; +import org.jetbrains.annotations.Nullable; /** * A player inventory widget that has a visually separate hotbar. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java index 88e532c..0e78333 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java @@ -9,8 +9,7 @@ import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.widget.data.Axis; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; /** * A simple slider widget that can be used to select int values. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java index d185d09..efb71d5 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java @@ -1,11 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.client.BackgroundPainter; -import io.github.cottonmc.cotton.gui.client.LibGuiClient; -import io.github.cottonmc.cotton.gui.client.ScreenDrawing; -import io.github.cottonmc.cotton.gui.widget.data.Axis; -import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; -import io.github.cottonmc.cotton.gui.widget.icon.Icon; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -16,7 +10,14 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import javax.annotation.Nullable; +import io.github.cottonmc.cotton.gui.client.BackgroundPainter; +import io.github.cottonmc.cotton.gui.client.LibGuiClient; +import io.github.cottonmc.cotton.gui.client.ScreenDrawing; +import io.github.cottonmc.cotton.gui.widget.data.Axis; +import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; +import io.github.cottonmc.cotton.gui.widget.icon.Icon; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java index 8cd9871..953f995 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -9,14 +8,15 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Style; +import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.client.TextHoverRendererScreen; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; -import net.minecraft.text.Text; +import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; import java.util.Objects; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java index 93ebdcb..8ff03cf 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java @@ -14,13 +14,13 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; -import org.lwjgl.glfw.GLFW; -import org.lwjgl.opengl.GL11; import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.glfw.GLFW; +import org.lwjgl.opengl.GL11; -import javax.annotation.Nullable; import java.util.function.Consumer; import java.util.function.Predicate; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java index 7c37aa5..1142928 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java @@ -1,6 +1,5 @@ package io.github.cottonmc.cotton.gui.widget; -import io.github.cottonmc.cotton.gui.widget.data.Texture; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -12,8 +11,9 @@ import net.minecraft.util.Identifier; import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; +import io.github.cottonmc.cotton.gui.widget.data.Texture; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.function.Consumer; public class WToggleButton extends WWidget { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java index ee9c1e7..42dd6ac 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java @@ -1,23 +1,18 @@ package io.github.cottonmc.cotton.gui.widget; -import java.util.ArrayList; -import java.util.List; - -import com.google.common.annotations.Beta; -import io.github.cottonmc.cotton.gui.GuiDescription; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.OrderedText; -import net.minecraft.text.Text; + +import com.google.common.annotations.Beta; +import io.github.cottonmc.cotton.gui.GuiDescription; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; -import javax.annotation.Nullable; - /** * The base class for all widgets. */ |