-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
991 additions
and
43 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
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
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
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
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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/org/mesdag/advjs/mixin/AdvancementRewardsMixin.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,35 @@ | ||
package org.mesdag.advjs.mixin; | ||
|
||
import dev.latvian.mods.rhino.util.HideFromJS; | ||
import net.minecraft.advancement.AdvancementRewards; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.mesdag.advjs.util.RewardsAccessor; | ||
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(AdvancementRewards.class) | ||
public abstract class AdvancementRewardsMixin implements RewardsAccessor { | ||
@Nullable | ||
private StatusEffectInstance[] advJS$mobEffectInstances = null; | ||
|
||
@Override | ||
@HideFromJS | ||
public void advJS$setMobEffectInstances(StatusEffectInstance[] mobEffectInstances) { | ||
advJS$mobEffectInstances = mobEffectInstances; | ||
} | ||
|
||
@Inject(method = "apply", at = @At("HEAD")) | ||
private void advJS$grant(ServerPlayerEntity serverPlayer, CallbackInfo ci) { | ||
if (advJS$mobEffectInstances != null) { | ||
for (StatusEffectInstance mobEffectInstance : advJS$mobEffectInstances) { | ||
if (mobEffectInstance != null) { | ||
serverPlayer.addStatusEffect(mobEffectInstance); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.