Skip to content

Commit

Permalink
increased supported blockids to 65792 (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
Fabboz and Dream-Master authored Jan 18, 2025
1 parent a0cd5bd commit f49af4d
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.File;
import java.io.FileFilter;

import com.github.lunatrius.schematica.handler.ConfigurationHandler;

public class FileFilterSchematic implements FileFilter {

private final boolean directory;
Expand All @@ -16,9 +18,14 @@ public boolean accept(File file) {
if (this.directory) {
return file.isDirectory();
}

return file.getName()
.toLowerCase()
.endsWith(".schematic");
if (ConfigurationHandler.useSchematicplusFormat) {
return file.getName()
.toLowerCase()
.endsWith(".schemplus");
} else {
return file.getName()
.toLowerCase()
.endsWith(".schematic");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ protected void actionPerformed(GuiButton guiButton) {
this.btnEnable.displayString = ClientProxy.isRenderingGuide ? this.strOn : this.strOff;
this.btnSave.enabled = ClientProxy.isRenderingGuide;
} else if (guiButton.id == this.btnSave.id) {
String path = this.tfFilename.getText() + ".schematic";
String path;
if (ConfigurationHandler.useSchematicplusFormat) {
path = this.tfFilename.getText() + ".schemplus";
} else {
path = this.tfFilename.getText() + ".schematic";
}
if (Schematica.proxy.saveSchematic(
this.mc.thePlayer,
ConfigurationHandler.schematicDirectory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.github.lunatrius.core.util.vector.Vector3f;
import com.github.lunatrius.core.util.vector.Vector3i;
import com.github.lunatrius.schematica.api.ISchematic;
import com.github.lunatrius.schematica.handler.ConfigurationHandler;
import com.github.lunatrius.schematica.reference.Reference;
import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic;
import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic;
Expand Down Expand Up @@ -64,7 +65,11 @@ public SchematicWorld(ISchematic schematic) {

public SchematicWorld(ISchematic schematic, String filename) {
this(schematic);
this.name = filename.replace(".schematic", "");
if (ConfigurationHandler.useSchematicplusFormat) {
this.name = filename.replace(".schemplus", "");
} else {
this.name = filename.replace(".schematic", "");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.github.lunatrius.schematica.FileFilterSchematic;
import com.github.lunatrius.schematica.Schematica;
import com.github.lunatrius.schematica.api.ISchematic;
import com.github.lunatrius.schematica.handler.ConfigurationHandler;
import com.github.lunatrius.schematica.handler.DownloadHandler;
import com.github.lunatrius.schematica.network.transfer.SchematicTransfer;
import com.github.lunatrius.schematica.reference.Names;
Expand Down Expand Up @@ -69,7 +70,13 @@ public void processCommand(ICommandSender sender, String[] args) {
throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY);
}

final String filename = args[0] + ".schematic";
final String filename;
if (ConfigurationHandler.useSchematicplusFormat) {
filename = args[0] + ".schemplus";
} else {
filename = args[0] + ".schematic";
}

final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true);
if (!FileUtils.contains(directory, filename)) {
Reference.logger.error("{} has tried to download the file {}", player.getDisplayName(), filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class ConfigurationHandler {
public static Configuration configuration;

public static final boolean SHOW_DEBUG_INFO_DEFAULT = true;
public static final boolean EXTENDED_ID_FORMAT_DEFAULT = false;
public static final boolean ENABLE_ALPHA_DEFAULT = false;
public static final double ALPHA_DEFAULT = 1.0;
public static final boolean HIGHLIGHT_DEFAULT = true;
Expand Down Expand Up @@ -57,6 +58,7 @@ public class ConfigurationHandler {
public static final boolean SERVERSIDE_SCHEMATICS_ENABLED_DEFAULT = true;

public static boolean showDebugInfo = SHOW_DEBUG_INFO_DEFAULT;
public static boolean useSchematicplusFormat = EXTENDED_ID_FORMAT_DEFAULT;
public static boolean enableAlpha = ENABLE_ALPHA_DEFAULT;
public static float alpha = (float) ALPHA_DEFAULT;
public static boolean highlight = HIGHLIGHT_DEFAULT;
Expand All @@ -82,6 +84,7 @@ public class ConfigurationHandler {
public static boolean serversideSchematicsEnabled = SERVERSIDE_SCHEMATICS_ENABLED_DEFAULT;

public static Property propShowDebugInfo = null;
public static Property propUseSchematicplusFormat = null;
public static Property propEnableAlpha = null;
public static Property propAlpha = null;
public static Property propHighlight = null;
Expand Down Expand Up @@ -284,6 +287,14 @@ public static void loadConfiguration() {
}
}

propUseSchematicplusFormat = configuration.get(
Names.Config.Category.GENERAL,
Names.Config.EXTENDED_ID_FORMAT,
EXTENDED_ID_FORMAT_DEFAULT,
Names.Config.EXTENDED_ID_FORMAT_DESC);
propUseSchematicplusFormat.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTENDED_ID_FORMAT);
useSchematicplusFormat = propUseSchematicplusFormat.getBoolean(EXTENDED_ID_FORMAT_DEFAULT);

propSortType = configuration
.get(Names.Config.Category.GENERAL, Names.Config.SORT_TYPE, SORT_TYPE_DEFAULT, Names.Config.SORT_TYPE_DESC);
propSortType.setShowInGui(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public static final class Category {

public static final String SHOW_DEBUG_INFO = "showDebugInfo";
public static final String SHOW_DEBUG_INFO_DESC = "Display extra information on the debug screen (F3).";
public static final String EXTENDED_ID_FORMAT = "useSchematicplusFormat";
public static final String EXTENDED_ID_FORMAT_DESC = "Save and load schematics with a different format that supports a much higher number of block ids. Only schematics in schemplus format will be loaded.";
public static final String ALPHA_ENABLED = "alphaEnabled";
public static final String ALPHA_ENABLED_DESC = "Enable transparent textures.";
public static final String ALPHA = "alpha";
Expand Down
Loading

0 comments on commit f49af4d

Please sign in to comment.