25w09a, broken shapes
This commit is contained in:
1 parent
1928b4f866
commit
9a62566b2a
9 files changed
+81
-80
No files matched your search
@@ -106,7 +106,7 @@ public class CarpetClient
|
||||
ListTag outputTag = (ListTag) tag.get("output");
|
||||
for (int i = 0; i < outputTag.size(); i++)
|
||||
{
|
||||
CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i), clientPlayer.registryAccess()).getString());
|
||||
CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i).orElseThrow(), clientPlayer.registryAccess()).getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,18 +23,18 @@ public class ClientNetworkHandler
|
||||
|
||||
static
|
||||
{
|
||||
dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.getAsString()));
|
||||
dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.asString().orElseThrow()));
|
||||
dataHandlers.put("Rules", (p, t) -> {
|
||||
CompoundTag ruleset = (CompoundTag) t;
|
||||
for (String ruleKey : ruleset.getAllKeys())
|
||||
for (String ruleKey : ruleset.keySet())
|
||||
{
|
||||
CompoundTag ruleNBT = (CompoundTag) ruleset.get(ruleKey);
|
||||
SettingsManager manager = null;
|
||||
String ruleName;
|
||||
if (ruleNBT.contains("Manager"))
|
||||
{
|
||||
ruleName = ruleNBT.getString("Rule");
|
||||
String managerName = ruleNBT.getString("Manager");
|
||||
ruleName = ruleNBT.getString("Rule").orElseThrow();
|
||||
String managerName = ruleNBT.getString("Manager").orElseThrow();
|
||||
if (managerName.equals("carpet"))
|
||||
{
|
||||
manager = CarpetServer.settingsManager;
|
||||
@@ -60,7 +60,7 @@ public class ClientNetworkHandler
|
||||
CarpetRule<?> rule = (manager != null) ? manager.getCarpetRule(ruleName) : null;
|
||||
if (rule != null)
|
||||
{
|
||||
String value = ruleNBT.getString("Value");
|
||||
String value = ruleNBT.getString("Value").orElseThrow();
|
||||
try
|
||||
{
|
||||
rule.set(null, value);
|
||||
@@ -116,7 +116,7 @@ public class ClientNetworkHandler
|
||||
|
||||
public static void onServerData(CompoundTag compound, LocalPlayer player)
|
||||
{
|
||||
for (String key : compound.getAllKeys())
|
||||
for (String key : compound.keySet())
|
||||
{
|
||||
if (dataHandlers.containsKey(key))
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ServerNetworkHandler
|
||||
private static final Set<ServerPlayer> validCarpetPlayers = new HashSet<>();
|
||||
|
||||
private static final Map<String, BiConsumer<ServerPlayer, Tag>> dataHandlers = Map.of(
|
||||
CarpetClient.HELLO, (p, t) -> onHello(p, t.getAsString()),
|
||||
CarpetClient.HELLO, (p, t) -> onHello(p, t.asString().orElseThrow()),
|
||||
"clientCommand", (p, t) -> handleClientCommand(p, (CompoundTag) t)
|
||||
);
|
||||
|
||||
@@ -79,8 +79,8 @@ public class ServerNetworkHandler
|
||||
|
||||
private static void handleClientCommand(ServerPlayer player, CompoundTag commandData)
|
||||
{
|
||||
String command = commandData.getString("command");
|
||||
String id = commandData.getString("id");
|
||||
String command = commandData.getString("command").orElseThrow();
|
||||
String id = commandData.getString("id").orElseThrow();
|
||||
List<Component> output = new ArrayList<>();
|
||||
Component[] error = {null};
|
||||
int[] returnValue = {0};
|
||||
@@ -116,7 +116,7 @@ public class ServerNetworkHandler
|
||||
|
||||
public static void onClientData(ServerPlayer player, CompoundTag compound)
|
||||
{
|
||||
for (String key : compound.getAllKeys())
|
||||
for (String key : compound.keySet())
|
||||
{
|
||||
if (dataHandlers.containsKey(key))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user