Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ publishing {
// retrieving dependencies.
}
}

loom {
// accessWidener = file("src/main/resources/skyplusplus.accesswidener")
// accessWidenerPath = file("src/main/resources/skyplusplus.accesswidener")
runConfigs.all {
ideConfigGenerated true // Run configurations are not created for subprojects by default
runDir "../../run" // Use a shared run folder and create separate worlds
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ stonecutter {
centralScript = "build.gradle"

create(getRootProject()) {
versions "1.19.2", "1.19.4", "1.20.1", "1.20.4"
versions "1.19.2", "1.19.4", "1.20.1", "1.20.4", "1.21.8"
}
}
8 changes: 4 additions & 4 deletions src/main/java/com/anotherpillow/skyplusplus/SkyPlusPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
//? if >=1.20.1 {
/*import net.minecraft.client.gui.DrawContext;
*///?} else {
import net.minecraft.client.gui.DrawableHelper;
//?}
import net.minecraft.client.gui.DrawContext;
//?} else {
/*import net.minecraft.client.gui.DrawableHelper;
*///?}

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.anotherpillow.skyplusplus.config.SkyPlusPlusConfig;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
//? >=1.21
import org.joml.Matrix3x2f;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -99,7 +101,19 @@ public void onInitializeClient() {
}


TraderImage.draw(/*? >=1.20.1 {*/ /*renderObject.getMatrices() *//*?} else {*/ renderObject /*?}*/);
//? <1.21 && >=1.20.1 {
/*TraderImage.draw(renderObject.getMatrices());
*///?} else if <1.20.1 {
/*TraderImage.draw(renderObject);
*///?}


//? >=1.21 {
Matrix3x2f m = new Matrix3x2f();
renderObject.getMatrices().get(m);
TraderImage.draw(m);
//?}

}

});
Expand All @@ -112,10 +126,10 @@ public void onInitializeClient() {
DiscordRPC.onTick();

//? if >1.19.2 {
/*BlockPos pos = new BlockPos((int) player.getX(), (int) player.getY(), (int) player.getZ());
*///?} else {
BlockPos pos = new BlockPos(player.getX(), player.getY(), player.getZ());
//?}
BlockPos pos = new BlockPos((int) player.getX(), (int) player.getY(), (int) player.getZ());
//?} else {
/*BlockPos pos = new BlockPos(player.getX(), player.getY(), player.getZ());
*///?}
if (pos.equals(lastPos)) return;

if (config.enableTraderFinder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.client.MinecraftClient;
//? >=1.21 {
import net.minecraft.component.ComponentMap;
import net.minecraft.component.DataComponentTypes;
//}?
import net.minecraft.component.type.ProfileComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
Expand All @@ -29,7 +34,8 @@ public class GetHeadTextureCommand {
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
MinecraftClient client = MinecraftClient.getInstance();

dispatcher.register(ClientCommandManager.literal("getheadtexture").executes(context -> {
//? <1.21 {
/*dispatcher.register(ClientCommandManager.literal("getheadtexture").executes(context -> {
if (client.player == null) {
return 0;
}
Expand All @@ -46,7 +52,16 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
return;
}

//? if >=1.21 {
ComponentMap components = mainHand.getComponents();

if (components.isEmpty()) {
return;
}


NbtCompound itemTag = mainHand.getNbt();

if (itemTag == null) {
return;
}
Expand All @@ -57,6 +72,10 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
}
NbtCompound skullOwner = itemTag.getCompound("SkullOwner");





if (!skullOwner.contains("Properties", NbtElement.COMPOUND_TYPE)) {
Chat.send(Chat.addLogo("No Properties tag found in SkullOwner"));
return;
Expand Down Expand Up @@ -129,6 +148,8 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
Chat.send(Chat.addLogo(finalMessage));
});
return 1;
}));
}));*///?}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
client.send(() -> {
ItemStack mainHand = client.player.getStackInHand(Hand.MAIN_HAND);

if (!mainHand.hasNbt()) {
//? <1.21 {
/*if (!mainHand.hasNbt()) {
Chat.send(Chat.addLogo("No NBT found on held item"));
return;
}
Expand All @@ -46,6 +47,9 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
String jsonNBT = NbtOps.INSTANCE.convertTo(JsonOps.INSTANCE, nbt).toString();
MutableText txt = Text.literal(jsonNBT)
.setStyle(Style.EMPTY.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, jsonNBT)).withUnderline(true));
*///?} else {
MutableText txt = Text.of("no worky on 1.21.8").copy();
//?}

Chat.send(Chat.addLogo(txt));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public void run() {
client.send(() -> {
if (client.player == null) return;
//? if >1.19.2 {
/*if (command.startsWith("/")) client.getNetworkHandler().sendChatMessage(command.substring(1));
if (command.startsWith("/")) client.getNetworkHandler().sendChatMessage(command.substring(1));
else client.getNetworkHandler().sendChatMessage(command);
*///?} else {
if (command.startsWith("/")) client.player.sendCommand(command.substring(1), Text.empty());
//?} else {
/*if (command.startsWith("/")) client.player.sendCommand(command.substring(1), Text.empty());
else client.player.sendChatMessage(command, Text.of(command));
//?}
*///?}

});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
//? if >1.19.2 {
/*import net.minecraft.registry.Registries;
*///?} else {
import net.minecraft.util.registry.Registry;
//?}
import net.minecraft.registry.Registries;
//?} else {
/*import net.minecraft.util.registry.Registry;
*///?}

import java.io.IOException;
import java.net.URI;
Expand All @@ -45,20 +45,31 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
return 0;
}

CompletableFuture.runAsync(() -> {
//? if >=1.21 {
Runnable placeholder = () -> {
//?} else {
/*CompletableFuture.runAsync(() -> {
*///?}

ItemStack mainHand = client.player.getStackInHand(Hand.MAIN_HAND);

String jsonNBT = "{}";
if (mainHand.hasNbt()) {
//? if >=1.21 {
//?} else {
/*if (mainHand.hasNbt()) {
NbtCompound nbt = mainHand.getNbt();
jsonNBT = NbtOps.INSTANCE.convertTo(JsonOps.INSTANCE, nbt).toString();
}
*///?}


//? if >1.19.2 {
/*String itemId = Registries.ITEM.getKey(mainHand.getItem()).get().getValue().toString();
*///?} else {
String itemId = Registry.ITEM.getKey(mainHand.getItem()).get().getValue().toString();
//?}
String itemId = Registries.ITEM.getKey(mainHand.getItem()).get().getValue().toString();
//?} else {
/*String itemId = Registry.ITEM.getKey(mainHand.getItem()).get().getValue().toString();
*///?}

if (jsonNBT.equals("{}")) return;

Gson gson = new Gson();
JsonObject json = new JsonObject();
Expand Down Expand Up @@ -103,7 +114,12 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
String url = bodyJson.get("message").getAsString();
MutableText urlText = Text.literal(url)
.setStyle(Style.EMPTY.withClickEvent(
new ClickEvent(ClickEvent.Action.OPEN_URL, url))
//? if >=1.21 {
new ClickEvent.OpenUrl(URI.create(url)))
//?} else {
/*new ClickEvent(ClickEvent.Action.OPEN_URL, url))
*///?}

.withUnderline(true));
MutableText finalMessage = Text.literal("Shared URL: ").append(urlText);
Chat.send(Chat.addLogo(finalMessage));
Expand All @@ -112,7 +128,12 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
}


});

//? if >=1.21 {
};
//?} else {
/*});
*///?}
return 1;
}));
}
Expand Down
Loading
Loading