Improve Instant Kill
This commit is contained in:
parent
c85c8798f1
commit
003726ef22
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**1.0.6**
|
||||||
|
* Improve Instant Kill
|
||||||
|
|
||||||
**1.0.5**
|
**1.0.5**
|
||||||
* Crying Obsidian Nether Portal
|
* Crying Obsidian Nether Portal
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.7.8+build.189
|
fabric_loader_version = 0.7.8+build.189
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.5
|
mod_version = 1.0.6
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
archives_base_name = slightlyvanilla
|
archives_base_name = slightlyvanilla
|
||||||
|
|
||||||
|
@ -1,26 +1,22 @@
|
|||||||
package com.thebrokenrail.slightlyvanilla.mixin;
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.boss.dragon.EnderDragonPart;
|
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Mixin(PlayerEntity.class)
|
@Mixin(PlayerEntity.class)
|
||||||
public class MixinPlayerEntity {
|
public class MixinPlayerEntity {
|
||||||
@Inject(at = @At("HEAD"), method = "attack", cancellable = true)
|
@ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z"), method = "attack", index = 1)
|
||||||
public void attack(Entity target, CallbackInfo info) {
|
public float changeDamage(DamageSource source, float amount) {
|
||||||
if (SlightlyVanilla.getConfig().instantKillInCreative && target.isAttackable()) {
|
//noinspection ConstantConditions
|
||||||
if (target instanceof EnderDragonPart) {
|
if (SlightlyVanilla.getConfig().instantKillInCreative && ((PlayerEntity) (Object) this).isCreative()) {
|
||||||
target = ((EnderDragonPart)target).owner;
|
return Float.MAX_VALUE;
|
||||||
}
|
} else {
|
||||||
//noinspection ConstantConditions
|
return amount;
|
||||||
target.damage(DamageSource.player((PlayerEntity) (Object) this), Float.MAX_VALUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user