From 22c29fea148bdf342e2d74a2d18045ad4378132f Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 20 Apr 2022 23:46:50 +0100 Subject: [PATCH] Replace all accessors with accesswideners. --- RebornCore/build.gradle | 7 +++- .../client/ClientBoundPacketHandlers.java | 5 +-- .../client/gui/builder/GuiBase.java | 4 +- .../gui/builder/slot/SlotConfigGui.java | 10 ++--- .../slot/elements/ConfigSlotElement.java | 2 +- .../reborncore/client/gui/slots/BaseSlot.java | 5 --- .../common/crafting/RecipeUtils.java | 4 +- .../reborncore/common/fluid/FluidUtils.java | 9 ++-- .../common/screen/BuiltScreenHandler.java | 3 +- .../mixin/client/AccessorChatHud.java | 36 ---------------- ...ccessorModelPredicateProviderRegistry.java | 40 ------------------ .../mixin/client/AccessorScreen.java | 14 ------- .../mixin/common/AccessorFluidBlock.java | 37 ---------------- .../common/AccessorFoliagePlacerType.java | 40 ------------------ .../mixin/common/AccessorRecipeManager.java | 42 ------------------- .../mixin/common/AccessorScreenHandler.java | 40 ------------------ .../reborncore/mixin/common/AccessorSlot.java | 36 ---------------- .../main/resources/reborncore.accesswidener | 12 +++++- .../resources/reborncore.client.mixins.json | 5 +-- .../resources/reborncore.common.mixins.json | 5 --- .../java/techreborn/TechRebornClient.java | 5 +-- src/main/resources/techreborn.accesswidener | 24 +++++++++++ 22 files changed, 57 insertions(+), 328 deletions(-) delete mode 100644 RebornCore/src/main/java/reborncore/mixin/client/AccessorChatHud.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/client/AccessorModelPredicateProviderRegistry.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/client/AccessorScreen.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/common/AccessorFluidBlock.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/common/AccessorFoliagePlacerType.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/common/AccessorRecipeManager.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/common/AccessorScreenHandler.java delete mode 100644 RebornCore/src/main/java/reborncore/mixin/common/AccessorSlot.java diff --git a/RebornCore/build.gradle b/RebornCore/build.gradle index a6d4b9298..2f94e2cd8 100644 --- a/RebornCore/build.gradle +++ b/RebornCore/build.gradle @@ -30,4 +30,9 @@ curseforge { options { forgeGradleIntegration = false } -} \ No newline at end of file +} + +def rcAw = file("src/main/resources/reborncore.accesswidener") +def trAw = rootProject.file("src/main/resources/techreborn.accesswidener") + +trAw.text = (rcAw.text + "\n\n# DO NOT EDIT THIS FILE, edit the RebornCore AW, it will automatically be coped to this one.") \ No newline at end of file diff --git a/RebornCore/src/main/java/reborncore/client/ClientBoundPacketHandlers.java b/RebornCore/src/main/java/reborncore/client/ClientBoundPacketHandlers.java index c4491dea6..f26b528ba 100644 --- a/RebornCore/src/main/java/reborncore/client/ClientBoundPacketHandlers.java +++ b/RebornCore/src/main/java/reborncore/client/ClientBoundPacketHandlers.java @@ -49,9 +49,7 @@ import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.SlotConfiguration; import reborncore.common.chunkloading.ChunkLoaderManager; import reborncore.common.network.ExtendedPacketBuffer; -import reborncore.common.network.NetworkManager; import reborncore.common.screen.BuiltScreenHandler; -import reborncore.mixin.client.AccessorChatHud; @Environment(EnvType.CLIENT) public class ClientBoundPacketHandlers { @@ -150,8 +148,7 @@ public class ClientBoundPacketHandlers { client.execute(() -> { int deleteID = RebornCore.MOD_ID.hashCode() + messageId; ChatHud chat = MinecraftClient.getInstance().inGameHud.getChatHud(); - AccessorChatHud accessorChatHud = (AccessorChatHud) chat; - accessorChatHud.invokeAddMessage(text, deleteID); + chat.addMessage(text, deleteID); }); }); diff --git a/RebornCore/src/main/java/reborncore/client/gui/builder/GuiBase.java b/RebornCore/src/main/java/reborncore/client/gui/builder/GuiBase.java index c5bd6fd65..8618467b5 100644 --- a/RebornCore/src/main/java/reborncore/client/gui/builder/GuiBase.java +++ b/RebornCore/src/main/java/reborncore/client/gui/builder/GuiBase.java @@ -57,7 +57,6 @@ import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.common.screen.BuiltScreenHandler; import reborncore.client.screen.builder.slot.PlayerInventorySlot; import reborncore.common.blockentity.MachineBaseBlockEntity; -import reborncore.mixin.client.AccessorScreen; import java.util.ArrayList; import java.util.Collections; @@ -278,8 +277,7 @@ public class GuiBase extends HandledScreen { offset += 24; } - AccessorScreen accessorScreen = (AccessorScreen)this; - for (Selectable selectable : accessorScreen.getSelectables()) { + for (Selectable selectable : selectables) { if (selectable instanceof ClickableWidget clickable) { if (clickable.isHovered()) { clickable.renderTooltip(matrixStack, mouseX, mouseY); diff --git a/RebornCore/src/main/java/reborncore/client/gui/builder/slot/SlotConfigGui.java b/RebornCore/src/main/java/reborncore/client/gui/builder/slot/SlotConfigGui.java index f1cc1e485..151e17d37 100644 --- a/RebornCore/src/main/java/reborncore/client/gui/builder/slot/SlotConfigGui.java +++ b/RebornCore/src/main/java/reborncore/client/gui/builder/slot/SlotConfigGui.java @@ -42,7 +42,6 @@ import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.network.NetworkManager; import reborncore.common.network.ServerBoundPackets; import reborncore.common.util.Color; -import reborncore.mixin.common.AccessorSlot; import java.util.Collections; import java.util.HashMap; @@ -68,9 +67,9 @@ public class SlotConfigGui { if (guiBase.be != slot.inventory) { continue; } - AccessorSlot accessorSlot = (AccessorSlot) slot; - ConfigSlotElement slotElement = new ConfigSlotElement(guiBase.getMachine().getOptionalInventory().get(), accessorSlot.getIndex(), SlotType.NORMAL, slot.x - guiBase.getGuiLeft() + 50, slot.y - guiBase.getGuiTop() - 25, guiBase); - slotElementMap.put(accessorSlot.getIndex(), slotElement); + + ConfigSlotElement slotElement = new ConfigSlotElement(guiBase.getMachine().getOptionalInventory().get(), slot.getIndex(), SlotType.NORMAL, slot.x - guiBase.getGuiLeft() + 50, slot.y - guiBase.getGuiTop() - 25, guiBase); + slotElementMap.put(slot.getIndex(), slotElement); } } @@ -167,8 +166,7 @@ public class SlotConfigGui { continue; } if (guiBase.isPointInRect(slot.x, slot.y, 18, 18, mouseX, mouseY)) { - AccessorSlot accessorSlot = (AccessorSlot) slot; - selectedSlot = accessorSlot.getIndex(); + selectedSlot = slot.getIndex(); return true; } } diff --git a/RebornCore/src/main/java/reborncore/client/gui/builder/slot/elements/ConfigSlotElement.java b/RebornCore/src/main/java/reborncore/client/gui/builder/slot/elements/ConfigSlotElement.java index 3774a8380..4e4ba6e21 100644 --- a/RebornCore/src/main/java/reborncore/client/gui/builder/slot/elements/ConfigSlotElement.java +++ b/RebornCore/src/main/java/reborncore/client/gui/builder/slot/elements/ConfigSlotElement.java @@ -62,7 +62,7 @@ public class ConfigSlotElement extends ElementBase { .filter(slot -> slot.inventory == inventory) .filter(slot -> slot instanceof BaseSlot) .map(slot -> (BaseSlot) slot) - .filter(baseSlot -> baseSlot.getSlotID() == slotId) + .filter(baseSlot -> baseSlot.getIndex() == slotId) .allMatch(BaseSlot::canWorldBlockInsert); diff --git a/RebornCore/src/main/java/reborncore/client/gui/slots/BaseSlot.java b/RebornCore/src/main/java/reborncore/client/gui/slots/BaseSlot.java index 754b1aa6f..814038cae 100644 --- a/RebornCore/src/main/java/reborncore/client/gui/slots/BaseSlot.java +++ b/RebornCore/src/main/java/reborncore/client/gui/slots/BaseSlot.java @@ -27,7 +27,6 @@ package reborncore.client.gui.slots; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; import net.minecraft.screen.slot.Slot; -import reborncore.mixin.common.AccessorSlot; import java.util.function.Predicate; @@ -59,8 +58,4 @@ public class BaseSlot extends Slot { public boolean canWorldBlockInsert() { return true; } - - public int getSlotID() { - return ((AccessorSlot) this).getIndex(); - } } diff --git a/RebornCore/src/main/java/reborncore/common/crafting/RecipeUtils.java b/RebornCore/src/main/java/reborncore/common/crafting/RecipeUtils.java index c4abd7220..c0db47a6e 100644 --- a/RebornCore/src/main/java/reborncore/common/crafting/RecipeUtils.java +++ b/RebornCore/src/main/java/reborncore/common/crafting/RecipeUtils.java @@ -47,7 +47,6 @@ import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; import reborncore.common.util.DefaultedListCollector; import reborncore.common.util.serialization.SerializationUtil; -import reborncore.mixin.common.AccessorRecipeManager; import java.util.Collection; import java.util.List; @@ -56,8 +55,7 @@ import java.util.Objects; public class RecipeUtils { @SuppressWarnings("unchecked") public static List getRecipes(World world, RebornRecipeType type) { - final AccessorRecipeManager accessorRecipeManager = (AccessorRecipeManager) world.getRecipeManager(); - final Collection> recipes = accessorRecipeManager.getAll(type).values().stream().toList(); + final Collection> recipes = world.getRecipeManager().getAllOfType(type).values().stream().toList(); //noinspection unchecked return (List) (Object) recipes; } diff --git a/RebornCore/src/main/java/reborncore/common/fluid/FluidUtils.java b/RebornCore/src/main/java/reborncore/common/fluid/FluidUtils.java index 8020fa7f4..00830ed0b 100644 --- a/RebornCore/src/main/java/reborncore/common/fluid/FluidUtils.java +++ b/RebornCore/src/main/java/reborncore/common/fluid/FluidUtils.java @@ -31,11 +31,11 @@ import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; import net.fabricmc.fabric.api.transfer.v1.storage.Storage; import net.fabricmc.fabric.api.transfer.v1.storage.StorageUtil; -import net.fabricmc.fabric.api.transfer.v1.storage.base.FilteringStorage; import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage; import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; import net.minecraft.block.Block; +import net.minecraft.block.FluidBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; @@ -44,11 +44,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.text.TranslatableText; import net.minecraft.util.Hand; import net.minecraft.util.registry.Registry; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import reborncore.common.fluid.container.FluidInstance; import reborncore.common.util.Tank; -import reborncore.mixin.common.AccessorFluidBlock; import java.util.List; import java.util.function.Predicate; @@ -58,9 +56,10 @@ public class FluidUtils { @NotNull public static Fluid fluidFromBlock(Block block) { - if (block instanceof AccessorFluidBlock) { - return ((AccessorFluidBlock) block).getFluid(); + if (block instanceof FluidBlock fluidBlock) { + return fluidBlock.fluid; } + return Fluids.EMPTY; } diff --git a/RebornCore/src/main/java/reborncore/common/screen/BuiltScreenHandler.java b/RebornCore/src/main/java/reborncore/common/screen/BuiltScreenHandler.java index b8c396761..6a152cb63 100644 --- a/RebornCore/src/main/java/reborncore/common/screen/BuiltScreenHandler.java +++ b/RebornCore/src/main/java/reborncore/common/screen/BuiltScreenHandler.java @@ -43,7 +43,6 @@ import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.network.ClientBoundPackets; import reborncore.common.network.NetworkManager; import reborncore.common.util.ItemUtils; -import reborncore.mixin.common.AccessorScreenHandler; import reborncore.mixin.ifaces.ServerPlayerEntityScreenHandler; import java.util.HashMap; @@ -115,7 +114,7 @@ public class BuiltScreenHandler extends ScreenHandler { public void sendContentUpdates() { super.sendContentUpdates(); - for (final ScreenHandlerListener listener : ((AccessorScreenHandler) (this)).getListeners()) { + for (final ScreenHandlerListener listener : listeners) { sendContentUpdatePacketToListener(listener); } } diff --git a/RebornCore/src/main/java/reborncore/mixin/client/AccessorChatHud.java b/RebornCore/src/main/java/reborncore/mixin/client/AccessorChatHud.java deleted file mode 100644 index 2cd4e06bc..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/client/AccessorChatHud.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.client; - -import net.minecraft.client.gui.hud.ChatHud; -import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(ChatHud.class) -public interface AccessorChatHud { - @Invoker("addMessage") - void invokeAddMessage(Text message, int messageId); -} diff --git a/RebornCore/src/main/java/reborncore/mixin/client/AccessorModelPredicateProviderRegistry.java b/RebornCore/src/main/java/reborncore/mixin/client/AccessorModelPredicateProviderRegistry.java deleted file mode 100644 index 9a651c8be..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/client/AccessorModelPredicateProviderRegistry.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.client; - -import net.minecraft.client.item.ModelPredicateProviderRegistry; -import net.minecraft.client.item.UnclampedModelPredicateProvider; -import net.minecraft.item.Item; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(ModelPredicateProviderRegistry.class) -public interface AccessorModelPredicateProviderRegistry { - @Invoker - static void callRegister(Item item, Identifier id, UnclampedModelPredicateProvider provider) { - throw new RuntimeException("nope"); - } -} diff --git a/RebornCore/src/main/java/reborncore/mixin/client/AccessorScreen.java b/RebornCore/src/main/java/reborncore/mixin/client/AccessorScreen.java deleted file mode 100644 index b384096d2..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/client/AccessorScreen.java +++ /dev/null @@ -1,14 +0,0 @@ -package reborncore.mixin.client; - -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.List; - -@Mixin(Screen.class) -public interface AccessorScreen { - @Accessor - List getSelectables(); -} diff --git a/RebornCore/src/main/java/reborncore/mixin/common/AccessorFluidBlock.java b/RebornCore/src/main/java/reborncore/mixin/common/AccessorFluidBlock.java deleted file mode 100644 index 2bef416cd..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/common/AccessorFluidBlock.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.common; - -import net.minecraft.block.FluidBlock; -import net.minecraft.fluid.FlowableFluid; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(FluidBlock.class) -public interface AccessorFluidBlock { - - @Accessor - FlowableFluid getFluid(); -} diff --git a/RebornCore/src/main/java/reborncore/mixin/common/AccessorFoliagePlacerType.java b/RebornCore/src/main/java/reborncore/mixin/common/AccessorFoliagePlacerType.java deleted file mode 100644 index d4befb6cc..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/common/AccessorFoliagePlacerType.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.common; - -import com.mojang.serialization.Codec; -import net.minecraft.world.gen.foliage.FoliagePlacer; -import net.minecraft.world.gen.foliage.FoliagePlacerType; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(FoliagePlacerType.class) -public interface AccessorFoliagePlacerType { - - @Invoker("register") - static

FoliagePlacerType

register(String id, Codec

codec) { - throw new UnsupportedOperationException(); - } -} diff --git a/RebornCore/src/main/java/reborncore/mixin/common/AccessorRecipeManager.java b/RebornCore/src/main/java/reborncore/mixin/common/AccessorRecipeManager.java deleted file mode 100644 index 06586fc14..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/common/AccessorRecipeManager.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.common; - -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeManager; -import net.minecraft.recipe.RecipeType; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -import java.util.Map; - -@Mixin(RecipeManager.class) -public interface AccessorRecipeManager { - - @Invoker(value = "getAllOfType") - > Map> getAll(RecipeType type); -} diff --git a/RebornCore/src/main/java/reborncore/mixin/common/AccessorScreenHandler.java b/RebornCore/src/main/java/reborncore/mixin/common/AccessorScreenHandler.java deleted file mode 100644 index 36738a8af..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/common/AccessorScreenHandler.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.common; - -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerListener; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.List; - -@Mixin(ScreenHandler.class) -public interface AccessorScreenHandler { - - @Accessor - List getListeners(); - -} diff --git a/RebornCore/src/main/java/reborncore/mixin/common/AccessorSlot.java b/RebornCore/src/main/java/reborncore/mixin/common/AccessorSlot.java deleted file mode 100644 index c51937a54..000000000 --- a/RebornCore/src/main/java/reborncore/mixin/common/AccessorSlot.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of RebornCore, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 TeamReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package reborncore.mixin.common; - -import net.minecraft.screen.slot.Slot; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Slot.class) -public interface AccessorSlot { - - @Accessor - int getIndex(); -} diff --git a/RebornCore/src/main/resources/reborncore.accesswidener b/RebornCore/src/main/resources/reborncore.accesswidener index bfd2fef6d..50f68364c 100644 --- a/RebornCore/src/main/resources/reborncore.accesswidener +++ b/RebornCore/src/main/resources/reborncore.accesswidener @@ -12,4 +12,14 @@ accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/m accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (DD)Lnet/minecraft/screen/slot/Slot; -accessible method net/minecraft/client/render/WorldRenderer drawShapeOutline (Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V \ No newline at end of file +accessible method net/minecraft/client/render/WorldRenderer drawShapeOutline (Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V + +accessible method net/minecraft/world/gen/treedecorator/TreeDecoratorType (Lcom/mojang/serialization/Codec;)V + +accessible method net/minecraft/client/gui/hud/ChatHud addMessage (Lnet/minecraft/text/Text;I)V +accessible method net/minecraft/client/item/ModelPredicateProviderRegistry register (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/item/UnclampedModelPredicateProvider;)V +accessible field net/minecraft/client/gui/screen/Screen selectables Ljava/util/List; +accessible field net/minecraft/block/FluidBlock fluid Lnet/minecraft/fluid/FlowableFluid; +accessible method net/minecraft/world/gen/foliage/FoliagePlacerType register (Ljava/lang/String;Lcom/mojang/serialization/Codec;)Lnet/minecraft/world/gen/foliage/FoliagePlacerType; +accessible method net/minecraft/recipe/RecipeManager getAllOfType (Lnet/minecraft/recipe/RecipeType;)Ljava/util/Map; +accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List; \ No newline at end of file diff --git a/RebornCore/src/main/resources/reborncore.client.mixins.json b/RebornCore/src/main/resources/reborncore.client.mixins.json index bc41afe59..e122a63c5 100644 --- a/RebornCore/src/main/resources/reborncore.client.mixins.json +++ b/RebornCore/src/main/resources/reborncore.client.mixins.json @@ -4,10 +4,7 @@ "compatibilityLevel": "JAVA_17", "client": [ "MixinGameRenderer", - "MixinDebugRenderer", - "AccessorModelPredicateProviderRegistry", - "AccessorChatHud", - "AccessorScreen" + "MixinDebugRenderer" ], "injectors": { "defaultRequire": 1 diff --git a/RebornCore/src/main/resources/reborncore.common.mixins.json b/RebornCore/src/main/resources/reborncore.common.mixins.json index 177583c81..c4a184058 100644 --- a/RebornCore/src/main/resources/reborncore.common.mixins.json +++ b/RebornCore/src/main/resources/reborncore.common.mixins.json @@ -3,11 +3,6 @@ "package": "reborncore.mixin.common", "compatibilityLevel": "JAVA_17", "mixins": [ - "AccessorFluidBlock", - "AccessorFoliagePlacerType", - "AccessorRecipeManager", - "AccessorScreenHandler", - "AccessorSlot", "MixinBucketItem", "MixinCraftingResultSlot", "MixinItemEntity", diff --git a/src/main/java/techreborn/TechRebornClient.java b/src/main/java/techreborn/TechRebornClient.java index 68dd3f71e..215cfff14 100644 --- a/src/main/java/techreborn/TechRebornClient.java +++ b/src/main/java/techreborn/TechRebornClient.java @@ -30,6 +30,7 @@ import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.renderer.v1.RendererAccess; +import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.item.UnclampedModelPredicateProvider; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.model.BakedModel; @@ -53,7 +54,6 @@ import reborncore.client.gui.builder.GuiBase; import reborncore.client.multiblock.MultiblockRenderer; import reborncore.common.powerSystem.RcEnergyItem; import reborncore.common.util.ItemUtils; -import reborncore.mixin.client.AccessorModelPredicateProviderRegistry; import team.reborn.energy.api.base.SimpleBatteryItem; import techreborn.client.ClientGuiType; import techreborn.client.ClientboundPacketHandlers; @@ -72,7 +72,6 @@ import techreborn.items.FrequencyTransmitterItem; import techreborn.items.armor.BatpackItem; import techreborn.items.tool.ChainsawItem; import techreborn.items.tool.industrial.NanosaberItem; -import techreborn.packets.ClientboundPackets; import java.util.Arrays; import java.util.Collection; @@ -251,7 +250,7 @@ public class TechRebornClient implements ClientModInitializer { private static void registerPredicateProvider(Class itemClass, Identifier identifier, ItemModelPredicateProvider modelPredicateProvider) { Registry.ITEM.stream() .filter(item -> item.getClass().isAssignableFrom(itemClass)) - .forEach(item -> AccessorModelPredicateProviderRegistry.callRegister(item, identifier, modelPredicateProvider)); + .forEach(item -> ModelPredicateProviderRegistry.register(item, identifier, modelPredicateProvider)); } //Need the item instance in a few places, this makes it easier diff --git a/src/main/resources/techreborn.accesswidener b/src/main/resources/techreborn.accesswidener index 2e7b9bd8a..6edadbffd 100644 --- a/src/main/resources/techreborn.accesswidener +++ b/src/main/resources/techreborn.accesswidener @@ -1,3 +1,27 @@ accessWidener v2 named +accessible method net/minecraft/recipe/ShapedRecipe readSymbols (Lcom/google/gson/JsonObject;)Ljava/util/Map; +accessible method net/minecraft/recipe/ShapedRecipe getPattern (Lcom/google/gson/JsonArray;)[Ljava/lang/String; +accessible method net/minecraft/recipe/ShapedRecipe createPatternMatrix ([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/util/collection/DefaultedList; + +accessible class net/minecraft/recipe/Ingredient$Entry +accessible class net/minecraft/recipe/Ingredient$TagEntry +accessible class net/minecraft/recipe/Ingredient$StackEntry +accessible field net/minecraft/recipe/Ingredient entries [Lnet/minecraft/recipe/Ingredient$Entry; +accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/tag/TagKey; + +accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (DD)Lnet/minecraft/screen/slot/Slot; + +accessible method net/minecraft/client/render/WorldRenderer drawShapeOutline (Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V + accessible method net/minecraft/world/gen/treedecorator/TreeDecoratorType (Lcom/mojang/serialization/Codec;)V + +accessible method net/minecraft/client/gui/hud/ChatHud addMessage (Lnet/minecraft/text/Text;I)V +accessible method net/minecraft/client/item/ModelPredicateProviderRegistry register (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/item/UnclampedModelPredicateProvider;)V +accessible field net/minecraft/client/gui/screen/Screen selectables Ljava/util/List; +accessible field net/minecraft/block/FluidBlock fluid Lnet/minecraft/fluid/FlowableFluid; +accessible method net/minecraft/world/gen/foliage/FoliagePlacerType register (Ljava/lang/String;Lcom/mojang/serialization/Codec;)Lnet/minecraft/world/gen/foliage/FoliagePlacerType; +accessible method net/minecraft/recipe/RecipeManager getAllOfType (Lnet/minecraft/recipe/RecipeType;)Ljava/util/Map; +accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List; + +# DO NOT EDIT THIS FILE, edit the RebornCore AW, it will automatically be coped to this one. \ No newline at end of file