cleanup unused code and mixins
This commit is contained in:
1 parent
598219608b
commit
3167fe06f3
62 files changed
+56
-916
No files matched your search
@@ -1,9 +1,7 @@
|
||||
package carpet.logging;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import carpet.helpers.HopperCounter;
|
||||
import carpet.helpers.TickSpeed;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.logging.logHelpers.PacketCounter;
|
||||
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
|
||||
import carpet.utils.Messenger;
|
||||
@@ -17,7 +15,6 @@ import net.minecraft.text.BaseText;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -22,13 +22,10 @@ public class LoggerRegistry
|
||||
public static boolean __tnt;
|
||||
public static boolean __projectiles;
|
||||
public static boolean __fallingBlocks;
|
||||
public static boolean __kills;
|
||||
public static boolean __tps;
|
||||
public static boolean __counter;
|
||||
public static boolean __mobcaps;
|
||||
public static boolean __damage;
|
||||
public static boolean __packets;
|
||||
public static boolean __weather;
|
||||
public static boolean __pathfinding;
|
||||
public static boolean __explosions;
|
||||
|
||||
@@ -44,11 +41,7 @@ public class LoggerRegistry
|
||||
registerLogger("tnt", Logger.stardardLogger( "tnt", "brief", new String[]{"brief", "full"}));
|
||||
registerLogger("projectiles", Logger.stardardLogger("projectiles", "brief", new String[]{"brief", "full"}));
|
||||
registerLogger("fallingBlocks",Logger.stardardLogger("fallingBlocks", "brief", new String[]{"brief", "full"}));
|
||||
//registerLogger("kills", new Logger("kills", null, null));
|
||||
//registerLogger("damage", new Logger("damage", "all", new String[]{"all","players","me"}));
|
||||
//registerLogger("weather", new Logger("weather", null, null));
|
||||
registerLogger( "pathfinding", Logger.stardardLogger("pathfinding", "20", new String[]{"2", "5", "10"}));
|
||||
|
||||
registerLogger("tps", HUDLogger.stardardHUDLogger("tps", null, null));
|
||||
registerLogger("packets", HUDLogger.stardardHUDLogger("packets", null, null));
|
||||
registerLogger("counter",HUDLogger.stardardHUDLogger("counter","white", Arrays.stream(DyeColor.values()).map(Object::toString).toArray(String[]::new)));
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user