Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increased supported blockids to 65792 #25

Merged
merged 4 commits into from
Jan 18, 2025
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
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