Skip to content

Commit fb1063e

Browse files
committed
disable curative items and soulbound duping
1 parent 36d1423 commit fb1063e

7 files changed

Lines changed: 90 additions & 1 deletion

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ loom.platform = forge
44
org.gradle.vfs.watch=true
55

66
# Mod properties
7-
mod_version = 1.11-pre1
7+
mod_version = 1.11-pre2
88
maven_group = cc.cassian.raspberry
99
archives_name = raspberry_core
1010

src/main/java/cc/cassian/raspberry/config/ModConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class ModConfig {
6767
public boolean betterJukeboxes = true;
6868
public double jukeboxDistance = 64.0;
6969
public boolean disablePenguinShedding = false;
70+
public boolean disableCurativeItems = true;
7071
public double creeperSporesDurationModifier = 1.0;
7172

7273
public static void load() {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cc.cassian.raspberry.mixin.buzzier_bees;
2+
3+
import cc.cassian.raspberry.config.ModConfig;
4+
import com.teamabnormals.blueprint.common.advancement.EmptyTrigger;
5+
import com.teamabnormals.buzzier_bees.common.item.CuringItem;
6+
import net.minecraft.world.entity.LivingEntity;
7+
import net.minecraft.world.item.ItemStack;
8+
import net.minecraft.world.level.Level;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
14+
@Mixin(CuringItem.class)
15+
public class CuringItemMixin {
16+
@Inject(
17+
method = "finishUsingItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;awardStat(Lnet/minecraft/stats/Stat;)V"), cancellable = true)
18+
public void raspberry$disableCuring(ItemStack stack, Level worldIn, LivingEntity entityLiving, CallbackInfoReturnable<ItemStack> cir) {
19+
if (ModConfig.get().disableCurativeItems)
20+
cir.setReturnValue(stack);
21+
}
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package cc.cassian.raspberry.mixin.ensorcellation;
2+
3+
import cofh.ensorcellation.event.SoulboundEvents;
4+
import net.minecraftforge.event.entity.player.PlayerEvent;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
9+
10+
@Mixin(SoulboundEvents.class)
11+
public class SoulboundEventsMixin {
12+
@Inject(
13+
method = "handlePlayerCloneEvent", remap = false, at = @At(value = "HEAD"), cancellable = true)
14+
private static void raspberry$disableCuring(PlayerEvent.Clone event, CallbackInfo ci) {
15+
ci.cancel();
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cc.cassian.raspberry.mixin.farmersdelight;
2+
3+
import cc.cassian.raspberry.config.ModConfig;
4+
import net.minecraft.world.entity.LivingEntity;
5+
import net.minecraft.world.item.HoneyBottleItem;
6+
import net.minecraft.world.item.ItemStack;
7+
import net.minecraft.world.level.Level;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
import vectorwing.farmersdelight.common.item.HotCocoaItem;
14+
15+
@Mixin(HotCocoaItem.class)
16+
public class HotCocoaItemMixin {
17+
@Inject(
18+
method = "affectConsumer", remap = false, at = @At(value = "HEAD"), cancellable = true)
19+
public void raspberry$disableCuring(ItemStack stack, Level level, LivingEntity consumer, CallbackInfo ci) {
20+
if (ModConfig.get().disableCurativeItems)
21+
ci.cancel();
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cc.cassian.raspberry.mixin.minecraft;
2+
3+
import cc.cassian.raspberry.config.ModConfig;
4+
import com.teamabnormals.buzzier_bees.common.item.CuringItem;
5+
import net.minecraft.world.entity.LivingEntity;
6+
import net.minecraft.world.item.HoneyBottleItem;
7+
import net.minecraft.world.item.ItemStack;
8+
import net.minecraft.world.level.Level;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
14+
@Mixin(HoneyBottleItem.class)
15+
public class HoneyBottleMixin {
16+
@Inject(
17+
method = "finishUsingItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;awardStat(Lnet/minecraft/stats/Stat;)V"), cancellable = true)
18+
public void raspberry$disableCuring(ItemStack stack, Level worldIn, LivingEntity entityLiving, CallbackInfoReturnable<ItemStack> cir) {
19+
if (ModConfig.get().disableCurativeItems)
20+
cir.setReturnValue(stack);
21+
}
22+
}

src/main/resources/raspberry.mixins.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"blueprint.WoodPostBlockMixin",
3939
"brewinandchewin.KegBlockEntityMixin",
4040
"brewinandchewin.KegRecipeMixin",
41+
"buzzier_bees.CuringItemMixin",
4142
"caverns_and_chasms.BluntArrowMixin",
4243
"caverns_and_chasms.BowItemMixin",
4344
"caverns_and_chasms.BrazierBlockMixin",
@@ -63,6 +64,7 @@
6364
"emi.EmiRecipesMixin",
6465
"endergetic.EnderWallTorchMixin",
6566
"endermanoverhaul.ReplacedEndermanMixin",
67+
"ensorcellation.SoulboundEventsMixin",
6668
"environmental.AbstractSkeletonMixin",
6769
"environmental.ArmorItemMixin",
6870
"environmental.MobMixin",
@@ -75,6 +77,7 @@
7577
"farmersdelight.BlockEntityTypeMixin",
7678
"farmersdelight.FarmBlockMixin",
7779
"farmersdelight.FlintAndSteelMixin",
80+
"farmersdelight.HotCocoaItemMixin",
7881
"farmersdelight.NetherStoveBlockMixin",
7982
"farmersdelight.RichSoilFarmlandBlockMixin",
8083
"farmersdelight.StoveBlockMixin",
@@ -95,6 +98,7 @@
9598
"minecraft.GhastShootFireballGoalMixin",
9699
"minecraft.HasteHandMixin",
97100
"minecraft.HasteIsGoodMixin",
101+
"minecraft.HoneyBottleMixin",
98102
"minecraft.ItemMixin",
99103
"minecraft.ItemStackMixin",
100104
"minecraft.LeadItemMixin",

0 commit comments

Comments
 (0)