cleanup of scarpet dependencies

This commit is contained in:
gnembon committed 2023-02-08 21:13:14 +01:00
1 parent fd93785fec
commit 75d94b0570
71 files changed
+1623 -1014

No files matched your search

@@ -1,11 +1,11 @@
package carpet.script.utils;
import carpet.CarpetSettings;
import carpet.helpers.ParticleDisplay;
import carpet.network.ServerNetworkHandler;
import carpet.script.CarpetScriptServer;
import carpet.script.exception.InternalExpressionException;
import carpet.script.exception.ThrowStatement;
import carpet.script.exception.Throwables;
import carpet.script.external.Carpet;
import carpet.script.external.Vanilla;
import carpet.script.language.Sys;
import carpet.script.utils.shapes.ShapeDirection;
import carpet.script.value.AbstractListValue;
@@ -149,7 +149,7 @@ public class ShapeDispatcher
final List<ServerPlayer> alternativePlayers = new ArrayList<>();
for (final ServerPlayer player : players)
{
(ServerNetworkHandler.isValidCarpetPlayer(player) ? clientPlayers : alternativePlayers).add(player);
(Carpet.isValidCarpetPlayer(player) ? clientPlayers : alternativePlayers).add(player);
}
if (!clientPlayers.isEmpty())
{
@@ -162,14 +162,14 @@ public class ShapeDispatcher
{
tagcount = 0;
final Tag finalTag = tag;
clientPlayers.forEach(p -> ServerNetworkHandler.sendCustomCommand(p, "scShapes", finalTag));
clientPlayers.forEach(p -> Vanilla.sendScarpetShapesDataToPlayer(p, finalTag));
tag = new ListTag();
}
}
final Tag finalTag = tag;
if (!tag.isEmpty())
{
clientPlayers.forEach(p -> ServerNetworkHandler.sendCustomCommand(p, "scShapes", finalTag));
clientPlayers.forEach(p -> Vanilla.sendScarpetShapesDataToPlayer(p, finalTag));
}
}
if (!alternativePlayers.isEmpty())
@@ -184,7 +184,7 @@ public class ShapeDispatcher
{
try
{
return ParticleDisplay.getEffect(name, regs.lookupOrThrow(Registries.PARTICLE_TYPE));
return ParticleParser.getEffect(name, regs.lookupOrThrow(Registries.PARTICLE_TYPE));
}
catch (final IllegalArgumentException e)
{
@@ -239,7 +239,7 @@ public class ShapeDispatcher
final Param decoder = Param.of.get(key);
if (decoder == null)
{
CarpetSettings.LOG.info("Unknown parameter for shape: " + key);
CarpetScriptServer.LOG.info("Unknown parameter for shape: " + key);
return null;
}
final Value decodedValue = decoder.decode(tag.get(key), level);
@@ -248,13 +248,13 @@ public class ShapeDispatcher
final Value shapeValue = options.get("shape");
if (shapeValue == null)
{
CarpetSettings.LOG.info("Shape id missing in " + String.join(", ", tag.getAllKeys()));
CarpetScriptServer.LOG.info("Shape id missing in " + String.join(", ", tag.getAllKeys()));
return null;
}
final BiFunction<Map<String, Value>, RegistryAccess, ExpiringShape> factory = ExpiringShape.shapeProviders.get(shapeValue.getString());
if (factory == null)
{
CarpetSettings.LOG.info("Unknown shape: " + shapeValue.getString());
CarpetScriptServer.LOG.info("Unknown shape: " + shapeValue.getString());
return null;
}
try
@@ -263,7 +263,7 @@ public class ShapeDispatcher
}
catch (final InternalExpressionException exc)
{
CarpetSettings.LOG.info(exc.getMessage());
CarpetScriptServer.LOG.info(exc.getMessage());
}
return null;
}
@@ -2022,7 +2022,7 @@ public class ShapeDispatcher
new NumericValue(e.getZ())
);
}
CarpetSettings.LOG.error("Value: " + value.getString());
CarpetScriptServer.LOG.error("Value: " + value.getString());
throw new InternalExpressionException("'" + p.id + "' requires a triple, block or entity to indicate position");
}