diff options
| author | shedaniel <daniel@shedaniel.me> | 2024-06-17 00:07:02 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-06-17 00:07:02 +0900 |
| commit | 667c7993dcea8b09bdffcad9956b353f054ad6e2 (patch) | |
| tree | a8952cd4dd6465919805f159dee66434dc008e22 /runtime/src/main | |
| parent | de36cf8cbce35d6fc5f879651c057fa143e72d89 (diff) | |
| download | RoughlyEnoughItems-667c7993dcea8b09bdffcad9956b353f054ad6e2.tar.gz RoughlyEnoughItems-667c7993dcea8b09bdffcad9956b353f054ad6e2.tar.bz2 RoughlyEnoughItems-667c7993dcea8b09bdffcad9956b353f054ad6e2.zip | |
Update to 1.21
Diffstat (limited to 'runtime/src/main')
51 files changed, 227 insertions, 278 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 8d748f704..f25e40735 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -148,7 +148,7 @@ public class RoughlyEnoughItemsCoreClient { ClientInternals.attachInstance((BiFunction<Supplier<DataResult<FavoriteEntry>>, Supplier<CompoundTag>, FavoriteEntry>) DelegatingFavoriteEntryProviderImpl::new, "delegateFavoriteEntry"); ClientInternals.attachInstance((Function<CompoundTag, DataResult<FavoriteEntry>>) (object) -> { String type = object.getString(FavoriteEntry.TYPE_KEY); - ResourceLocation id = new ResourceLocation(type); + ResourceLocation id = ResourceLocation.parse(type); FavoriteEntryType<FavoriteEntry> entryType = FavoriteEntryType.registry().get(id); if (entryType == null) return DataResult.error(() -> "Unknown favorite type: " + id + ", json: " + object); return entryType.read(object); @@ -314,7 +314,7 @@ public class RoughlyEnoughItemsCoreClient { private void registerEvents() { Minecraft client = Minecraft.getInstance(); - final ResourceLocation recipeButtonTex = new ResourceLocation("textures/gui/recipe_button.png"); + final ResourceLocation recipeButtonTex = ResourceLocation.withDefaultNamespace("textures/gui/recipe_button.png"); MutableLong startReload = new MutableLong(-1); MutableLong endReload = new MutableLong(-1); PRE_UPDATE_RECIPES.register(recipeManager -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java index 71c49dca9..399850cf2 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java @@ -60,14 +60,14 @@ import java.util.List; import java.util.Map; public class RoughlyEnoughItemsNetwork { - public static final ResourceLocation DELETE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "delete_item"); - public static final ResourceLocation CREATE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "create_item"); - public static final ResourceLocation CREATE_ITEMS_HOTBAR_PACKET = new ResourceLocation("roughlyenoughitems", "create_item_hotbar"); - public static final ResourceLocation CREATE_ITEMS_GRAB_PACKET = new ResourceLocation("roughlyenoughitems", "create_item_grab"); - public static final ResourceLocation CREATE_ITEMS_MESSAGE_PACKET = new ResourceLocation("roughlyenoughitems", "ci_msg"); - public static final ResourceLocation MOVE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "move_items"); - public static final ResourceLocation MOVE_ITEMS_NEW_PACKET = new ResourceLocation("roughlyenoughitems", "move_items_new"); - public static final ResourceLocation NOT_ENOUGH_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "og_not_enough"); + public static final ResourceLocation DELETE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "delete_item"); + public static final ResourceLocation CREATE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item"); + public static final ResourceLocation CREATE_ITEMS_HOTBAR_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item_hotbar"); + public static final ResourceLocation CREATE_ITEMS_GRAB_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item_grab"); + public static final ResourceLocation CREATE_ITEMS_MESSAGE_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "ci_msg"); + public static final ResourceLocation MOVE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "move_items"); + public static final ResourceLocation MOVE_ITEMS_NEW_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "move_items_new"); + public static final ResourceLocation NOT_ENOUGH_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "og_not_enough"); public static void onInitialize() { NetworkManager.registerReceiver(NetworkManager.c2s(), DELETE_ITEMS_PACKET, Collections.singletonList(new SplitPacketTransformer()), (buf, context) -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java index fad1fdf6c..33eccf0ab 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java @@ -64,8 +64,8 @@ import static me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget. @ApiStatus.Internal @Environment(EnvType.CLIENT) public class REIRuntimeImpl implements REIRuntime { - private static final ResourceLocation DISPLAY_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/display.png"); - private static final ResourceLocation DISPLAY_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/display_dark.png"); + private static final ResourceLocation DISPLAY_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/display.png"); + private static final ResourceLocation DISPLAY_TEXTURE_DARK = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/display_dark.png"); @ApiStatus.Internal public static boolean isWithinRecipeViewingScreen = false; private ScreenOverlayImpl overlay; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java index 61f94a829..af3720cec 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java @@ -87,7 +87,7 @@ public class ConfigManagerImpl implements ConfigManager { return new JsonPrimitive(location == null ? null : location.toString()); }); builder.registerDeserializer(String.class, ResourceLocation.class, (value, marshaller) -> { - return value == null ? null : new ResourceLocation(value); + return value == null ? null : ResourceLocation.parse(value); }); // CheatingMode diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java index 1a7781111..ebe6ee330 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java @@ -82,7 +82,7 @@ public class CollapsibleConfigManager { } public static final class CustomGroup { - public ResourceLocation id = new ResourceLocation("missingno"); + public ResourceLocation id = ResourceLocation.withDefaultNamespace("missingno"); public String name = "Invalid"; public List<EntryStackProvider<?>> stacks = new ArrayList<>(); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java index 7b4886390..0d3db41b0 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java @@ -26,10 +26,7 @@ package me.shedaniel.rei.impl.client.config.entries; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; @@ -253,17 +250,16 @@ public class FilteringScreen extends Screen { ScissorsHandler.INSTANCE.removeLastScissor(); Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder buffer = tesselator.getBuilder(); + BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = graphics.pose().last().pose(); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - buffer.vertex(matrix, 0, bounds.y + 4, 0.0F).uv(0.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y + 4, 0.0F).uv(1.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y, 0.0F).uv(1.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - buffer.vertex(matrix, 0, bounds.y, 0.0F).uv(0.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - tesselator.end(); + buffer.addVertex(matrix, 0, bounds.y + 4, 0.0F).setUv(0.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y + 4, 0.0F).setUv(1.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y, 0.0F).setUv(1.0F, 0.0F).setColor(0, 0, 0, 255); + buffer.addVertex(matrix, 0, bounds.y, 0.0F).setUv(0.0F, 0.0F).setColor(0, 0, 0, 255); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableBlend(); this.backButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java index befadebc2..9ceee11c9 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java @@ -42,9 +42,9 @@ public class FilteringRuleTypeRegistryImpl extends AbstractList<FilteringRuleTyp private final BiMap<ResourceLocation, FilteringRuleType<?>> types = HashBiMap.create(); public FilteringRuleTypeRegistryImpl() { - register(new ResourceLocation("roughlyenoughitems", "search"), SearchFilteringRuleType.INSTANCE); - register(new ResourceLocation("roughlyenoughitems", "manual"), ManualFilteringRuleType.INSTANCE); - register(new ResourceLocation("roughlyenoughitems", "basic"), BasicFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "search"), SearchFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "manual"), ManualFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "basic"), BasicFilteringRuleType.INSTANCE); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java index 58636bb9e..96e5b4eac 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java @@ -26,12 +26,12 @@ package me.shedaniel.rei.impl.client.gui; import net.minecraft.resources.ResourceLocation; public class InternalTextures { - public static final ResourceLocation ARROW_LEFT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left.png"); - public static final ResourceLocation ARROW_RIGHT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right.png"); - public static final ResourceLocation ARROW_LEFT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left_small.png"); - public static final ResourceLocation ARROW_RIGHT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right_small.png"); - public static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png"); - public static final ResourceLocation CHEST_GUI_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer_dark.png"); + public static final ResourceLocation ARROW_LEFT_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_left.png"); + public static final ResourceLocation ARROW_RIGHT_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_right.png"); + public static final ResourceLocation ARROW_LEFT_SMALL_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_left_small.png"); + public static final ResourceLocation ARROW_RIGHT_SMALL_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_right_small.png"); + public static final ResourceLocation CHEST_GUI_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/recipecontainer.png"); + public static final ResourceLocation CHEST_GUI_TEXTURE_DARK = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/recipecontainer_dark.png"); @Deprecated(forRemoval = true) - public static final ResourceLocation LEGACY_DIRT = new ResourceLocation("textures/block/dirt.png"); + public static final ResourceLocation LEGACY_DIRT = ResourceLocation.withDefaultNamespace("textures/block/dirt.png"); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java index a469a95b5..1e2a67292 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java @@ -114,7 +114,7 @@ public class ConfigOptionValueWidget { return Widgets.concatWithBounds(() -> new Rectangle(-label.getBounds().width, 0, label.getBounds().width + 8, 14), label, Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> matrix[0] = graphics.pose().last().pose()), - Widgets.withTranslate(Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/selector.png"), + Widgets.withTranslate(Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/selector.png"), new Rectangle(1, 1, 4, 6), 0, 0, 1, 1, 1, 1), 0, 0.5, 0) ); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java index f910d88e0..40986fc47 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java @@ -85,7 +85,7 @@ public class ConfigSearchWidget { } }, Widgets.withTranslate(label, 0, 0.5, 0), - Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/search_options.png"), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) + Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/search_options.png"), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } @@ -126,7 +126,7 @@ public class ConfigSearchWidget { return false; } }, - Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/search_options.png"), bounds, 0, 0, 1, 1, 1, 1) + Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/search_options.png"), bounds, 0, 0, 1, 1, 1, 1) ), translatable("config.rei.texts.search_options")); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java index 40e94ae10..9f2b659d1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java @@ -33,7 +33,7 @@ import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.transl public interface AllREIConfigCategories { static OptionCategory make(String key) { - return OptionCategory.of(key, new ResourceLocation("roughlyenoughitems:textures/gui/config/" + key + ".png"), + return OptionCategory.of(key, ResourceLocation.parse("roughlyenoughitems:textures/gui/config/" + key + ".png"), translatable("config.rei.categories." + key), translatable("config.rei.categories." + key + ".desc")); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java index cfe3386aa..c1234fe9d 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java @@ -79,9 +79,8 @@ public class TooltipPreviewer { graphics.pose().translate(0, 0, -400); Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = tesselator.getBuilder(); RenderSystem.setShader(GameRenderer::getPositionColorShader); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); + Bu |
