Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
binary1024x2 committed Jun 13, 2024
1 parent c04d863 commit c14403f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ run/
hs_err_*.log
replay_*.log
*.hprof
*.jfr
*.jfr

remappedSrc/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Exportable Structures

![Environment](https://img.shields.io/badge/environment-client-1976d2?style=flat-square) ![Loader](https://img.shields.io/badge/mod%20loader-fabric-d64541?style=flat-square) ![GitHub Release](https://img.shields.io/github/v/release/binary1024x2/exportable-structures)

This mod exists for the cases when a custom launcher breaks the structure blocks in Minecraft.

This mod adds a button **Export** in the **Save** mode of the structure block screen that lets you chose a folder where to export the structure.
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.1
loader_version=0.15.11

# Mod Properties
mod_version = 1.1_1.20.6
mod_version = 1.1_1.21
maven_group = xyz.binarydev.exportablestructures
archives_base_name = exportable-structures

# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.98.0+1.20.6
fabric_version=0.100.1+1.21
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void onInitialize() {
StructureTemplateManager manager = server.getStructureTemplateManager();
StructureTemplate template;
try {
template = manager.getTemplateOrBlank(new Identifier(structureBlock.getTemplateName()));
template = manager.getTemplateOrBlank(Identifier.of(structureBlock.getTemplateName()));
} catch (InvalidIdentifierException ex) {
LOGGER.warn("Failed to create template", ex);
context.player().sendMessage(Text.translatable("exportable_structures.message.unable_to_export"), false);
Expand All @@ -58,7 +58,7 @@ public void onInitialize() {
try {
FileStructureTemplateManager fileManager = new FileStructureTemplateManager(manager);
File target = new File(payload.getPath());
if (fileManager.saveToFile(target, new Identifier(structureBlock.getTemplateName()))) {
if (fileManager.saveToFile(target, Identifier.of(structureBlock.getTemplateName()))) {
context.player().sendMessage(Text.translatable("exportable_structures.message.saved_structure_file", structureBlock.getTemplateName(), target.toString()), false);
} else {
context.player().sendMessage(Text.translatable("exportable_structures.message.failed_save_structure_file", structureBlock.getTemplateName(), target.toString()), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private File getPath(File parent, Identifier id) {

public Optional<StructureTemplate> loadFromFile(File file) {
String md5 = getPathHash(file);
Identifier id = new Identifier("exportable-structures", md5);
Identifier id = Identifier.of("exportable-structures", md5);
loadedStructures.putIfAbsent(id, file);
return loadStructure(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

public class SaveStructureToFilePayload implements CustomPayload {

public static final Id<SaveStructureToFilePayload> ID = CustomPayload.id("exportablestructures:save_structure_to_file");
public static final Id<SaveStructureToFilePayload> ID = new CustomPayload.Id<>(Identifier.of("exportablestructures:save_structure_to_file"));
public static final PacketCodec<PacketByteBuf, SaveStructureToFilePayload> CODEC = PacketCodec.of(SaveStructureToFilePayload::write, SaveStructureToFilePayload::new);

private final String path;
Expand Down

0 comments on commit c14403f

Please sign in to comment.