-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: addiction & boat magnet traits
refactor: refactor server storage system refactor: change tick inject into PlayerEntity format BREAKING CHANGE: save file format change
- Loading branch information
Showing
6 changed files
with
181 additions
and
67 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
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
84 changes: 55 additions & 29 deletions
84
src/main/java/net/sigmarik/abilitymod/mixin/PlayerEntityMixin.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
33 changes: 33 additions & 0 deletions
33
src/main/java/net/sigmarik/abilitymod/mixin/PotionItemMixin.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.sigmarik.abilitymod.mixin; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.PotionItem; | ||
import net.minecraft.potion.PotionUtil; | ||
import net.minecraft.potion.Potions; | ||
import net.minecraft.world.World; | ||
import net.sigmarik.abilitymod.AbilityMod; | ||
import net.sigmarik.abilitymod.util.ServerState; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(PotionItem.class) | ||
public abstract class PotionItemMixin extends Item { | ||
|
||
public PotionItemMixin(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Inject(method = "finishUsing", at = @At("HEAD")) | ||
private void traitedFinishUsing(ItemStack stack, World world, LivingEntity user, CallbackInfoReturnable<ItemStack> cir) { | ||
if (user instanceof PlayerEntity && PotionUtil.getPotion(stack) == Potions.THICK && | ||
ServerState.hasTrait((PlayerEntity)user, AbilityMod.TRAIT_ADDICTION) && | ||
ServerState.getAddictionTimer((PlayerEntity)user) < AbilityMod.ADDICTION_MID_TIMER) { | ||
ServerState.setAddictionTimer((PlayerEntity)user, AbilityMod.ADDICTION_MID_TIMER); | ||
} | ||
} | ||
} |
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
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