Compare commits
No commits in common. "a12936a827682fdeb287ba62eb353269fc56a282" and "0ddfdc5214948a8643416f1b7731b8047c825551" have entirely different histories.
a12936a827
...
0ddfdc5214
|
|
@ -1,57 +0,0 @@
|
||||||
package xyz.nearmisses.patience.mc_rebalance.mixin;
|
|
||||||
|
|
||||||
import net.minecraft.core.Holder;
|
|
||||||
import net.minecraft.world.effect.MobEffect;
|
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.monster.AbstractSkeleton;
|
|
||||||
import net.minecraft.world.entity.monster.WitherSkeleton;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.Items;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mixin(WitherSkeleton.class)
|
|
||||||
public abstract class WitherSkeletonRework extends AbstractSkeleton {
|
|
||||||
|
|
||||||
protected WitherSkeletonRework(EntityType<? extends AbstractSkeleton> entityType, Level level) {
|
|
||||||
super(entityType, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "doHurtTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;addEffect(Lnet/minecraft/world/effect/MobEffectInstance;Lnet/minecraft/world/entity/Entity;)Z"))
|
|
||||||
public boolean doHurtTarget(LivingEntity instance, MobEffectInstance mobEffectInstance, Entity entity) {
|
|
||||||
Map<Holder<MobEffect>, MobEffectInstance> effectsMap = instance.getActiveEffectsMap();
|
|
||||||
|
|
||||||
if (effectsMap.containsKey(MobEffects.WITHER)) {
|
|
||||||
int amp = effectsMap.get(MobEffects.WITHER).getAmplifier();
|
|
||||||
if (this.getMainHandItem().is(Items.STONE_SWORD)) {
|
|
||||||
instance.addEffect(new MobEffectInstance(MobEffects.WITHER, 180, amp+1), this);
|
|
||||||
if(amp+1>2){
|
|
||||||
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.STONE_HOE));
|
|
||||||
}
|
|
||||||
} else { // If on hoe, collapse wither effect
|
|
||||||
int duration = effectsMap.get(MobEffects.WITHER).getDuration();
|
|
||||||
int dmgCount = 0;
|
|
||||||
int durationToDmg = 40 >> amp;
|
|
||||||
while(duration>0){ // There is definitely a better way to do this, I'll come back to it later
|
|
||||||
if(durationToDmg == 0 || duration % durationToDmg == 0) {dmgCount++;}
|
|
||||||
duration--;
|
|
||||||
}
|
|
||||||
instance.removeEffect(MobEffects.WITHER);
|
|
||||||
instance.hurt(instance.damageSources().wither(), dmgCount);
|
|
||||||
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.STONE_SWORD));
|
|
||||||
}
|
|
||||||
} else { // If enemy doesn't have wither, apply it
|
|
||||||
instance.addEffect(new MobEffectInstance(MobEffects.WITHER, 180), this);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
"package": "xyz.nearmisses.patience.mc_rebalance.mixin",
|
"package": "xyz.nearmisses.patience.mc_rebalance.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ExperienceOrbRework",
|
"ExperienceOrbRework"
|
||||||
"WitherSkeletonRework"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue