Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cd503c057
|
||
|
|
b79030abc8
|
||
|
|
a889ba944e | ||
|
|
5e31f6f844 | ||
|
|
820c5775ce | ||
|
|
a8df292072 | ||
|
|
56b68d07c8 | ||
|
|
88c994d6f5 | ||
|
|
61cdecc5d5 | ||
|
|
261cbaace3 | ||
|
|
1879253fe5 |
No files matched your search
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
+1
-1
@@ -5,7 +5,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'com.nexia.nexus'
|
||||
version '0.1.15'
|
||||
version '0.1.16'
|
||||
|
||||
def props = new Properties()
|
||||
def file = file("maven.properties")
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.nexia.nexus.builder.mixin._bugfixes;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ShieldItem;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(Explosion.class)
|
||||
public abstract class ExplosionMixin {
|
||||
@Shadow @Final private double x;
|
||||
@Shadow @Final private double y;
|
||||
@Shadow @Final private double z;
|
||||
|
||||
@Redirect(method = "explode", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z"))
|
||||
private boolean shieldBlockExplosion(Entity instance, DamageSource damageSource, float f) {
|
||||
if (instance instanceof LivingEntity livingEntity) {
|
||||
if (f > 0.0f && isDamageSourceBlocked(damageSource, new Vec3(this.x, this.y, this.z), livingEntity)) {
|
||||
livingEntity.knockback(0.5f, livingEntity.getX() - this.x, livingEntity.getZ() - this.z);
|
||||
livingEntity.level.playSound(null, new BlockPos(livingEntity.position()), SoundEvents.SHIELD_BLOCK, SoundSource.PLAYERS, 1.0F, 0.8F + livingEntity.level.random.nextFloat() * 0.4F);
|
||||
livingEntity.hurtCurrentlyUsedShield(Math.min(ShieldItem.getShieldBlockDamageValue(livingEntity.getBlockingItem()), f));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return instance.hurt(damageSource, f);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean isDamageSourceBlocked(DamageSource damageSource, Vec3 position, LivingEntity livingEntity) {
|
||||
if (!damageSource.isBypassArmor() && livingEntity.isBlocking()) {
|
||||
Vec3 vec32 = livingEntity.getViewVector(1.0f);
|
||||
if (vec32.y > -0.99 && vec32.y < 0.99) {
|
||||
vec32 = new Vec3(vec32.x, 0.0, vec32.z).normalize();
|
||||
Vec3 vec33 = position.vectorTo(livingEntity.position());
|
||||
vec33 = new Vec3(vec33.x, 0.0, vec33.z).normalize();
|
||||
return vec33.dot(vec32) * 3.1415927410125732 < -0.8726646304130554;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//https://github.com/Blumbo/LessAnnoyingFire/blob/1.19.4/src/main/java/net/blumbo/lessannoyingfire/mixin/ExplosionMixin.java
|
||||
// Less Annoying Fire
|
||||
|
||||
@ModifyArg(method = "finalizeExplosion", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextInt(I)I"))
|
||||
private int reduceFireOdds(int bound) {
|
||||
return bound * 2;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -11,6 +12,7 @@ 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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Player.class)
|
||||
@@ -32,4 +34,12 @@ public abstract class PlayerMixin extends LivingEntity {
|
||||
private void playShieldBreakSound(float f, CallbackInfoReturnable<Boolean> cir) {
|
||||
this.level.playSound(null, new BlockPos(this.position()), SoundEvents.SHIELD_BREAK, SoundSource.PLAYERS, 0.8F, 0.8F + this.level.random.nextFloat() * 0.4F);
|
||||
}
|
||||
|
||||
// Fixes MC-202432 and MC-128682
|
||||
@Inject(method = "setAbsorptionAmount", at = @At("RETURN"))
|
||||
private void onAbsorptionChanged(float f, CallbackInfo ci) {
|
||||
if (this.getAbsorptionAmount() <= 0.0f && this.hasEffect(MobEffects.ABSORPTION)) {
|
||||
this.removeEffect(MobEffects.ABSORPTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.nexia.nexus.builder.mixin.world.effect;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public interface LivingEntityAccessor {
|
||||
@Accessor("effectsDirty")
|
||||
void setEffectsChanged(boolean val);
|
||||
}
|
||||
+46
@@ -3,15 +3,24 @@ package com.nexia.nexus.builder.mixin.world.effect;
|
||||
import com.nexia.nexus.api.world.effect.StatusEffectInstance;
|
||||
import com.nexia.nexus.builder.extension.wrap.Wrap;
|
||||
import com.nexia.nexus.builder.implementation.world.effect.WrappedStatusEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(MobEffectInstance.class)
|
||||
public abstract class MobEffectInstanceMixin implements Wrap<StatusEffectInstance> {
|
||||
@Shadow public abstract MobEffect getEffect();
|
||||
|
||||
@Shadow public abstract int getAmplifier();
|
||||
|
||||
@Unique private StatusEffectInstance wrapped;
|
||||
|
||||
@Inject(method = { "<init>(Lnet/minecraft/world/effect/MobEffect;IIZZZLnet/minecraft/world/effect/MobEffectInstance;)V", "<init>(Lnet/minecraft/world/effect/MobEffect;)V" }, at = @At("TAIL"))
|
||||
@@ -23,4 +32,41 @@ public abstract class MobEffectInstanceMixin implements Wrap<StatusEffectInstanc
|
||||
public StatusEffectInstance wrap() {
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
// Fix MC-182497
|
||||
@Inject(
|
||||
method = "tick",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/effect/MobEffectInstance;setDetailsFrom(Lnet/minecraft/world/effect/MobEffectInstance;)V",
|
||||
shift = At.Shift.BEFORE
|
||||
)
|
||||
)
|
||||
private void addHere(LivingEntity entity, Runnable runnable, CallbackInfoReturnable<Boolean> cir) {
|
||||
((LivingEntityAccessor) entity).setEffectsChanged(true);
|
||||
this.getEffect().removeAttributeModifiers(entity, entity.getAttributes(), this.getAmplifier());
|
||||
}
|
||||
|
||||
|
||||
@Inject(
|
||||
method = "tick",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/lang/Runnable;run()V"
|
||||
)
|
||||
)
|
||||
private void removeHere(LivingEntity entity, Runnable overwriteCallback, CallbackInfoReturnable<Boolean> cir) {
|
||||
this.getEffect().addAttributeModifiers(entity, entity.getAttributes(), this.getAmplifier());
|
||||
}
|
||||
|
||||
|
||||
@Redirect(
|
||||
method = "tick",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/lang/Runnable;run()V"
|
||||
)
|
||||
)
|
||||
private void doNotUpdate(Runnable instance) {
|
||||
}
|
||||
}
|
||||
+43
-4
@@ -15,7 +15,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -28,6 +27,7 @@ import net.minecraft.world.item.ShieldItem;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -53,8 +53,6 @@ public abstract class LivingEntityMixin extends Entity implements LivingEntityEx
|
||||
|
||||
@Shadow public abstract ItemStack getBlockingItem();
|
||||
|
||||
@Shadow public abstract boolean addEffect(MobEffectInstance mobEffectInstance);
|
||||
|
||||
@Shadow public abstract ItemStack getMainHandItem();
|
||||
|
||||
public LivingEntityMixin(EntityType<?> entityType, Level level) {
|
||||
@@ -226,10 +224,13 @@ public abstract class LivingEntityMixin extends Entity implements LivingEntityEx
|
||||
|
||||
f = (float)((double)f * (1.0 - g));
|
||||
if (!(f <= 0.0F)) {
|
||||
var ping = 0;
|
||||
instance.hasImpulse = true;
|
||||
Vec3 vec3 = instance.getDeltaMovement();
|
||||
Vec3 vec32 = (new Vec3(d, 0.0, e)).normalize().scale(f);
|
||||
instance.setDeltaMovement(vec3.x / 2.0 - vec32.x, instance.isOnGround() ? Math.min(0.4, (double)f * 0.75) : Math.min(0.4, vec3.y + (double)f * 0.5),vec3.z / 2.0 - vec32.z);
|
||||
instance.setDeltaMovement(instance.isOnGround() ? vec3.x / 2.0 - vec32.x : Math.pow(0.91, ping/50) * vec3.x / 2.0 - vec32.x,
|
||||
instance.isOnGround() ? Math.min(0.4, (double)f * 0.75) : Math.min(0.4, vec3.y + (double)f * 0.5),
|
||||
instance.isOnGround() ? vec3.z / 2.0 - vec32.z : Math.pow(0.91, ping/50) * vec3.z / 2.0 - vec32.z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,4 +240,42 @@ public abstract class LivingEntityMixin extends Entity implements LivingEntityEx
|
||||
this.level.playSound(null, new BlockPos(this.position()), SoundEvents.SHIELD_BLOCK, SoundSource.PLAYERS, 1.0F, 0.8F + this.level.random.nextFloat() * 0.4F);
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/Blumbo/LessAnnoyingFire/blob/1.19.4/src/main/java/net/blumbo/lessannoyingfire/mixin/LivingEntityMixin.java
|
||||
// Less Annoying Fire
|
||||
|
||||
@Shadow private DamageSource lastDamageSource;
|
||||
|
||||
@Shadow protected abstract void markHurt();
|
||||
|
||||
@Unique
|
||||
DamageSource damageSource;
|
||||
|
||||
@Inject(method = "hurt", at = @At(value = "FIELD", ordinal = 0, opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/entity/LivingEntity;invulnerableTime:I"))
|
||||
private void setSource1(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
|
||||
damageSource = source;
|
||||
}
|
||||
|
||||
@Redirect(method = "hurt", at = @At(value = "FIELD", ordinal = 0, opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/entity/LivingEntity;invulnerableTime:I"))
|
||||
private int getInvulnerabilityTicks(LivingEntity instance) {
|
||||
// Make fire caused invulnerability ticks irrelevant if damage comes from an entity
|
||||
if (fireDamageSource(lastDamageSource) && damageSource.getDirectEntity() != null) return 0;
|
||||
return invulnerableTime;
|
||||
}
|
||||
|
||||
@Inject(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;markHurt()V"))
|
||||
private void setSource2(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
|
||||
damageSource = source;
|
||||
}
|
||||
|
||||
@Redirect(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;markHurt()V"))
|
||||
private void velocityUpdateCondition(LivingEntity instance) {
|
||||
// Prevent fire from messing up movement
|
||||
if (!fireDamageSource(damageSource)) markHurt();
|
||||
}
|
||||
|
||||
@Unique
|
||||
private static boolean fireDamageSource(DamageSource damageSource) {
|
||||
return damageSource == DamageSource.ON_FIRE || damageSource == DamageSource.IN_FIRE;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
accessWidener v1 named
|
||||
accessible class net/minecraft/world/inventory/MenuType$MenuSupplier
|
||||
accessible method net/minecraft/world/entity/LivingEntity hurtCurrentlyUsedShield (F)V
|
||||
@@ -5,6 +5,7 @@
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"_bugfixes.ConnectionAccessor",
|
||||
"_bugfixes.ExplosionMixin",
|
||||
"_bugfixes.PacketUtilsMixin",
|
||||
"_bugfixes.PlayerMixin",
|
||||
"_bugfixes.ProtectionEnchantmentMixin",
|
||||
@@ -28,6 +29,7 @@
|
||||
"server.players.PlayerListMixin",
|
||||
"world.SimpleMenuProviderMixin",
|
||||
"world.damagesource.DamageSourceMixin",
|
||||
"world.effect.LivingEntityAccessor",
|
||||
"world.effect.MobEffectInstanceMixin",
|
||||
"world.effect.MobEffectMixin",
|
||||
"world.effect.MobEffectsMixin",
|
||||
|
||||
Reference in new issue
Block a user