diff --git a/src/main/java/wily/legacy/init/LegacyUIElementTypes.java b/src/main/java/wily/legacy/init/LegacyUIElementTypes.java index 0fb9333..0ca8038 100644 --- a/src/main/java/wily/legacy/init/LegacyUIElementTypes.java +++ b/src/main/java/wily/legacy/init/LegacyUIElementTypes.java @@ -23,6 +23,7 @@ import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; +import wily.factoryapi.FactoryAPI; import wily.factoryapi.base.ArbitrarySupplier; import wily.factoryapi.base.Bearer; import wily.factoryapi.base.client.FactoryGuiGraphics; @@ -43,7 +44,7 @@ public class LegacyUIElementTypes { private static final Container emptyFakeContainer = new SimpleContainer(); - public static final ResourceLocation ENCHANTING_TABLE_BOOK = ResourceLocation.withDefaultNamespace("textures/entity/enchanting_table_book.png"); + public static final ResourceLocation ENCHANTING_TABLE_BOOK = FactoryAPI.createVanillaLocation("textures/entity/enchanting_table_book.png"); public static final UIDefinitionManager.ElementType PUT_LEGACY_SLOT = UIDefinitionManager.ElementType.registerConditional("put_legacy_slot", UIDefinitionManager.ElementType.createIndexable(slots->(uiDefinition, accessorFunction, elementName, element) -> { UIDefinitionManager.ElementType.parseElement(uiDefinition, elementName, element, "fakeContainer", (s, d)->d.asListOpt(d1->DynamicUtil.getItemFromDynamic(d1, true)).result().map(l-> UIDefinition.createBeforeInit(elementName, (a)-> a.putStaticElement(s,new SimpleContainer(l.stream().map(ArbitrarySupplier::get).toArray(ItemStack[]::new))))).orElse(null)); @@ -179,7 +180,6 @@ public ArbitrarySupplier getIconHolderOverride() { oFlip.set(flip.get()); oOpen.set(open.get()); open.set(open.get() - 0.2F); - Legacy4J.LOGGER.warn("ATA"); open.set(Mth.clamp(open.get(), 0.0F, 1.0F)); float f1 = (flipT.get() - flip.get()) * 0.4F; @@ -205,7 +205,7 @@ public ArbitrarySupplier getIconHolderOverride() { float f5 = Mth.clamp(Mth.frac(f1 + 0.75F) * 1.6F - 0.3F, 0.0F, 1.0F); bookModel.get().setupAnim(0.0F, f4, f5, g); VertexConsumer vertexconsumer = FactoryGuiGraphics.of(guiGraphics).getBufferSource().getBuffer(bookModel.get().renderType(ENCHANTING_TABLE_BOOK)); - bookModel.get().renderToBuffer(guiGraphics.pose(), vertexconsumer, 15728880, OverlayTexture.NO_OVERLAY); + bookModel.get().renderToBuffer(guiGraphics.pose(), vertexconsumer, 15728880, OverlayTexture.NO_OVERLAY/*? <1.20.5 {*//*, 1.0F, 1.0F, 1.0F, 1.0F*//*?}*/); FactoryGuiGraphics.of(guiGraphics).getBufferSource().endBatch(); guiGraphics.flush(); guiGraphics.pose().popPose(); diff --git a/src/main/java/wily/legacy/mixin/base/client/book/BookEditScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/book/BookEditScreenMixin.java index 4c25da9..83d10ea 100644 --- a/src/main/java/wily/legacy/mixin/base/client/book/BookEditScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/book/BookEditScreenMixin.java @@ -1,6 +1,7 @@ package wily.legacy.mixin.base.client.book; import com.mojang.blaze3d.platform.InputConstants; +import net.minecraft.SharedConstants; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.font.TextFieldHelper; diff --git a/src/main/java/wily/legacy/mixin/base/client/bosshealth/BossHealthOverlayMixin.java b/src/main/java/wily/legacy/mixin/base/client/bosshealth/BossHealthOverlayMixin.java index 07499cf..e8a0236 100644 --- a/src/main/java/wily/legacy/mixin/base/client/bosshealth/BossHealthOverlayMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/bosshealth/BossHealthOverlayMixin.java @@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; @@ -23,6 +24,8 @@ import wily.legacy.client.screen.LegacyIconHolder; import wily.legacy.util.ScreenUtil; +import java.util.function.Function; + @Mixin(BossHealthOverlay.class) public abstract class BossHealthOverlayMixin { @Shadow @Final private Minecraft minecraft; diff --git a/src/main/java/wily/legacy/mixin/base/client/brewing/BrewingStandScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/brewing/BrewingStandScreenMixin.java index 3299715..231a938 100644 --- a/src/main/java/wily/legacy/mixin/base/client/brewing/BrewingStandScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/brewing/BrewingStandScreenMixin.java @@ -19,6 +19,8 @@ import wily.factoryapi.base.ArbitrarySupplier; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.factoryapi.base.client.UIAccessor; +import wily.factoryapi.base.client.UIDefinition; +import wily.legacy.inventory.LegacyCraftingMenu; import wily.legacy.inventory.LegacySlotDisplay; import wily.legacy.util.LegacySprites; diff --git a/src/main/java/wily/legacy/mixin/base/client/crafting/CraftingScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/crafting/CraftingScreenMixin.java index f205238..7fbc48d 100644 --- a/src/main/java/wily/legacy/mixin/base/client/crafting/CraftingScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/crafting/CraftingScreenMixin.java @@ -2,6 +2,8 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.navigation.ScreenPosition; +import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.screens.inventory.*; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; import net.minecraft.network.chat.Component; @@ -15,8 +17,10 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.factoryapi.base.client.UIAccessor; +import wily.factoryapi.base.client.UIDefinition; import wily.legacy.client.LegacyOptions; import wily.legacy.inventory.LegacySlotDisplay; import wily.legacy.util.LegacySprites; diff --git a/src/main/java/wily/legacy/mixin/base/client/create_world/CreateWorldScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/create_world/CreateWorldScreenMixin.java index 0852753..3b3b879 100644 --- a/src/main/java/wily/legacy/mixin/base/client/create_world/CreateWorldScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/create_world/CreateWorldScreenMixin.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.storage.LevelStorageSource; import org.apache.commons.io.FileUtils; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -34,6 +35,7 @@ import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; @Mixin(CreateWorldScreen.class) diff --git a/src/main/java/wily/legacy/mixin/base/client/furnace/AbstractFurnaceScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/furnace/AbstractFurnaceScreenMixin.java index 6d6c880..cb0d218 100644 --- a/src/main/java/wily/legacy/mixin/base/client/furnace/AbstractFurnaceScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/furnace/AbstractFurnaceScreenMixin.java @@ -2,6 +2,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.navigation.ScreenPosition; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractFurnaceScreen; //? if <1.21.2 { @@ -22,8 +23,10 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.factoryapi.base.client.UIAccessor; +import wily.factoryapi.base.client.UIDefinition; import wily.legacy.client.CommonColor; import wily.legacy.client.LegacyOptions; import wily.legacy.client.screen.ControlTooltip; diff --git a/src/main/java/wily/legacy/mixin/base/client/gui/GuiMixin.java b/src/main/java/wily/legacy/mixin/base/client/gui/GuiMixin.java index 27ee24a..cbaf584 100644 --- a/src/main/java/wily/legacy/mixin/base/client/gui/GuiMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/gui/GuiMixin.java @@ -3,10 +3,14 @@ import com.google.common.collect.Ordering; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap;import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; +import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import net.minecraft.ChatFormatting; import net.minecraft.Util; -//? if >=1.21 { import net.minecraft.client.AttackIndicatorStatus; +//? if >=1.21 { import net.minecraft.client.DeltaTracker; //?} import net.minecraft.client.Minecraft; @@ -14,9 +18,12 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.MobEffectTextureManager; import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; //? if >1.20.2 { import net.minecraft.network.chat.numbers.NumberFormat; @@ -25,12 +32,14 @@ //?} else { /*import net.minecraft.world.scores.Score; *///?} +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.PlayerRideableJumping; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.Scoreboard; @@ -41,6 +50,7 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import wily.factoryapi.FactoryAPI; @@ -103,7 +113,7 @@ public Object renderCrosshair(OptionInstance instance) { return LegacyConfig.legacyCombat.get() ? AttackIndicatorStatus.OFF : instance.get(); } - @Redirect(method = "renderItemHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/OptionInstance;get()Ljava/lang/Object;")) + @Redirect(method = /*? if >=1.20.5 {*/"renderItemHotbar"/*?} else {*//*"renderHotbar"*//*?}*/, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/OptionInstance;get()Ljava/lang/Object;")) public Object renderItemHotbar(OptionInstance instance) { return LegacyConfig.legacyCombat.get() ? AttackIndicatorStatus.OFF : instance.get(); } diff --git a/src/main/java/wily/legacy/mixin/base/client/gui/SpectatorGuiMixin.java b/src/main/java/wily/legacy/mixin/base/client/gui/SpectatorGuiMixin.java index 26c2836..8053875 100644 --- a/src/main/java/wily/legacy/mixin/base/client/gui/SpectatorGuiMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/gui/SpectatorGuiMixin.java @@ -6,12 +6,14 @@ import net.minecraft.client.gui.components.spectator.SpectatorGui; import net.minecraft.client.gui.spectator.SpectatorMenu; import net.minecraft.client.gui.spectator.categories.SpectatorPage; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import wily.factoryapi.FactoryAPIClient; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.legacy.Legacy4JClient; import wily.legacy.util.LegacySprites; diff --git a/src/main/java/wily/legacy/mixin/base/client/inventory/EffectRenderingInventoryScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/inventory/EffectRenderingInventoryScreenMixin.java index 5820d3f..226dede 100644 --- a/src/main/java/wily/legacy/mixin/base/client/inventory/EffectRenderingInventoryScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/inventory/EffectRenderingInventoryScreenMixin.java @@ -1,6 +1,7 @@ package wily.legacy.mixin.base.client.inventory; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.navigation.ScreenRectangle; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; //? if <1.21.2 { import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; @@ -10,10 +11,13 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import wily.legacy.client.screen.LegacyMenuAccess; import wily.legacy.util.ScreenUtil; @Mixin(/*? if <1.21.2 {*/EffectRenderingInventoryScreen/*?} else {*//*EffectsInInventory*//*?}*/.class) diff --git a/src/main/java/wily/legacy/mixin/base/client/inventory/HorseInventoryScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/inventory/HorseInventoryScreenMixin.java index cd6b1b9..cffa606 100644 --- a/src/main/java/wily/legacy/mixin/base/client/inventory/HorseInventoryScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/inventory/HorseInventoryScreenMixin.java @@ -3,6 +3,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.HorseInventoryScreen; +import net.minecraft.client.gui.screens.inventory.InventoryScreen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; diff --git a/src/main/java/wily/legacy/mixin/base/client/inventory/InventoryScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/inventory/InventoryScreenMixin.java index d2b1983..c363929 100644 --- a/src/main/java/wily/legacy/mixin/base/client/inventory/InventoryScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/inventory/InventoryScreenMixin.java @@ -2,6 +2,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.navigation.ScreenPosition; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.InventoryScreen; @@ -21,6 +22,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.legacy.client.CommonColor; import wily.legacy.client.LegacyOptions; diff --git a/src/main/java/wily/legacy/mixin/base/client/loom/LoomScreenMixin.java b/src/main/java/wily/legacy/mixin/base/client/loom/LoomScreenMixin.java index 6ae632d..8b7d594 100644 --- a/src/main/java/wily/legacy/mixin/base/client/loom/LoomScreenMixin.java +++ b/src/main/java/wily/legacy/mixin/base/client/loom/LoomScreenMixin.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.navigation.ScreenDirection; @@ -28,6 +29,7 @@ import net.minecraft.world.level.block.entity.BannerPatternLayers; //?} import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -37,6 +39,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import wily.factoryapi.base.client.FactoryGuiGraphics; import wily.factoryapi.base.client.UIAccessor; +import wily.factoryapi.base.client.UIDefinition; import wily.legacy.client.screen.LegacyScrollRenderer; import wily.legacy.inventory.LegacySlotDisplay; import wily.legacy.util.LegacySprites; diff --git a/src/main/java/wily/legacy/mixin/base/piston/PistonMovingBlockEntityMixin.java b/src/main/java/wily/legacy/mixin/base/piston/PistonMovingBlockEntityMixin.java index f337dd7..bb1f78d 100644 --- a/src/main/java/wily/legacy/mixin/base/piston/PistonMovingBlockEntityMixin.java +++ b/src/main/java/wily/legacy/mixin/base/piston/PistonMovingBlockEntityMixin.java @@ -1,11 +1,16 @@ package wily.legacy.mixin.base.piston; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;