updated to 1.14.3 pre 2, still issues with fabric spawn tracking mappings
This commit is contained in:
1 parent
a5d83a0c53
commit
f3da8b2576
31 files changed
+180
-173
No files matched your search
@@ -2,7 +2,7 @@ package carpet.logging;
|
||||
|
||||
import carpet.utils.HUDController;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
public class HUDLogger extends Logger
|
||||
{
|
||||
@@ -20,9 +20,9 @@ public class HUDLogger extends Logger
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerMessage(PlayerEntity player, BaseComponent... messages)
|
||||
public void sendPlayerMessage(PlayerEntity player, BaseText... messages)
|
||||
{
|
||||
for (BaseComponent m:messages) HUDController.addMessage(player, m);
|
||||
for (BaseText m:messages) HUDController.addMessage(player, m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package carpet.logging;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -89,7 +89,7 @@ public class Logger
|
||||
* will repeat invocation for players that share the same option
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface lMessage { BaseComponent [] get(String playerOption, PlayerEntity player);}
|
||||
public interface lMessage { BaseText [] get(String playerOption, PlayerEntity player);}
|
||||
public void log(lMessage messagePromise)
|
||||
{
|
||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||
@@ -97,7 +97,7 @@ public class Logger
|
||||
PlayerEntity player = playerFromName(en.getKey());
|
||||
if (player != null)
|
||||
{
|
||||
BaseComponent [] messages = messagePromise.get(en.getValue(),player);
|
||||
BaseText [] messages = messagePromise.get(en.getValue(),player);
|
||||
if (messages != null)
|
||||
sendPlayerMessage(player, messages);
|
||||
}
|
||||
@@ -109,10 +109,10 @@ public class Logger
|
||||
* and served the same way to all other players subscribed to the same option
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface lMessageIgnorePlayer { BaseComponent [] get(String playerOption);}
|
||||
public interface lMessageIgnorePlayer { BaseText [] get(String playerOption);}
|
||||
public void log(lMessageIgnorePlayer messagePromise)
|
||||
{
|
||||
Map<String, BaseComponent[]> cannedMessages = new HashMap<>();
|
||||
Map<String, BaseText[]> cannedMessages = new HashMap<>();
|
||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||
{
|
||||
PlayerEntity player = playerFromName(en.getKey());
|
||||
@@ -123,7 +123,7 @@ public class Logger
|
||||
{
|
||||
cannedMessages.put(option,messagePromise.get(option));
|
||||
}
|
||||
BaseComponent [] messages = cannedMessages.get(option);
|
||||
BaseText [] messages = cannedMessages.get(option);
|
||||
if (messages != null)
|
||||
sendPlayerMessage(player, messages);
|
||||
}
|
||||
@@ -132,9 +132,9 @@ public class Logger
|
||||
/**
|
||||
* guarantees that message is evaluated once, so independent from the player and chosen option
|
||||
*/
|
||||
public void log(Supplier<BaseComponent[]> messagePromise)
|
||||
public void log(Supplier<BaseText[]> messagePromise)
|
||||
{
|
||||
BaseComponent [] cannedMessages = null;
|
||||
BaseText [] cannedMessages = null;
|
||||
for (Map.Entry<String,String> en : subscribedOnlinePlayers.entrySet())
|
||||
{
|
||||
PlayerEntity player = playerFromName(en.getKey());
|
||||
@@ -146,7 +146,7 @@ public class Logger
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPlayerMessage(PlayerEntity player, BaseComponent ... messages)
|
||||
public void sendPlayerMessage(PlayerEntity player, BaseText ... messages)
|
||||
{
|
||||
Arrays.stream(messages).forEach(player::sendMessage);
|
||||
}
|
||||
|
||||
@@ -7,19 +7,19 @@ 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.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DamageReporter
|
||||
{
|
||||
private static BaseComponent[] verifyAndProduceMessage(String option, PlayerEntity player, Entity from, Entity to, Supplier<BaseComponent> messageFuture)
|
||||
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 BaseComponent[]{messageFuture.get()};
|
||||
return new BaseText[]{messageFuture.get()};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@ package carpet.logging.logHelpers;
|
||||
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.utils.Messenger;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
public class KillLogHelper {
|
||||
|
||||
public static void onSweep(String name, int count)
|
||||
{
|
||||
LoggerRegistry.getLogger("kills").log( () -> new BaseComponent[]{
|
||||
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 BaseComponent[]{
|
||||
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 BaseComponent[]{
|
||||
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
|
||||
Messenger.c("g "+name+" dud hot = no one affected")});
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package carpet.logging.logHelpers;
|
||||
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.utils.Messenger;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class TNTLogHelper
|
||||
@@ -30,12 +30,12 @@ public class TNTLogHelper
|
||||
switch (option)
|
||||
{
|
||||
case "brief":
|
||||
return new BaseComponent[]{Messenger.c(
|
||||
return new BaseText[]{Messenger.c(
|
||||
"l P ",Messenger.dblt("l",primedX,primedY,primedZ),
|
||||
"w ",Messenger.dblt("l", primedAngle.x, primedAngle.y, primedAngle.z),
|
||||
"r E ",Messenger.dblt("r",x, y, z))};
|
||||
case "full":
|
||||
return new BaseComponent[]{Messenger.c(
|
||||
return new BaseText[]{Messenger.c(
|
||||
"l P ",Messenger.dblf("l",primedX,primedY,primedZ),
|
||||
"w ",Messenger.dblf("l", primedAngle.x, primedAngle.y, primedAngle.z),
|
||||
"r E ",Messenger.dblf("r",x, y, z))};
|
||||
|
||||
@@ -4,7 +4,7 @@ import carpet.logging.Logger;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.utils.Messenger;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -39,7 +39,7 @@ public class TrajectoryLogHelper
|
||||
{
|
||||
if (!doLog) return;
|
||||
logger.log( (option) -> {
|
||||
List<BaseComponent> comp = new ArrayList<>();
|
||||
List<BaseText> comp = new ArrayList<>();
|
||||
switch (option)
|
||||
{
|
||||
case "brief":
|
||||
@@ -72,7 +72,7 @@ public class TrajectoryLogHelper
|
||||
}
|
||||
break;
|
||||
}
|
||||
return comp.toArray(new BaseComponent[0]);
|
||||
return comp.toArray(new BaseText[0]);
|
||||
});
|
||||
doLog = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user