cleanup unused code and mixins

This commit is contained in:
gnembon committed 2020-08-18 01:54:24 -03:00
1 parent 598219608b
commit 3167fe06f3
62 files changed
+56 -916

No files matched your search

@@ -1,102 +0,0 @@
package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.text.BaseText;
import java.util.function.Supplier;
public class DamageReporter
{
private static BaseText[] verifyAndProduceMessage(String option, PlayerEntity player, Entity from, Entity to, Supplier<BaseText> messageFuture)
{
if ("all".equalsIgnoreCase(option)
|| ("players".equalsIgnoreCase(option) && (from instanceof PlayerEntity || to instanceof PlayerEntity))
|| ("me".equalsIgnoreCase(option) && ( (from == player) || ( to == player) ) ))
{
return new BaseText[]{messageFuture.get()};
}
return null;
}
public static boolean register_damage_attacker(Entity target, LivingEntity source, float amount)
{
if (!LoggerRegistry.__damage) return true;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source, target, () ->
Messenger.c(source.getDisplayName(),
"g attacking ", target.getDisplayName(),"g for ",
String.format("r %.2f",amount), "g points of damage")
)
);
return true;
}
public static void register_damage(LivingEntity target, DamageSource source, float amount)
{
if (!LoggerRegistry.__damage) return;
if (source.isFire() && (target.isFireImmune() ||
target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c(target.getDisplayName(),
"g receiving ",
String.format("r %.2f", amount),
String.format("g points of damage from %s", source.getName()))
)
);
}
public static void register_final_damage(LivingEntity target, DamageSource source, float amount)
{
if (!LoggerRegistry.__damage) return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c("g - total received ",
String.format("r %.2f", amount),
"g points of damage")
)
);
}
public static void modify_damage(LivingEntity target, DamageSource source, float previous_amount, float final_amount, String component)
{
if (!LoggerRegistry.__damage)
return;
if (previous_amount == final_amount)
return;
if (source.isFire() && (target.isFireImmune() ||
target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
{
if (final_amount == 0.0f)
{
return Messenger.c("g - reduced to ","r 0.0","g due to: "+component);
}
else if (previous_amount > final_amount)
{
float reduction = previous_amount-final_amount;
return Messenger.c("g - reduced to ",
String.format("l %.2f",final_amount),
String.format("g by %.2f (%.1f%% less) due to: %s",reduction,100.0*reduction/previous_amount, component));
}
else
{
float increase = final_amount-previous_amount;
return Messenger.c("g - increased to ",
String.format("r %.2f",final_amount),
String.format("g by %.2f (%.1f%% more) due to: %s",increase,100.0*increase/previous_amount, component));
}
}
)
);
}
}
@@ -1,26 +0,0 @@
package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger;
import net.minecraft.text.BaseText;
public class KillLogHelper {
public static void onSweep(String name, int count)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" smacked ","r "+count,"g entities with sweeping")});
}
public static void onNonSweepAttack(String name)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" smacked ","r 1","g (no sweeping)")});
}
public static void onDudHit(String name)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" dud hot = no one affected")});
}
}
@@ -2,13 +2,8 @@ package carpet.logging.logHelpers;
import carpet.helpers.ParticleDisplay;
import carpet.logging.LoggerRegistry;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.command.argument.ParticleArgumentType;
import net.minecraft.entity.Entity;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Vec3d;
public class PathfindingVisualizer
@@ -43,8 +43,8 @@ public class TNTLogHelper
"r E ",Messenger.dblt("r",x, y, z))};
case "full":
return new BaseText[]{Messenger.c(
"r #" + String.valueOf(tntCount),
"m @" + String.valueOf(gametime),
"r #" + tntCount,
"m @" + gametime,
"g : ",
"l P ",Messenger.dblf("l",primedX,primedY,primedZ),
"w ",Messenger.dblf("l", primedAngle.x, primedAngle.y, primedAngle.z),