21w15a
This commit is contained in:
1 parent
cc3723ae12
commit
d3295e6b4e
5 files changed
+40
-12
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.class_6342;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(class_6342.class)
|
||||
public class BaseRangeDecorator2_cleanLogsMixin {
|
||||
|
||||
//@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Redirect(method = "get",
|
||||
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")
|
||||
)
|
||||
private void skipLogs(Logger logger, String message, Object p0)
|
||||
{
|
||||
if (!CarpetSettings.cleanLogs) logger.warn(message, p0);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.world.gen.decorator.BaseRangeDecorator;
|
||||
import net.minecraft.class_6343;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(BaseRangeDecorator.class)
|
||||
@Mixin(class_6343.class)
|
||||
public class BaseRangeDecorator_cleanLogsMixin {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Redirect(method = "getY(Lnet/minecraft/world/gen/decorator/DecoratorContext;Ljava/util/Random;Lnet/minecraft/world/gen/decorator/RangeDecoratorConfig;I)I",
|
||||
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V")
|
||||
//@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Redirect(method = "get",
|
||||
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")
|
||||
)
|
||||
private void skipLogs(Logger logger, String message, Object p0, Object p1, Object p2)
|
||||
private void skipLogs(Logger logger, String message, Object p0)
|
||||
{
|
||||
if (!CarpetSettings.cleanLogs) logger.warn(message, p0, p1, p2);
|
||||
if (!CarpetSettings.cleanLogs) logger.warn(message, p0);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
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.LocalCapture;
|
||||
|
||||
@@ -39,6 +40,8 @@ public abstract class Explosion_scarpetEventMixin
|
||||
|
||||
@Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getCausingEntity();
|
||||
|
||||
@Shadow public static float getExposure(Vec3d source, Entity entity) {return 0.0f;}
|
||||
|
||||
private List<Entity> affectedEntities;
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/damage/DamageSource;Lnet/minecraft/world/explosion/ExplosionBehavior;DDDFZLnet/minecraft/world/explosion/Explosion$DestructionType;)V",
|
||||
@@ -51,13 +54,17 @@ public abstract class Explosion_scarpetEventMixin
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "collectBlocksAndDamageEntities", locals= LocalCapture.CAPTURE_FAILHARD, at=@At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z"))
|
||||
private void onExplosion(CallbackInfo ci, Set<BlockPos> s1, float f1, int i1, int i2, int i3, int i4, int i5, int i6, List<Entity> l1, Vec3d v1, int i7, Entity entity)
|
||||
@Redirect(method = "collectBlocksAndDamageEntities", at=@At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/explosion/Explosion;getExposure(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/entity/Entity;)F")
|
||||
)
|
||||
private float onExplosion(Vec3d source, Entity entity)
|
||||
{
|
||||
if (affectedEntities != null)
|
||||
{
|
||||
affectedEntities.add(entity);
|
||||
}
|
||||
return getExposure(source, entity);
|
||||
}
|
||||
|
||||
@Inject(method = "affectWorld", at = @At("HEAD"))
|
||||
|
||||
Reference in new issue
Block a user