diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cc4c1b5..2cf0f07 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: [ push ] env: # MINECRAFT_VERSION: 1.20.0 - JAVA_VERSION: 17 + JAVA_VERSION: 21 VERSION: fabric-1.20.2+1.7.2 RELEASE_NAME: SomeOrdinaryTweaks-1.20.2+1.7.1 MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} @@ -32,7 +32,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: "temurin" - java-version: 17 + java-version: 21 - name: Make Gradle Wrapper Executable if: ${{ runner.os != 'Windows' }} @@ -42,7 +42,7 @@ jobs: run: ./gradlew clean build - name: capture build artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Artifacts path: build/libs/ diff --git a/build.gradle b/build.gradle index e31a096..d9779f6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.4-SNAPSHOT' + id 'fabric-loom' version '1.9-SNAPSHOT' //id 'io.github.juuxel.loom-quiltflower' version '1.7.1' id 'maven-publish' } @@ -30,7 +30,7 @@ dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings loom.layered() { officialMojangMappings() - parchment("org.parchmentmc.data:parchment-1.20.2:2023.12.10") + //parchment("org.parchmentmc.data:parchment-1.20.2:2023.12.10") } //mappings(minecraft.officialMojangMappings()) @@ -40,7 +40,7 @@ dependencies { modImplementation 'me.fallenbreath:conditional-mixin:0.4.0' include "me.fallenbreath:conditional-mixin:0.4.0" - modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" + modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}" modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { exclude(group: "net.fabricmc.fabric-api") } } diff --git a/gradle.properties b/gradle.properties index 2d04691..bfcf25f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,13 +2,13 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties - minecraft_version=1.20.4 - loader_version=0.15.1 + minecraft_version=1.21.4 + loader_version=0.16.9 # Mod Properties - mod_version = 1.7.2+1.20.4 + mod_version = 1.7.2+1.21.4 maven_group = io.github.maheevil archives_base_name = some-ordinary-tweaks - modmenu_version = 9.0.0-pre.1 - clothconfig_version = 13.0.114 + modmenu_version = 13.0.0-beta.1 + clothconfig_version = 17.0.142 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db9a6b8..e48eca5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/BlockEntityWithoutLevelRendererMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/BlockEntityWithoutLevelRendererMixin.java index fb522ea..a3ff5cf 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/BlockEntityWithoutLevelRendererMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/BlockEntityWithoutLevelRendererMixin.java @@ -4,32 +4,30 @@ import io.github.maheevil.ordinarytweaks.SomeOrdinaryTweaksMod; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.item.ItemStackRenderState; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.item.*; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(BlockEntityWithoutLevelRenderer.class) +//@Mixin(BlockEntityWithoutLevelRenderer.class) +@Mixin(ItemRenderer.class) public abstract class BlockEntityWithoutLevelRendererMixin { @Inject( - method = "renderByItem", + method = "renderItem", at = @At( - target = "net/minecraft/world/item/BlockItem.getBlockEntityData(Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/nbt/CompoundTag;", - shift = At.Shift.BEFORE, - value = "INVOKE" + value = "HEAD" ), cancellable = true ) - public void renderByItemMixin( - ItemStack itemStack, - ItemDisplayContext itemDisplayContext, - PoseStack poseStack, - MultiBufferSource multiBufferSource, - int i, int j, CallbackInfo ci + private static void renderByItemMixin( + ItemDisplayContext itemDisplayContext, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, int j, int[] is, BakedModel bakedModel, RenderType renderType, ItemStackRenderState.FoilType foilType, CallbackInfo ci ){ /* * ItemDisplayContext.getId()'s first person ids (in decimal) are 3 (left) and 4 (right) diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ClientCommonPacketListenerImplMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ClientCommonPacketListenerImplMixin.java index 8f44703..87334ed 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ClientCommonPacketListenerImplMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ClientCommonPacketListenerImplMixin.java @@ -5,6 +5,8 @@ import me.fallenbreath.conditionalmixin.api.annotation.Restriction; import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; import net.minecraft.network.Connection; +import net.minecraft.network.DisconnectionDetails; +import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket; import net.minecraft.network.protocol.common.ServerboundResourcePackPacket; import org.spongepowered.asm.mixin.Final; @@ -26,6 +28,8 @@ public abstract class ClientCommonPacketListenerImplMixin { @Shadow @Final protected Connection connection; + @Shadow public abstract DisconnectionDetails createDisconnectionInfo(Component component, Throwable throwable); + @Inject( method = "handleResourcePackPush", at = @At( @@ -41,6 +45,7 @@ public abstract class ClientCommonPacketListenerImplMixin { this.connection.send(new ServerboundResourcePackPacket(uUID, ServerboundResourcePackPacket.Action.ACCEPTED)); this.connection.send(new ServerboundResourcePackPacket(uUID, ServerboundResourcePackPacket.Action.DOWNLOADED)); this.connection.send(new ServerboundResourcePackPacket(uUID, ServerboundResourcePackPacket.Action.SUCCESSFULLY_LOADED)); + ci.cancel(); } } } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/DeathScreenMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/DeathScreenMixin.java index 6f4fa4c..56b12a6 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/DeathScreenMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/DeathScreenMixin.java @@ -79,7 +79,7 @@ protected void init(CallbackInfo ci){ ) private void handle(Button button, CallbackInfo ci){ if(SomeOrdinaryTweaksMod.config.sendDeathCords) - this.minecraft.player.sendSystemMessage(Component.literal(lastDeathCord)); + this.minecraft.player.displayClientMessage(Component.literal(lastDeathCord), false); } @Inject( @@ -92,7 +92,7 @@ private void handle(Button button, CallbackInfo ci){ ) private void handleConfirm(boolean bl, CallbackInfo ci){ if(SomeOrdinaryTweaksMod.config.sendDeathCords){ - this.minecraft.player.sendSystemMessage(Component.literal(lastDeathCord)); + this.minecraft.player.displayClientMessage(Component.literal(lastDeathCord), false); } } } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/GuiMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/GuiMixin.java index 81ba1a2..6a1218f 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/GuiMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/GuiMixin.java @@ -21,7 +21,7 @@ @Mixin(Gui.class) @Environment(EnvType.CLIENT) public abstract class GuiMixin { - @Shadow protected abstract int getVisibleVehicleHeartRows(int i); + /**@Shadow protected abstract int getVisibleVehicleHeartRows(int i); @Shadow protected abstract int getVehicleMaxHearts(LivingEntity livingEntity); @Shadow protected abstract LivingEntity getPlayerVehicleWithHealth(); @Shadow private int screenHeight; @@ -96,5 +96,5 @@ private HumanoidArm modifyHumanoidArm(HumanoidArm value){ ) private void inject_scoreboard$ordinarytweaks(GuiGraphics guiGraphics, Objective objective, CallbackInfo ci){ if(SomeOrdinaryTweaksMod.config.disableScoreboard) ci.cancel(); - } + } **/ } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LightTextureMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LightTextureMixin.java index 6fa87b3..a82bf45 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LightTextureMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LightTextureMixin.java @@ -1,13 +1,11 @@ package io.github.maheevil.ordinarytweaks.mixin; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import io.github.maheevil.ordinarytweaks.SomeOrdinaryTweaksMod; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.LightTexture; -import net.minecraft.world.effect.MobEffect; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(LightTexture.class) public abstract class LightTextureMixin { @@ -27,14 +25,9 @@ public float br(float value){ return SomeOrdinaryTweaksMod.config.fullBright ? 100 : value; } - @Redirect( - method = "getDarknessGamma", - at = @At( - value = "INVOKE", - target = "net/minecraft/client/player/LocalPlayer.hasEffect (Lnet/minecraft/world/effect/MobEffect;)Z" - ) - ) - public boolean darknessInject(LocalPlayer instance, MobEffect mobEffect){ - return !SomeOrdinaryTweaksMod.config.fullBright && instance.hasEffect(mobEffect); + @ModifyReturnValue( + method = "getDarknessGamma", at = @At("RETURN")) + public float darknessInject(float original){ + return !SomeOrdinaryTweaksMod.config.fullBright ? original : 0.0F; } } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LocalPlayerMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LocalPlayerMixin.java index 732402b..e06ec60 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LocalPlayerMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/LocalPlayerMixin.java @@ -12,7 +12,7 @@ public abstract class LocalPlayerMixin { @Redirect( - method = "handleNetherPortalClient", + method = "handleConfusionTransitionEffect", at = @At(value = "FIELD", target = "net/minecraft/client/Minecraft.screen:Lnet/minecraft/client/gui/screens/Screen;", ordinal = 0) ) public Screen redirect_isPauseScreen(Minecraft instance) { diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/MultiPlayerGameModeMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/MultiPlayerGameModeMixin.java index e8b7c82..65ab5f4 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/MultiPlayerGameModeMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/MultiPlayerGameModeMixin.java @@ -4,13 +4,20 @@ import net.minecraft.client.multiplayer.MultiPlayerGameMode; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ServerboundUseItemPacket; +import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.flag.FeatureFlag; +import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.FoodOnAStickItem; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.SlabBlock; import net.minecraft.world.level.block.state.BlockState; @@ -28,20 +35,23 @@ public abstract class MultiPlayerGameModeMixin { @Shadow public abstract InteractionResult useItem(Player player, InteractionHand interactionHand); + @Shadow private GameType localPlayerMode; + @Inject( method = "method_41933(Lorg/apache/commons/lang3/mutable/MutableObject;Lnet/minecraft/client/player/LocalPlayer;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;I)Lnet/minecraft/network/protocol/Packet;", at = @At("HEAD"), cancellable = true ) public void beforeInteractionInject$ordinarytweaks( - MutableObject mutableObject, + MutableObject mutableObject, LocalPlayer localPlayer, InteractionHand interactionHand, BlockHitResult blockHitResult, int i, CallbackInfoReturnable> cir ){ - Item itemInHand = localPlayer.getItemInHand(interactionHand).getItem(); + ItemStack itemStackInHand = localPlayer.getItemInHand(interactionHand); + Item itemInHand = itemStackInHand.getItem(); if(itemInHand instanceof BlockItem blockItem){ Level level = localPlayer.clientLevel; @@ -49,7 +59,7 @@ public abstract class MultiPlayerGameModeMixin { if(SomeOrdinaryTweaksMod.config.noDoubleSlabPlacement && blockItem.getBlock() instanceof SlabBlock){ if( - !theBlockGettingHit.use(level,localPlayer, interactionHand, blockHitResult).consumesAction() + !theBlockGettingHit.useItemOn(itemStackInHand,level,localPlayer, interactionHand, blockHitResult).consumesAction() || localPlayer.isSecondaryUseActive() ){ Direction direction = blockHitResult.getDirection(); @@ -66,7 +76,8 @@ public abstract class MultiPlayerGameModeMixin { blockState, relativeBlockState, direction.equals(Direction.UP) ? SlabType.BOTTOM : SlabType.TOP, - direction.equals(Direction.UP) ? SlabType.TOP : SlabType.BOTTOM + direction.equals(Direction.UP) ? SlabType.TOP : SlabType.BOTTOM, + localPlayer.getXRot(), localPlayer.getYRot() ); }else { blockState = level.getBlockState(blockHitResult.getBlockPos().relative(direction)); @@ -74,21 +85,21 @@ public abstract class MultiPlayerGameModeMixin { // this will not prevent none double-slab-block forming placements if(blockState.getBlock() instanceof SlabBlock){ mutableObject.setValue(InteractionResult.FAIL); - cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i)); + cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i, localPlayer.getXRot(), localPlayer.getYRot())); cir.cancel(); } } } } - if(SomeOrdinaryTweaksMod.config.doNotPlantEdiblesIfHungry && blockItem.isEdible()){ + if(SomeOrdinaryTweaksMod.config.doNotPlantEdiblesIfHungry && itemStackInHand.getComponents().has(DataComponents.FOOD)){ if(// !(x XOR y) - theBlockGettingHit.use(level, localPlayer, interactionHand, blockHitResult).consumesAction() + theBlockGettingHit.useItemOn(itemStackInHand, level, localPlayer, interactionHand, blockHitResult).consumesAction() == localPlayer.isSecondaryUseActive() ){ mutableObject.setValue(useItem(localPlayer, interactionHand)); - cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i)); + cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i, localPlayer.getXRot(), localPlayer.getYRot())); cir.cancel(); } @@ -104,7 +115,8 @@ private void handleHittingYAxis( BlockState blockState, BlockState relativeBlockState, SlabType targetSlabTypeRequirement, - SlabType relativeSlabSizeRequirement + SlabType relativeSlabSizeRequirement, + float xrot, float yrot ){ if(// if targeted slab block is a top, placing a block from bellow would form a double slab, and vice versa (blockState.getBlock() instanceof SlabBlock && blockState.getValue(SlabBlock.TYPE).equals(targetSlabTypeRequirement)) @@ -113,7 +125,7 @@ private void handleHittingYAxis( ) { mutableObject.setValue(InteractionResult.FAIL); - cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i)); + cir.setReturnValue(new ServerboundUseItemPacket(interactionHand, i, xrot, yrot)); cir.cancel(); } } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/TextDisplayRendererMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/TextDisplayRendererMixin.java index cb735c2..94e48fb 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/TextDisplayRendererMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/TextDisplayRendererMixin.java @@ -9,7 +9,7 @@ @Mixin(DisplayRenderer.TextDisplayRenderer.class) public class TextDisplayRendererMixin { - @Redirect( + /**@Redirect( method = "renderInner(Lnet/minecraft/world/entity/Display$TextDisplay;Lnet/minecraft/world/entity/Display$TextDisplay$TextRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IF)V", at = @At(value = "INVOKE", target = "net/minecraft/client/Options.getBackgroundOpacity (F)F") ) @@ -22,5 +22,5 @@ public class TextDisplayRendererMixin { case _75_PERCENT -> 0.75F; case _100_PERCENT -> 1.0F; }; - } + } **/ } diff --git a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin.java b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin similarity index 96% rename from src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin.java rename to src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin index 8a6f4d7..4a1cd27 100644 --- a/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin.java +++ b/src/main/java/io/github/maheevil/ordinarytweaks/mixin/ToastComponentMixin @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(ToastComponent.class) +/**@Mixin(ToastComponent.class) public abstract class ToastComponentMixin { @Inject( method = "addToast", diff --git a/src/main/resources/ordinarytweaks.mixins.json b/src/main/resources/ordinarytweaks.mixins.json index 906af91..a3fbf23 100644 --- a/src/main/resources/ordinarytweaks.mixins.json +++ b/src/main/resources/ordinarytweaks.mixins.json @@ -19,7 +19,6 @@ "MultiPlayerGameModeMixin", "SplashManagerMixin", "TextDisplayRendererMixin", - "ToastComponentMixin", "compat.replaymod.ResourcePackRecorderMixin" ], "injectors": {