-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@ModifyConstant => @ModifyExpressionValue for compat & stackablity. F…
- Loading branch information
Showing
11 changed files
with
59 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 7 additions & 9 deletions
16
src/main/java/org/violetmoon/quark/mixin/mixins/ArmorStandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.network.syncher.SynchedEntityData; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.decoration.ArmorStand; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.ArmedArmorStandsModule; | ||
|
||
@Mixin(ArmorStand.class) | ||
public class ArmorStandMixin { | ||
@ModifyConstant(method = "defineSynchedData", constant = @Constant(intValue = 0)) | ||
private int asdasld(int orig) { | ||
@ModifyExpressionValue(method = "defineSynchedData", at = @At(value = "CONSTANT", args = "intValue=0")) | ||
private int quark$armedArmorStands(int original) { | ||
if(!ArmedArmorStandsModule.staticEnabled) | ||
return orig; | ||
return original; | ||
|
||
//try to be careful - this is a kinda scary looking mixin, lol | ||
SynchedEntityData data = ((Entity) (Object) this).getEntityData(); | ||
if(data.hasItem(ArmorStand.DATA_CLIENT_FLAGS)) | ||
return orig; //it's already been defined | ||
return original; //it's already been defined | ||
|
||
else | ||
return orig | ArmorStand.CLIENT_FLAG_SHOW_ARMS; // | 4 | ||
return original | ArmorStand.CLIENT_FLAG_SHOW_ARMS; // | 4 | ||
} | ||
} |
18 changes: 8 additions & 10 deletions
18
src/main/java/org/violetmoon/quark/mixin/mixins/BannerDuplicateRecipeMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.world.item.crafting.BannerDuplicateRecipe; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.MoreBannerLayersModule; | ||
|
||
@Mixin(BannerDuplicateRecipe.class) | ||
public class BannerDuplicateRecipeMixin { | ||
|
||
@ModifyConstant(method = "matches(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/world/level/Level;)Z", constant = @Constant(intValue = 6)) | ||
public int getLimitMatches(int curr) { | ||
return MoreBannerLayersModule.getLimit(curr); | ||
@ModifyExpressionValue(method = "matches(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/world/level/Level;)Z", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
public int getLimitMatches(int original) { | ||
return MoreBannerLayersModule.getLimit(original); | ||
} | ||
|
||
@ModifyConstant(method = "assemble(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/core/RegistryAccess;)Lnet/minecraft/world/item/ItemStack;", constant = @Constant(intValue = 6)) | ||
public int getLimitAssemble(int curr) { | ||
return MoreBannerLayersModule.getLimit(curr); | ||
@ModifyExpressionValue(method = "assemble(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/core/RegistryAccess;)Lnet/minecraft/world/item/ItemStack;", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
public int getLimitAssemble(int original) { | ||
return MoreBannerLayersModule.getLimit(original); | ||
} | ||
|
||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/violetmoon/quark/mixin/mixins/BeaconBlockEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.entity.BeaconBlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tools.module.BeaconRedirectionModule; | ||
|
||
@Mixin(BeaconBlockEntity.class) | ||
public class BeaconBlockEntityMixin { | ||
|
||
// This captures the for loop inside tick that computes the beacon segments | ||
@ModifyConstant(method = "tick", constant = @Constant(intValue = 0, ordinal = 0)) | ||
private static int tick(int val, Level level, BlockPos pos, BlockState state, BeaconBlockEntity beacon) { | ||
return BeaconRedirectionModule.tickBeacon(beacon); | ||
@ModifyExpressionValue(method = "tick", at = @At(value = "CONSTANT", args = "intValue=0", ordinal = 0)) | ||
private static int tick(int original, Level level, BlockPos pos, BlockState state, BeaconBlockEntity beacon) { | ||
return BeaconRedirectionModule.tickBeacon(beacon, original); | ||
} | ||
|
||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/violetmoon/quark/mixin/mixins/LoomMenuMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.world.inventory.LoomMenu; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.MoreBannerLayersModule; | ||
|
||
@Mixin(LoomMenu.class) | ||
public class LoomMenuMixin { | ||
|
||
@ModifyConstant(method = "slotsChanged", constant = @Constant(intValue = 6)) | ||
public int getLimit(int curr) { | ||
return MoreBannerLayersModule.getLimit(curr); | ||
@ModifyExpressionValue(method = "slotsChanged", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
public int getLimit(int original) { | ||
return MoreBannerLayersModule.getLimit(original); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 8 additions & 10 deletions
18
src/main/java/org/violetmoon/quark/mixin/mixins/SpongeBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.world.level.block.SpongeBlock; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.ImprovedSpongesModule; | ||
|
||
@Mixin(SpongeBlock.class) | ||
public class SpongeBlockMixin { | ||
|
||
@ModifyConstant(method = "removeWaterBreadthFirstSearch", constant = @Constant(intValue = 65)) | ||
public int getDrainLimit(int limit) { | ||
return ImprovedSpongesModule.drainLimit(limit); | ||
@ModifyExpressionValue(method = "removeWaterBreadthFirstSearch", at = @At(value = "CONSTANT", args = "intValue=65")) | ||
public int getDrainLimit(int original) { | ||
return ImprovedSpongesModule.drainLimit(original); | ||
} | ||
|
||
@ModifyConstant(method = "removeWaterBreadthFirstSearch", constant = @Constant(intValue = 6)) | ||
public int getCrawlLimit(int limit) { | ||
return ImprovedSpongesModule.crawlLimit(limit); | ||
@ModifyExpressionValue(method = "removeWaterBreadthFirstSearch", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
public int getCrawlLimit(int original) { | ||
return ImprovedSpongesModule.crawlLimit(original); | ||
} | ||
|
||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/violetmoon/quark/mixin/mixins/client/BannerItemMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.violetmoon.quark.mixin.mixins.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.world.item.BannerItem; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.MoreBannerLayersModule; | ||
|
||
@Mixin(BannerItem.class) | ||
public class BannerItemMixin { | ||
|
||
@ModifyConstant(method = "appendHoverTextFromBannerBlockEntityTag", constant = @Constant(intValue = 6)) | ||
private static int getLimit(int curr) { | ||
return MoreBannerLayersModule.getLimit(curr); | ||
@ModifyExpressionValue(method = "appendHoverTextFromBannerBlockEntityTag", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
private static int getLimit(int original) { | ||
return MoreBannerLayersModule.getLimit(original); | ||
} | ||
|
||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/violetmoon/quark/mixin/mixins/client/ForgeGuiMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package org.violetmoon.quark.mixin.mixins.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraftforge.client.gui.overlay.ForgeGui; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.base.Quark; | ||
import org.violetmoon.quark.content.client.module.ElytraIndicatorModule; | ||
|
||
@Mixin(ForgeGui.class) | ||
public class ForgeGuiMixin { | ||
|
||
@ModifyConstant(method = "renderArmor", constant = @Constant(intValue = 20), remap = false) | ||
private static int renderArmor(int curr) { | ||
@ModifyExpressionValue(method = "renderArmor", at = @At(value = "CONSTANT", args = "intValue=20"), remap = false) | ||
private static int renderArmor(int original) { | ||
ElytraIndicatorModule module = Quark.ZETA.modules.get(ElytraIndicatorModule.class); | ||
return module == null ? curr : module.getArmorLimit(curr); | ||
return module == null ? original : module.getArmorLimit(original); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
src/main/java/org/violetmoon/quark/mixin/mixins/client/LoomScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.violetmoon.quark.mixin.mixins.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.minecraft.client.gui.screens.inventory.LoomScreen; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.tweaks.module.MoreBannerLayersModule; | ||
|
||
@Mixin(LoomScreen.class) | ||
public class LoomScreenMixin { | ||
|
||
@ModifyConstant(method = "containerChanged", constant = @Constant(intValue = 6)) | ||
private static int getLimit(int curr) { | ||
return MoreBannerLayersModule.getLimit(curr); | ||
@ModifyExpressionValue(method = "containerChanged", at = @At(value = "CONSTANT", args = "intValue=6")) | ||
private static int getLimit(int original) { | ||
return MoreBannerLayersModule.getLimit(original); | ||
} | ||
|
||
} |