cleanup of scarpet dependencies
This commit is contained in:
1 parent
fd93785fec
commit
75d94b0570
71 files changed
+1623
-1014
No files matched your search
+181
@@ -0,0 +1,181 @@
|
||||
package carpet.script.external;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.api.settings.CarpetRule;
|
||||
import carpet.api.settings.RuleHelper;
|
||||
import carpet.api.settings.SettingsManager;
|
||||
import carpet.api.settings.Validator;
|
||||
import carpet.fakes.MinecraftServerInterface;
|
||||
import carpet.helpers.TickSpeed;
|
||||
import carpet.logging.HUDController;
|
||||
import carpet.network.ServerNetworkHandler;
|
||||
import carpet.patches.EntityPlayerMPFake;
|
||||
import carpet.script.CarpetExpression;
|
||||
import carpet.script.CarpetScriptServer;
|
||||
import carpet.script.utils.AppStoreManager;
|
||||
import carpet.script.value.MapValue;
|
||||
import carpet.script.value.StringValue;
|
||||
import carpet.utils.BlockInfo;
|
||||
import carpet.utils.CarpetProfiler;
|
||||
import carpet.utils.Messenger;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Carpet
|
||||
{
|
||||
public static Map<String, Component> getScarpetHeaders()
|
||||
{
|
||||
return HUDController.scarpet_headers;
|
||||
}
|
||||
|
||||
public static Map<String, Component> getScarpetFooters()
|
||||
{
|
||||
return HUDController.scarpet_footers;
|
||||
}
|
||||
|
||||
public static void updateScarpetHUDs(final MinecraftServer server, final List<ServerPlayer> players)
|
||||
{
|
||||
HUDController.update_hud(server, players);
|
||||
}
|
||||
|
||||
public static Component Messenger_compose(final Object... messages)
|
||||
{
|
||||
return Messenger.c(messages);
|
||||
}
|
||||
|
||||
public static void Messenger_message(final CommandSourceStack source, final Object... messages)
|
||||
{
|
||||
Messenger.m(source, messages);
|
||||
}
|
||||
|
||||
public static ThreadLocal<Boolean> getImpendingFillSkipUpdates()
|
||||
{
|
||||
return CarpetSettings.impendingFillSkipUpdates;
|
||||
}
|
||||
|
||||
public static Map<SoundType, String> getSoundTypeNames()
|
||||
{
|
||||
return BlockInfo.soundName;
|
||||
}
|
||||
|
||||
public static Map<MaterialColor, String> getMapColorNames()
|
||||
{
|
||||
return BlockInfo.mapColourName;
|
||||
}
|
||||
|
||||
public static Map<Material, String> getMaterialNames()
|
||||
{
|
||||
return BlockInfo.materialName;
|
||||
}
|
||||
|
||||
public static Runnable startProfilerSection(final String name)
|
||||
{
|
||||
final CarpetProfiler.ProfilerToken token = CarpetProfiler.start_section(null, name, CarpetProfiler.TYPE.GENERAL);
|
||||
return () -> CarpetProfiler.end_current_section(token);
|
||||
}
|
||||
|
||||
public static void MinecraftServer_addScriptServer(final MinecraftServer server, final CarpetScriptServer scriptServer)
|
||||
{
|
||||
((MinecraftServerInterface) server).addScriptServer(scriptServer);
|
||||
}
|
||||
|
||||
public static boolean isValidCarpetPlayer(final ServerPlayer player)
|
||||
{
|
||||
return ServerNetworkHandler.isValidCarpetPlayer(player);
|
||||
}
|
||||
|
||||
public static String getPlayerStatus(final ServerPlayer player)
|
||||
{
|
||||
return ServerNetworkHandler.getPlayerStatus(player);
|
||||
}
|
||||
|
||||
public static MapValue getAllCarpetRules()
|
||||
{
|
||||
final Collection<CarpetRule<?>> rules = CarpetServer.settingsManager.getCarpetRules();
|
||||
final MapValue carpetRules = new MapValue(Collections.emptyList());
|
||||
rules.forEach(rule -> carpetRules.put(new StringValue(rule.name()), new StringValue(RuleHelper.toRuleString(rule.value()))));
|
||||
CarpetServer.extensions.forEach(e -> {
|
||||
final SettingsManager manager = e.extensionSettingsManager();
|
||||
if (manager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
manager.getCarpetRules().forEach(rule -> carpetRules.put(new StringValue(manager.identifier() + ":" + rule.name()), new StringValue(RuleHelper.toRuleString(rule.value()))));
|
||||
});
|
||||
return carpetRules;
|
||||
}
|
||||
|
||||
public static String getCarpetVersion()
|
||||
{
|
||||
return CarpetSettings.carpetVersion;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String isModdedPlayer(final Player p)
|
||||
{
|
||||
if (p instanceof final EntityPlayerMPFake fake)
|
||||
{
|
||||
return fake.isAShadow ? "shadow" : "fake";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isTickProcessingPaused()
|
||||
{
|
||||
return !TickSpeed.process_entities;
|
||||
}
|
||||
|
||||
public static void handleExtensionsAPI(final CarpetExpression expression)
|
||||
{
|
||||
CarpetServer.extensions.forEach(e -> e.scarpetApi(expression));
|
||||
}
|
||||
|
||||
public static boolean getFillUpdates()
|
||||
{
|
||||
return CarpetSettings.fillUpdates;
|
||||
}
|
||||
|
||||
public static class ScarpetAppStoreValidator extends Validator<String>
|
||||
{
|
||||
@Override
|
||||
public String validate(final CommandSourceStack source, final CarpetRule<String> currentRule, String newValue, final String stringInput)
|
||||
{
|
||||
if (newValue.equals(currentRule.value()))
|
||||
{
|
||||
// Don't refresh the local repo if it's the same (world change), helps preventing hitting rate limits from github when
|
||||
// getting suggestions. Pending is a way to invalidate the cache when it gets old, and investigating api usage further
|
||||
return newValue;
|
||||
}
|
||||
if (newValue.equalsIgnoreCase("none"))
|
||||
{
|
||||
AppStoreManager.setScarpetRepoLink(null);
|
||||
return newValue;
|
||||
}
|
||||
if (newValue.endsWith("/"))
|
||||
{
|
||||
newValue = newValue.replaceAll("/$", "");
|
||||
}
|
||||
AppStoreManager.setScarpetRepoLink("https://api.github.com/repos/" + newValue + "/");
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description()
|
||||
{
|
||||
return "Appstore link should point to a valid github repository";
|
||||
}
|
||||
}
|
||||
}
|
||||
+364
@@ -0,0 +1,364 @@
|
||||
package carpet.script.external;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.BiomeInterface;
|
||||
import carpet.fakes.BlockPredicateInterface;
|
||||
import carpet.fakes.BlockStateArgumentInterface;
|
||||
import carpet.fakes.ChunkTicketManagerInterface;
|
||||
import carpet.fakes.CommandDispatcherInterface;
|
||||
import carpet.fakes.EntityInterface;
|
||||
import carpet.fakes.IngredientInterface;
|
||||
import carpet.fakes.InventoryBearerInterface;
|
||||
import carpet.fakes.ItemEntityInterface;
|
||||
import carpet.fakes.LivingEntityInterface;
|
||||
import carpet.fakes.MinecraftServerInterface;
|
||||
import carpet.fakes.MobEntityInterface;
|
||||
import carpet.fakes.RandomStateVisitorAccessor;
|
||||
import carpet.fakes.RecipeManagerInterface;
|
||||
import carpet.fakes.AbstractContainerMenuInterface;
|
||||
import carpet.fakes.ServerChunkManagerInterface;
|
||||
import carpet.fakes.ServerPlayerInterface;
|
||||
import carpet.fakes.ServerPlayerInteractionManagerInterface;
|
||||
import carpet.fakes.ServerWorldInterface;
|
||||
import carpet.fakes.SpawnHelperInnerInterface;
|
||||
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
|
||||
import carpet.mixins.Objective_scarpetMixin;
|
||||
import carpet.mixins.Scoreboard_scarpetMixin;
|
||||
import carpet.network.ServerNetworkHandler;
|
||||
import carpet.script.CarpetScriptServer;
|
||||
import carpet.script.EntityEventsGroup;
|
||||
import carpet.script.value.MapValue;
|
||||
import carpet.script.value.StringValue;
|
||||
import carpet.script.value.Value;
|
||||
import carpet.utils.CommandHelper;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.arguments.blocks.BlockInput;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.DistanceManager;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.server.level.Ticket;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.SortedArraySet;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.goal.Goal;
|
||||
import net.minecraft.world.entity.ai.goal.GoalSelector;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.DataSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.NaturalSpawner;
|
||||
import net.minecraft.world.level.PotentialCalculator;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
||||
import net.minecraft.world.level.levelgen.DensityFunction;
|
||||
import net.minecraft.world.level.levelgen.RandomState;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.ServerLevelData;
|
||||
import net.minecraft.world.scores.Objective;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraft.world.scores.criteria.ObjectiveCriteria;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Vanilla
|
||||
{
|
||||
public static void MinecraftServer_forceTick(final MinecraftServer server, final BooleanSupplier sup)
|
||||
{
|
||||
((MinecraftServerInterface) server).forceTick(sup);
|
||||
}
|
||||
|
||||
public static void ChunkMap_relightChunk(final ChunkMap chunkMap, final ChunkPos pos)
|
||||
{
|
||||
((ThreadedAnvilChunkStorageInterface) chunkMap).relightChunk(pos);
|
||||
}
|
||||
|
||||
public static Map<String, Integer> ChunkMap_regenerateChunkRegion(final ChunkMap chunkMap, final List<ChunkPos> requestedChunks)
|
||||
{
|
||||
return ((ThreadedAnvilChunkStorageInterface) chunkMap).regenerateChunkRegion(requestedChunks);
|
||||
}
|
||||
|
||||
public static List<Collection<ItemStack>> Ingredient_getRecipeStacks(final Ingredient ingredient)
|
||||
{
|
||||
return ((IngredientInterface) (Object) ingredient).getRecipeStacks();
|
||||
}
|
||||
|
||||
public static List<Recipe<?>> RecipeManager_getAllMatching(final RecipeManager recipeManager, final RecipeType<?> type, final ResourceLocation output, final RegistryAccess registryAccess)
|
||||
{
|
||||
return ((RecipeManagerInterface) recipeManager).getAllMatching(type, output, registryAccess);
|
||||
}
|
||||
|
||||
public static int NaturalSpawner_MAGIC_NUMBER()
|
||||
{
|
||||
return SpawnReporter.MAGIC_NUMBER;
|
||||
}
|
||||
|
||||
public static PotentialCalculator SpawnState_getPotentialCalculator(final NaturalSpawner.SpawnState spawnState)
|
||||
{
|
||||
return ((SpawnHelperInnerInterface) spawnState).getPotentialCalculator();
|
||||
}
|
||||
|
||||
public static void Objective_setCriterion(final Objective objective, final ObjectiveCriteria criterion)
|
||||
{
|
||||
((Objective_scarpetMixin) objective).setCriterion(criterion);
|
||||
}
|
||||
|
||||
public static Map<ObjectiveCriteria, List<Objective>> Scoreboard_getObjectivesByCriterion(final Scoreboard scoreboard)
|
||||
{
|
||||
return ((Scoreboard_scarpetMixin) scoreboard).getObjectivesByCriterion();
|
||||
}
|
||||
|
||||
public static ServerLevelData ServerLevel_getWorldProperties(final ServerLevel world)
|
||||
{
|
||||
return ((ServerWorldInterface) world).getWorldPropertiesCM();
|
||||
}
|
||||
|
||||
public static DistanceManager ServerChunkCache_getCMTicketManager(final ServerChunkCache chunkCache)
|
||||
{
|
||||
return ((ServerChunkManagerInterface) chunkCache).getCMTicketManager();
|
||||
}
|
||||
|
||||
public static Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> ChunkTicketManager_getTicketsByPosition(final DistanceManager ticketManager)
|
||||
{
|
||||
return ((ChunkTicketManagerInterface) ticketManager).getTicketsByPosition();
|
||||
}
|
||||
|
||||
public static DensityFunction.Visitor RandomState_getVisitor(final RandomState randomState)
|
||||
{
|
||||
return ((RandomStateVisitorAccessor) (Object) randomState).getVisitor();
|
||||
}
|
||||
|
||||
public static CompoundTag BlockInput_getTag(final BlockInput blockInput)
|
||||
{
|
||||
return ((BlockStateArgumentInterface) blockInput).getCMTag();
|
||||
}
|
||||
|
||||
public static CarpetScriptServer MinecraftServer_getScriptServer(final MinecraftServer server)
|
||||
{
|
||||
return ((MinecraftServerInterface) server).getScriptServer();
|
||||
}
|
||||
|
||||
public static Biome.ClimateSettings Biome_getClimateSettings(final Biome biome)
|
||||
{
|
||||
return ((BiomeInterface) (Object) biome).getClimateSettings();
|
||||
}
|
||||
|
||||
public static ThreadLocal<Boolean> skipGenerationChecks(final ServerLevel level)
|
||||
{ // not sure does vanilla care at all - needs checking
|
||||
return CarpetSettings.skipGenerationChecks;
|
||||
}
|
||||
|
||||
public static void sendScarpetShapesDataToPlayer(final ServerPlayer player, final Tag data)
|
||||
{ // dont forget to add the packet to vanilla packed handler and call ShapesRenderer.addShape to handle on client
|
||||
ServerNetworkHandler.sendCustomCommand(player, "scShapes", data);
|
||||
}
|
||||
|
||||
public static int MinecraftServer_getRunPermissionLevel(final MinecraftServer server)
|
||||
{
|
||||
return CarpetSettings.runPermissionLevel;
|
||||
}
|
||||
|
||||
public static String MinecraftServer_getReleaseTarget(final MinecraftServer server)
|
||||
{
|
||||
return CarpetSettings.releaseTarget;
|
||||
}
|
||||
|
||||
public static boolean isDevelopmentEnvironment()
|
||||
{
|
||||
return FabricLoader.getInstance().isDevelopmentEnvironment();
|
||||
}
|
||||
|
||||
public static MapValue getServerMods(final MinecraftServer server)
|
||||
{
|
||||
final Map<Value, Value> ret = new HashMap<>();
|
||||
for (final ModContainer mod : FabricLoader.getInstance().getAllMods())
|
||||
{
|
||||
ret.put(new StringValue(mod.getMetadata().getId()), new StringValue(mod.getMetadata().getVersion().getFriendlyString()));
|
||||
}
|
||||
return MapValue.wrap(ret);
|
||||
}
|
||||
|
||||
public static LevelStorageSource.LevelStorageAccess MinecraftServer_storageSource(final MinecraftServer server)
|
||||
{
|
||||
return ((MinecraftServerInterface) server).getCMSession();
|
||||
}
|
||||
|
||||
public static BlockPos ServerPlayerGameMode_getCurrentBlockPosition(final ServerPlayerGameMode gameMode)
|
||||
{
|
||||
return ((ServerPlayerInteractionManagerInterface) gameMode).getCurrentBreakingBlock();
|
||||
}
|
||||
|
||||
public static int ServerPlayerGameMode_getCurrentBlockBreakingProgress(final ServerPlayerGameMode gameMode)
|
||||
{
|
||||
return ((ServerPlayerInteractionManagerInterface) gameMode).getCurrentBlockBreakingProgress();
|
||||
}
|
||||
|
||||
public static void ServerPlayerGameMode_setBlockBreakingProgress(final ServerPlayerGameMode gameMode, final int progress)
|
||||
{
|
||||
((ServerPlayerInteractionManagerInterface) gameMode).setBlockBreakingProgress(progress);
|
||||
}
|
||||
|
||||
public static boolean ServerPlayer_isInvalidEntityObject(final ServerPlayer player)
|
||||
{
|
||||
return ((ServerPlayerInterface) player).isInvalidEntityObject();
|
||||
}
|
||||
|
||||
public static String ServerPlayer_getLanguage(final ServerPlayer player)
|
||||
{
|
||||
return ((ServerPlayerInterface) player).getLanguage();
|
||||
}
|
||||
|
||||
public static GoalSelector Mob_getAI(final Mob mob, final boolean target)
|
||||
{
|
||||
return ((MobEntityInterface) mob).getAI(target);
|
||||
}
|
||||
|
||||
public static Map<String, Goal> Mob_getTemporaryTasks(final Mob mob)
|
||||
{
|
||||
return ((MobEntityInterface) mob).getTemporaryTasks();
|
||||
}
|
||||
|
||||
public static void Mob_setPersistence(final Mob mob, final boolean what)
|
||||
{
|
||||
((MobEntityInterface) mob).setPersistence(what);
|
||||
}
|
||||
|
||||
public static EntityEventsGroup Entity_getEventContainer(final Entity entity)
|
||||
{
|
||||
return ((EntityInterface) entity).getEventContainer();
|
||||
}
|
||||
|
||||
public static boolean Entity_isPermanentVehicle(final Entity entity)
|
||||
{
|
||||
return ((EntityInterface) entity).isPermanentVehicle();
|
||||
}
|
||||
|
||||
public static void Entity_setPermanentVehicle(final Entity entity, final boolean permanent)
|
||||
{
|
||||
((EntityInterface) entity).setPermanentVehicle(permanent);
|
||||
}
|
||||
|
||||
public static int Entity_getPortalTimer(final Entity entity)
|
||||
{
|
||||
return ((EntityInterface) entity).getPortalTimer();
|
||||
}
|
||||
|
||||
public static void Entity_setPortalTimer(final Entity entity, final int amount)
|
||||
{
|
||||
((EntityInterface) entity).setPortalTimer(amount);
|
||||
}
|
||||
|
||||
public static int Entity_getPublicNetherPortalCooldown(final Entity entity)
|
||||
{
|
||||
return ((EntityInterface) entity).getPublicNetherPortalCooldown();
|
||||
}
|
||||
|
||||
public static void Entity_setPublicNetherPortalCooldown(final Entity entity, final int what)
|
||||
{
|
||||
((EntityInterface) entity).setPublicNetherPortalCooldown(what);
|
||||
}
|
||||
|
||||
public static int ItemEntity_getPickupDelay(final ItemEntity entity)
|
||||
{
|
||||
return ((ItemEntityInterface) entity).getPickupDelayCM();
|
||||
}
|
||||
|
||||
public static boolean LivingEntity_isJumping(final LivingEntity entity)
|
||||
{
|
||||
return ((LivingEntityInterface) entity).isJumpingCM();
|
||||
}
|
||||
|
||||
public static void LivingEntity_setJumping(final LivingEntity entity)
|
||||
{
|
||||
((LivingEntityInterface) entity).doJumpCM();
|
||||
}
|
||||
|
||||
public static Container AbstractHorse_getInventory(final AbstractHorse horse)
|
||||
{
|
||||
return ((InventoryBearerInterface) horse).getCMInventory();
|
||||
}
|
||||
|
||||
public static DataSlot AbstractContainerMenu_getDataSlot(final AbstractContainerMenu handler, final int index)
|
||||
{
|
||||
return ((AbstractContainerMenuInterface) handler).getDataSlot(index);
|
||||
}
|
||||
|
||||
public static void CommandDispatcher_unregisterCommand(final CommandDispatcher<CommandSourceStack> dispatcher, final String name)
|
||||
{
|
||||
((CommandDispatcherInterface) dispatcher).carpet$unregister(name);
|
||||
}
|
||||
|
||||
public static boolean MinecraftServer_doScriptsAutoload(final MinecraftServer server)
|
||||
{
|
||||
return CarpetSettings.scriptsAutoload;
|
||||
}
|
||||
|
||||
public static void MinecraftServer_notifyPlayersCommandsChanged(final MinecraftServer server)
|
||||
{
|
||||
CommandHelper.notifyPlayersCommandsChanged(server);
|
||||
}
|
||||
|
||||
public static boolean ScriptServer_scriptOptimizations(final MinecraftServer scriptServer)
|
||||
{
|
||||
return CarpetSettings.scriptsOptimization;
|
||||
}
|
||||
|
||||
public static boolean ScriptServer_scriptDebugging(final MinecraftServer server)
|
||||
{
|
||||
return CarpetSettings.scriptsDebugging;
|
||||
}
|
||||
|
||||
public static boolean ServerPlayer_canScriptACE(final CommandSourceStack player)
|
||||
{
|
||||
return CommandHelper.canUseCommand(player, CarpetSettings.commandScriptACE);
|
||||
}
|
||||
|
||||
public static boolean ServerPlayer_canScriptGeneral(final CommandSourceStack player)
|
||||
{
|
||||
return CommandHelper.canUseCommand(player, CarpetSettings.commandScript);
|
||||
}
|
||||
|
||||
public static int MinecraftServer_getFillLimit(final MinecraftServer server)
|
||||
{
|
||||
return Math.max(server.getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT), CarpetSettings.fillLimit);
|
||||
}
|
||||
|
||||
public record BlockPredicatePayload(BlockState state, TagKey<Block> tagKey, Map<Value, Value> properties, CompoundTag tag) {
|
||||
public static BlockPredicatePayload of(final Predicate<BlockInWorld> blockPredicate)
|
||||
{
|
||||
final BlockPredicateInterface predicateData = (BlockPredicateInterface) blockPredicate;
|
||||
return new BlockPredicatePayload(predicateData.getCMBlockState(), predicateData.getCMBlockTagKey(), predicateData.getCMProperties(), predicateData.getCMDataTag());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package carpet.script.external;
|
||||
|
||||
import carpet.mixins.ShulkerBoxAccessMixin;
|
||||
import net.minecraft.client.model.ShulkerModel;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
|
||||
|
||||
public class VanillaClient
|
||||
{
|
||||
public static ShulkerModel<?> ShulkerBoxRenderer_model(final BlockEntityRenderer<ShulkerBoxBlockEntity> shulkerBoxRenderer) {
|
||||
return ((ShulkerBoxAccessMixin)shulkerBoxRenderer).getModel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package carpet.script.external;
|
||||
|
||||
import net.minecraft.FieldsAreNonnullByDefault;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
Reference in new issue
Block a user