Skip to content

Commit

Permalink
22w16b
Browse files Browse the repository at this point in the history
Co-authored-by: Player <player@player.to>
  • Loading branch information
modmuss50 and sfPlayer1 authored Apr 20, 2022
1 parent 372dc1d commit ec94c6f
Show file tree
Hide file tree
Showing 55 changed files with 202 additions and 258 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id "eclipse"
id "idea"
id "maven-publish"
id "fabric-loom" version "0.11.32" apply false
id "fabric-loom" version "0.11.33" apply false
id "org.cadixdev.licenser" version "0.6.1"
id "org.ajoberstar.grgit" version "3.1.0"
id "com.matthewprenger.cursegradle" version "1.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.spongepowered.asm.mixin.MixinEnvironment;

import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
Expand All @@ -45,7 +45,7 @@ public void onInitialize() {
// Command to call audit the mixin environment
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
dispatcher.register(literal("audit_mixins").executes(context -> {
context.getSource().sendFeedback(new LiteralText("Auditing mixin environment"), false);
context.getSource().sendFeedback(Text.literal("Auditing mixin environment"), false);

try {
MixinEnvironment.getCurrentEnvironment().audit();
Expand All @@ -54,7 +54,7 @@ public void onInitialize() {
throw new AssertionError("Failed to audit mixin environment", e);
}

context.getSource().sendFeedback(new LiteralText("Successfully audited mixin environment"), false);
context.getSource().sendFeedback(Text.literal("Successfully audited mixin environment"), false);

return 1;
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand All @@ -48,12 +48,12 @@ public static void onInitialize() {

INSPECTABLE.registerSelf(INSPECTABLE_PIG);
INSPECTABLE.registerForTypes(
(entity, context) -> () -> new LiteralText("registerForTypes: " + entity.getClass().getName()),
(entity, context) -> () -> Text.literal("registerForTypes: " + entity.getClass().getName()),
EntityType.PLAYER,
EntityType.COW);
INSPECTABLE.registerFallback((entity, context) -> {
if (entity instanceof CreeperEntity) {
return () -> new LiteralText("registerFallback: CreeperEntity");
return () -> Text.literal("registerFallback: CreeperEntity");
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.world.World;

Expand All @@ -31,6 +30,6 @@ public InspectablePigEntity(EntityType<? extends PigEntity> entityType, World wo

@Override
public Text inspect() {
return new LiteralText("InspectablePigEntity");
return Text.literal("InspectablePigEntity");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.ToolItem;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand All @@ -43,7 +43,7 @@ public static void onInitialize() {
if (stack.hasCustomName()) {
return stack.getName();
} else {
return new LiteralText("Unnamed gem.");
return Text.literal("Unnamed gem.");
}
}, Items.DIAMOND, Items.DIAMOND_BLOCK);
// Test registerSelf
Expand All @@ -53,7 +53,7 @@ public static void onInitialize() {
Item item = stack.getItem();

if (item instanceof ToolItem) {
return () -> new LiteralText("Tool mining level: " + ((ToolItem) item).getMaterial().getMiningLevel());
return () -> Text.literal("Tool mining level: " + ((ToolItem) item).getMaterial().getMiningLevel());
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

import net.fabricmc.fabric.test.lookup.api.Inspectable;
Expand All @@ -33,6 +32,6 @@ public InspectableItem(String inspectionResult) {

@Override
public Text inspect() {
return new LiteralText(inspectionResult);
return Text.literal(inspectionResult);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@
import com.mojang.brigadier.exceptions.CommandExceptionType;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.tree.CommandNode;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.client.MinecraftClient;
import net.minecraft.command.CommandException;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Texts;
import net.minecraft.text.TranslatableText;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand Down Expand Up @@ -133,7 +131,7 @@ private static Text getErrorMessage(CommandSyntaxException e) {
Text message = Texts.toText(e.getRawMessage());
String context = e.getContext();

return context != null ? new TranslatableText("command.context.parse_error", message, context) : message;
return context != null ? Text.translatable("command.context.parse_error", message, context) : message;
}

/**
Expand Down Expand Up @@ -177,7 +175,7 @@ private static int executeHelp(CommandNode<FabricClientCommandSource> startNode,
Map<CommandNode<FabricClientCommandSource>, String> commands = DISPATCHER.getSmartUsage(startNode, context.getSource());

for (String command : commands.values()) {
context.getSource().sendFeedback(new LiteralText("/" + command));
context.getSource().sendFeedback(Text.literal("/" + command));
}

return commands.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.network.MessageType;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Util;
Expand All @@ -45,7 +44,7 @@ public void sendFeedback(Text message) {

@Override
public void sendError(Text message) {
client.inGameHud.addChatMessage(MessageType.SYSTEM, new LiteralText("").append(message).formatted(Formatting.RED), Util.NIL_UUID);
client.inGameHud.addChatMessage(MessageType.SYSTEM, Text.literal("").append(message).formatted(Formatting.RED), Util.NIL_UUID);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;

public final class CommandTest implements ModInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandTest.class);
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_INTEGRATED = new SimpleCommandExceptionType(new LiteralText("This command was registered incorrectly. Should only be present on an integrated server but was ran on a dedicated server!"));
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_DEDICATED = new SimpleCommandExceptionType(new LiteralText("This command was registered incorrectly. Should only be present on an dedicated server but was ran on an integrated server!"));
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_INTEGRATED = new SimpleCommandExceptionType(Text.literal("This command was registered incorrectly. Should only be present on an integrated server but was ran on a dedicated server!"));
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_DEDICATED = new SimpleCommandExceptionType(Text.literal("This command was registered incorrectly. Should only be present on an dedicated server but was ran on an integrated server!"));

@Override
public void onInitialize() {
Expand Down Expand Up @@ -97,8 +97,8 @@ public void onInitialize() {

private int executeCommonCommand(CommandContext<ServerCommandSource> context) {
final ServerCommandSource source = context.getSource();
source.sendFeedback(new LiteralText("Common test command is working."), false);
source.sendFeedback(new LiteralText("Server Is Dedicated: " + source.getServer().isDedicated()), false);
source.sendFeedback(Text.literal("Common test command is working."), false);
source.sendFeedback(Text.literal("Server Is Dedicated: " + source.getServer().isDedicated()), false);

return 1;
}
Expand All @@ -110,8 +110,8 @@ private int executeDedicatedCommand(CommandContext<ServerCommandSource> context)
throw WRONG_SIDE_SHOULD_BE_DEDICATED.create();
}

source.sendFeedback(new LiteralText("Dedicated test command is working."), false);
source.sendFeedback(new LiteralText("Server Is Dedicated: " + source.getServer().isDedicated()), false);
source.sendFeedback(Text.literal("Dedicated test command is working."), false);
source.sendFeedback(Text.literal("Server Is Dedicated: " + source.getServer().isDedicated()), false);

return 1;
}
Expand All @@ -123,8 +123,8 @@ private int executeIntegratedCommand(CommandContext<ServerCommandSource> context
throw WRONG_SIDE_SHOULD_BE_INTEGRATED.create();
}

source.sendFeedback(new LiteralText("Integrated test command is working."), false);
source.sendFeedback(new LiteralText("Server Is Integrated: " + !source.getServer().isDedicated()), false);
source.sendFeedback(Text.literal("Integrated test command is working."), false);
source.sendFeedback(Text.literal("Server Is Integrated: " + !source.getServer().isDedicated()), false);

return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
Expand All @@ -39,15 +39,15 @@
@Environment(EnvType.CLIENT)
public final class ClientCommandTest implements ClientModInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger(ClientCommandTest.class);
private static final DynamicCommandExceptionType IS_NULL = new DynamicCommandExceptionType(x -> new LiteralText("The " + x + " is null"));
private static final SimpleCommandExceptionType UNEXECUTABLE_EXECUTED = new SimpleCommandExceptionType(new LiteralText("Executed an unexecutable command!"));
private static final DynamicCommandExceptionType IS_NULL = new DynamicCommandExceptionType(x -> Text.literal("The " + x + " is null"));
private static final SimpleCommandExceptionType UNEXECUTABLE_EXECUTED = new SimpleCommandExceptionType(Text.literal("Executed an unexecutable command!"));

private boolean wasTested = false;

@Override
public void onInitializeClient() {
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("test_client_command").executes(context -> {
context.getSource().sendFeedback(new LiteralText("This is a client command!"));
context.getSource().sendFeedback(Text.literal("This is a client command!"));

if (context.getSource().getClient() == null) {
throw IS_NULL.create("client");
Expand All @@ -70,7 +70,7 @@ public void onInitializeClient() {
double number = DoubleArgumentType.getDouble(context, "number");

// Test error formatting
context.getSource().sendError(new LiteralText("Your number is " + number));
context.getSource().sendError(Text.literal("Your number is " + number));

return 0;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.google.gson.JsonObject;

import net.minecraft.advancement.Advancement;
import net.minecraft.class_7403;
import net.minecraft.data.DataProvider;
import net.minecraft.data.DataWriter;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
Expand Down Expand Up @@ -69,7 +69,7 @@ protected Consumer<Advancement> withConditions(Consumer<Advancement> exporter, C
}

@Override
public void run(class_7403 cache) throws IOException {
public void run(DataWriter writer) throws IOException {
final Set<Identifier> identifiers = Sets.newHashSet();
final Set<Advancement> advancements = Sets.newHashSet();

Expand All @@ -83,7 +83,7 @@ public void run(class_7403 cache) throws IOException {
JsonObject advancementJson = advancement.createTask().toJson();
ConditionJsonProvider.write(advancementJson, FabricDataGenHelper.consumeConditions(advancement));

DataProvider.writeToPath(GSON, cache, advancementJson, getOutputPath(advancement));
DataProvider.writeToPath(GSON, writer, advancementJson, getOutputPath(advancement));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import com.google.gson.JsonObject;
import org.jetbrains.annotations.ApiStatus;

import net.minecraft.class_7403;
import net.minecraft.data.DataProvider;
import net.minecraft.data.DataWriter;
import net.minecraft.loot.LootManager;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.context.LootContextType;
Expand Down Expand Up @@ -69,7 +69,7 @@ default BiConsumer<Identifier, LootTable.Builder> withConditions(BiConsumer<Iden

@ApiStatus.Internal
@Override
default void run(class_7403 cache) throws IOException {
default void run(DataWriter writer) throws IOException {
HashMap<Identifier, LootTable> builders = Maps.newHashMap();
HashMap<Identifier, ConditionJsonProvider[]> conditionMap = new HashMap<>();

Expand All @@ -86,7 +86,7 @@ default void run(class_7403 cache) throws IOException {
JsonObject tableJson = (JsonObject) LootManager.toJson(entry.getValue());
ConditionJsonProvider.write(tableJson, conditionMap.remove(entry.getKey()));

DataProvider.writeToPath(GSON, cache, tableJson, getOutputPath(entry.getKey()));
DataProvider.writeToPath(GSON, writer, tableJson, getOutputPath(entry.getKey()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.google.common.collect.Sets;
import com.google.gson.JsonObject;

import net.minecraft.class_7403;
import net.minecraft.data.DataWriter;
import net.minecraft.data.server.RecipeProvider;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
Expand Down Expand Up @@ -65,7 +65,7 @@ protected Consumer<RecipeJsonProvider> withConditions(Consumer<RecipeJsonProvide
}

@Override
public void run(class_7403 cache) {
public void run(DataWriter writer) {
Path path = this.root.getOutput();
Set<Identifier> generatedRecipes = Sets.newHashSet();
generateRecipes(provider -> {
Expand All @@ -79,12 +79,12 @@ public void run(class_7403 cache) {
ConditionJsonProvider[] conditions = FabricDataGenHelper.consumeConditions(provider);
ConditionJsonProvider.write(recipeJson, conditions);

saveRecipe(cache, recipeJson, path.resolve("data/" + identifier.getNamespace() + "/recipes/" + identifier.getPath() + ".json"));
saveRecipe(writer, recipeJson, path.resolve("data/" + identifier.getNamespace() + "/recipes/" + identifier.getPath() + ".json"));
JsonObject advancementJson = provider.toAdvancementJson();

if (advancementJson != null) {
ConditionJsonProvider.write(advancementJson, conditions);
saveRecipeAdvancement(cache, advancementJson, path.resolve("data/" + identifier.getNamespace() + "/advancements/" + provider.getAdvancementId().getPath() + ".json"));
saveRecipeAdvancement(writer, advancementJson, path.resolve("data/" + identifier.getNamespace() + "/advancements/" + provider.getAdvancementId().getPath() + ".json"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import net.minecraft.block.Block;
import net.minecraft.class_7403;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DataWriter;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.client.ItemModelGenerator;
Expand Down Expand Up @@ -76,12 +76,12 @@ private void registerItemModels(ItemModelGenerator instance) {
}

@Inject(method = "run", at = @At("HEAD"))
private void runHead(class_7403 cache, CallbackInfo ci) {
private void runHead(DataWriter writer, CallbackInfo ci) {
dataGeneratorThreadLocal.set(generator);
}

@Inject(method = "run", at = @At("TAIL"))
private void runTail(class_7403 cache, CallbackInfo ci) {
private void runTail(DataWriter writer, CallbackInfo ci) {
dataGeneratorThreadLocal.remove();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ transitive-accessible method net/minecraft/data/client/TextureKey of (Ljava/
transitive-extendable method net/minecraft/data/server/AbstractTagProvider getOutput (Lnet/minecraft/util/Identifier;)Ljava/nio/file/Path;
transitive-extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder add ([Lnet/minecraft/util/registry/RegistryKey;)Lnet/minecraft/data/server/AbstractTagProvider$ObjectBuilder;

transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipe (Lnet/minecraft/class_7403;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipeAdvancement (Lnet/minecraft/class_7403;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipe (Lnet/minecraft/data/DataWriter;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipeAdvancement (Lnet/minecraft/data/DataWriter;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider generate (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerSingleOutputShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V
Expand Down
Loading

0 comments on commit ec94c6f

Please sign in to comment.