diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-05-19 20:40:47 +0300 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-05-19 20:40:47 +0300 |
commit | c4d292e7e5000ba8fb226d6f62c3ac5f18c11fa8 (patch) | |
tree | b2dbd371dee2dba647e57664d96c27d7a06fb640 /src | |
parent | b869afcefbc4598e1f9d72409bbc08d76ef4477e (diff) | |
download | LibGui-c4d292e7e5000ba8fb226d6f62c3ac5f18c11fa8.tar.gz LibGui-c4d292e7e5000ba8fb226d6f62c3ac5f18c11fa8.tar.bz2 LibGui-c4d292e7e5000ba8fb226d6f62c3ac5f18c11fa8.zip |
Update to 1.19-pre1
- API change: WItem now uses TagKey instead of Tag.
Diffstat (limited to 'src')
3 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java index f436819..4fcb3f2 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java @@ -146,8 +146,7 @@ public class ScreenDrawing { buffer.vertex(model, x + width, y + height, 0).texture(u2, v2).next(); buffer.vertex(model, x + width, y, 0).texture(u2, v1).next(); buffer.vertex(model, x, y, 0).texture(u1, v1).next(); - buffer.end(); - BufferRenderer.method_43433(buffer); + BufferRenderer.drawWithShader(buffer.end()); RenderSystem.disableBlend(); } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java index 21abe8b..178f6c5 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java @@ -9,7 +9,9 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.Item; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; -import net.minecraft.tag.Tag; +import net.minecraft.tag.TagKey; +import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.RegistryEntry; import com.google.common.collect.ImmutableList; @@ -32,7 +34,7 @@ public class WItem extends WWidget { setItems(items); } - public WItem(Tag<? extends ItemConvertible> tag) { + public WItem(TagKey<? extends ItemConvertible> tag) { this(getRenderStacks(tag)); } @@ -104,13 +106,15 @@ public class WItem extends WWidget { } /** - * Gets the render stacks ({@link Item#getStackForRender()}) of each item in a tag. + * Gets the default stacks ({@link Item#getDefaultStack()} ()}) of each item in a tag. */ - private static List<ItemStack> getRenderStacks(Tag<? extends ItemConvertible> tag) { + @SuppressWarnings("unchecked") + private static List<ItemStack> getRenderStacks(TagKey<? extends ItemConvertible> tag) { + Registry<ItemConvertible> registry = (Registry<ItemConvertible>) Registry.REGISTRIES.get(tag.registry().getValue()); ImmutableList.Builder<ItemStack> builder = ImmutableList.builder(); - for (ItemConvertible item : tag.values()) { - builder.add(new ItemStack(item)); + for (RegistryEntry<ItemConvertible> item : registry.getOrCreateEntryList((TagKey<ItemConvertible>) tag)) { + builder.add(item.value().asItem().getDefaultStack()); } return builder.build(); 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 f92107e..69c8755 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 @@ -261,8 +261,7 @@ public class WTextField extends WWidget { buffer.vertex(model, x + width, y + height, 0).next(); buffer.vertex(model, x + width, y, 0).next(); buffer.vertex(model, x, y, 0).next(); - buffer.end(); - BufferRenderer.method_43433(buffer); + BufferRenderer.drawWithShader(buffer.end()); RenderSystem.disableColorLogicOp(); RenderSystem.enableTexture(); } |