Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
7e0642b
Improve LocalWorld#isStructureInRadius implementations
Meldexun Oct 8, 2025
0f1ca97
Improve EntityNames#toInternalName
Meldexun Oct 9, 2025
94d0fb6
Fix captureBlockSnapshots corruption when setBlockState errors
Meldexun Oct 9, 2025
02ca237
Clean up BlockPos2D
Meldexun Oct 9, 2025
39e132e
Fix missing BlockPos2D#hashCode implementation
Meldexun Oct 9, 2025
542fbbb
Clean up BlockPos3D
Meldexun Oct 9, 2025
0c052e6
Fix BlockPos3D#equals
Meldexun Oct 9, 2025
73634bc
Fix missing BlockPos3D#hashCode implementation
Meldexun Oct 9, 2025
455d19e
Replace FifoMap with LRUCache
Meldexun Oct 9, 2025
528f4e0
Improve DimensionConfigBase constructor
Meldexun Oct 9, 2025
8552b28
Improve DefaultMaterial lookups
Meldexun Oct 9, 2025
d466210
Improve PlantType lookup
Meldexun Oct 9, 2025
dc105c7
Improve ChunkGenerator#getChunk
Meldexun Oct 12, 2025
2315e7b
Clean up BiomeGroup
Meldexun Oct 13, 2025
e7667aa
Fix unnecessary ArrayList creation
Meldexun Oct 13, 2025
ffa6b62
Improve BiomeGroup depth map cache
Meldexun Oct 13, 2025
153b7a7
Remove unnecessary initGroupSeed call
Meldexun Oct 13, 2025
532b392
Rename getRandomOf4 to mostCommonOrRandom
Meldexun Oct 13, 2025
8c3316f
Improve mostCommonOrRandom
Meldexun Oct 13, 2025
f78ee4e
Add InvalidConfigException constructor with cause argumnet
Meldexun Oct 14, 2025
d409671
Clean up StringHelper
Meldexun Oct 14, 2025
b271c65
Improve StringHelper.readCommaSeperatedString
Meldexun Oct 14, 2025
788137a
Clean up Resource.hashCode
Meldexun Oct 14, 2025
22a9736
Improve FileSettingsReaderOTGPlus.readSettings
Meldexun Oct 15, 2025
e24eda1
Improve NBT reading
Meldexun Oct 15, 2025
539033a
Fix silver shulker box id
Meldexun Oct 16, 2025
53d04b2
Add glazed terracotta
Meldexun Oct 16, 2025
8662401
Remove "UNKNOWN_BLOCK"
Meldexun Oct 16, 2025
d037581
Add fastutil dependency
Meldexun Oct 11, 2025
eb4add9
Improve layer random number generator
Meldexun Oct 11, 2025
6e2a4d9
Create WeightedList to replace TreeMap iteration
Meldexun Oct 14, 2025
8151a35
Format LocalMaterialData
Meldexun Oct 6, 2025
a6573b8
Format ReplacedBlocksMatrix
Meldexun Oct 14, 2025
741646e
Reimplement LocalMaterialData
Meldexun Oct 14, 2025
3b3bb83
Fix LocalMaterialData#isSolid implementation
Meldexun Oct 17, 2025
14fb07f
Fix IndexOutOfBoundsException
Meldexun Oct 17, 2025
d6b995c
Fix reading last element of string list
Meldexun Oct 17, 2025
15cc52d
Remove unused import
Meldexun Oct 17, 2025
3b011ce
Remove unused DefaultMaterial#isSolid
Meldexun Oct 17, 2025
f2b5940
Fix missing fastutil on bukkit
Meldexun Oct 17, 2025
9194a1c
Increment world save version
Meldexun Oct 17, 2025
5eedc4e
Fix parseForWorld returning null
Meldexun Oct 17, 2025
a9e60b1
Fix NoSuchElementException
Meldexun Oct 19, 2025
1887a6b
Fix OTGChunkGenerator#getBlockColumnInUnloadedChunk returning empty a…
Meldexun Oct 19, 2025
d869b6c
Fix missing null or empty check
Meldexun Oct 21, 2025
cf167f4
Fix check if material is in material set
Meldexun Oct 21, 2025
811fa6f
Add commons-lang dependency
Meldexun Oct 24, 2025
cbe0503
Fix not finding blocks by OTG name
Meldexun Oct 24, 2025
67a0ee2
Fix not finding entities by OTG alias
Meldexun Oct 24, 2025
0bbe4a4
Clean up CustomStructure
Meldexun Oct 19, 2025
b3cdb2e
Fix CustomStructure#hashCode ignoring x, y, z
Meldexun Oct 19, 2025
cd1ac6c
Fix CustomStructureCoordinate#hashCode ignoring parts of x, y
Meldexun Oct 19, 2025
e895b74
Fix comments
Meldexun Oct 21, 2025
7fe629e
Remove unused import
Meldexun Oct 23, 2025
25fa41e
Delete unused class BlockHelper
Meldexun Oct 24, 2025
181c34e
Clean up MaterialSet
Meldexun Oct 23, 2025
20528c1
Add floorDiv and floorMod methods
Meldexun Oct 23, 2025
a33fbc2
Improve ChunkCoordinate math
Meldexun Oct 23, 2025
4766a1f
Improve CustomStructureCoordinate
Meldexun Oct 21, 2025
40975e4
Add cache for MaterialSet instances
Meldexun Oct 21, 2025
fd16a86
Remove setting captureBlockStates to true
Meldexun Oct 21, 2025
535df24
Add methods to create (de-)compression streams
Meldexun Oct 19, 2025
2f30d1d
Improve string reading/writing
Meldexun Oct 23, 2025
645999d
Improve LayerFromImage memory requirement
Meldexun Oct 20, 2025
58296cc
Improve NBT tag IO
Meldexun Oct 17, 2025
db88dbd
Improve BO4 reading/writing
Meldexun Oct 22, 2025
9d994df
Improve CustomStructureFileManager
Meldexun Oct 22, 2025
a2b1edc
Remove unused (de-)compress methods
Meldexun Oct 23, 2025
a54a051
Remove unused readStringFromBuffer method
Meldexun Oct 22, 2025
bf72799
Move coords into a single int in CustomObjectConfigFunction
Meldexun Oct 22, 2025
065087d
Remove holder field
Meldexun Oct 22, 2025
bcefebd
Remove error info fields
Meldexun Oct 22, 2025
67a699f
Create TagProvider.java
Meldexun Oct 22, 2025
d44ce67
Create TagContainer.java
Meldexun Oct 22, 2025
099dfaa
Create BlockContainer.java
Meldexun Oct 22, 2025
b612d94
Replace material, nbt, nbtPath fields with BlockContainer field
Meldexun Oct 22, 2025
e6bd508
Cache BlockFunctions of BO3s and BO4s
Meldexun Oct 23, 2025
0d76027
Clean up rotation code
Meldexun Oct 23, 2025
002212c
Avoid potential NPEs
Meldexun Oct 24, 2025
5207d12
Fix BO4 trying to place null
Meldexun Oct 24, 2025
60380fd
Fix material comparisons
Meldexun Oct 31, 2025
4b781fb
Fix ReplacedBlocksMatrix#replaceBlock using wrong keys
Meldexun Oct 26, 2025
cc52760
Fix BlockContainer#of using wrong key
Meldexun Oct 31, 2025
7c7828a
Improve BO3 generation
Meldexun Oct 24, 2025
88a7f61
Fix deadlock when calling CustomStructureCache#saveToDisk
Meldexun Nov 1, 2025
d864d74
Fix bias when calculating randomized spawnpoint
Meldexun Nov 1, 2025
114300b
Avoid IndexOutOfBoundsException
Meldexun Nov 1, 2025
00ba693
Fix NullPointerException
Meldexun Nov 1, 2025
b452a34
Improve LayerBiomeBorder#getInts
Meldexun Nov 5, 2025
c733116
Improve random block function reading
Meldexun Nov 1, 2025
c6bf1b8
Cache common material relations
Meldexun Nov 14, 2025
5685f34
Cache air material
Meldexun Nov 14, 2025
c32aa76
Cleanup method return types
Meldexun Nov 14, 2025
33b3711
Fix out of bounds coordinates
Meldexun Nov 5, 2025
5befa55
Remove unnecessary variable initialization
Meldexun Nov 25, 2025
58bcde6
Fix getBlocks gettings called twice
Meldexun Jan 15, 2026
79e0ec3
Clean up VeinGen.hashCode
Meldexun Nov 25, 2025
3a2bd36
Rename Vein.spawnOre variables
Meldexun Jan 15, 2026
22b7638
Use floats instead of doubles in Vein.spawnOre
Meldexun Jan 15, 2026
1b3db3b
Clean up Vein.spawnOre
Meldexun Jan 15, 2026
d3b3cd0
Improve Vein.spawnOre
Meldexun Jan 15, 2026
f17d9fb
Fix BO4 block rotation
Meldexun Jan 15, 2026
4f1db13
Fix Rotation.next
Meldexun Jan 15, 2026
ba76ad5
Improve Rotation
Meldexun Jan 15, 2026
c289a1c
Clean up string checks
Meldexun Jan 15, 2026
eba5bfe
Fix smoothing ignoring smoothStartTop setting
Meldexun Feb 4, 2026
4a03ff2
Rename to match other variables
Meldexun Feb 6, 2026
28d2627
Fix inverted hasTag check
Meldexun Feb 6, 2026
23f60f0
Fixed formatting strings
NLBlackEagle Feb 6, 2026
5f17041
Use cursemaven for up to date worldedit versions
Meldexun Feb 10, 2026
4dae849
Add forge run configurations
NLBlackEagle Feb 9, 2026
3d99d5a
Update gradle wrapper to 8.14.3
Meldexun Feb 10, 2026
d3821d6
Fix writing too many nbt compound end markers
Meldexun Feb 17, 2026
e5b1eff
Cleanup CompressionUtils.newGZIPInputStream
Meldexun Feb 17, 2026
954bf97
Fix autocomplete ignoring what you was typed
Meldexun Feb 17, 2026
675fdeb
Use Collection.emptyList
Meldexun Feb 17, 2026
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
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ allprojects {
repositories {
mavenLocal()
mavenCentral()
exclusiveContent {
forRepository {
maven { url "https://cursemaven.com" }
}
filter { includeGroup "curse.maven" }
}
}

version = "${minecraft_version}-${mod_version}"
Expand Down
2 changes: 2 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jackson_version}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
implementation "org.yaml:snakeyaml:${snakeyaml_version}"
implementation 'it.unimi.dsi:fastutil:7.1.0'
implementation 'org.apache.commons:commons-lang3:3.5'
}

shadowJar {
Expand Down
65 changes: 24 additions & 41 deletions common/src/main/java/com/pg85/otg/OTG.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,22 @@
import com.pg85.otg.generator.resource.Resource;
import com.pg85.otg.logging.LogMarker;
import com.pg85.otg.util.ChunkCoordinate;
import com.pg85.otg.util.CompressionUtils;

import java.io.ByteArrayOutputStream;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import org.apache.commons.lang3.StringUtils;

public class OTG
{
// Used to determine if a new world is being created or if a world save already exists
Expand Down Expand Up @@ -366,49 +369,29 @@ public static boolean IsInAreaBeingPopulated(int blockX, int blockZ, ChunkCoordi

public static boolean bo4DataExists(BO4Config config)
{
String filePath =
config.getFile().getAbsolutePath().endsWith(".BO4") ? config.getFile().getAbsolutePath().replace(".BO4", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".bo4") ? config.getFile().getAbsolutePath().replace(".bo4", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".BO3") ? config.getFile().getAbsolutePath().replace(".BO3", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".bo3") ? config.getFile().getAbsolutePath().replace(".bo3", ".BO4Data") :
config.getFile().getAbsolutePath();

File file = new File(filePath);
return file.exists();
return Files.exists(getBO4DataFile(config));
}

public static void generateBO4Data(BO4Config config)
{
//write to disk
String filePath =
config.getFile().getAbsolutePath().endsWith(".BO4") ? config.getFile().getAbsolutePath().replace(".BO4", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".bo4") ? config.getFile().getAbsolutePath().replace(".bo4", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".BO3") ? config.getFile().getAbsolutePath().replace(".BO3", ".BO4Data") :
config.getFile().getAbsolutePath().endsWith(".bo3") ? config.getFile().getAbsolutePath().replace(".bo3", ".BO4Data") :
config.getFile().getAbsolutePath();

File file = new File(filePath);
if(!file.exists())
try(DataOutputStream out = new DataOutputStream(new BufferedOutputStream(CompressionUtils.newDeflaterOutputStream(getBO4DataFile(config)))))
{
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
config.writeToStream(dos);
byte[] compressedBytes = com.pg85.otg.util.CompressionUtils.compress(bos.toByteArray());
dos.close();
FileOutputStream fos = new FileOutputStream(file);
DataOutputStream dos2 = new DataOutputStream(fos);
dos2.write(compressedBytes, 0, compressedBytes.length);
dos2.close();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
config.writeToStream(out);
}
catch(IOException e)
{
e.printStackTrace();
}
}

private static Path getBO4DataFile(BO4Config config)
{
Path file = config.getFile().toPath();
String name = file.getFileName().toString();
if(StringUtils.endsWithIgnoreCase(name, ".BO4") || StringUtils.endsWithIgnoreCase(name, ".BO3"))
{
return file.resolveSibling(name.substring(0, name.length() - 4) + ".BO4Data");
}
return file;
}
}
156 changes: 156 additions & 0 deletions common/src/main/java/com/pg85/otg/common/BlockContainer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package com.pg85.otg.common;

import java.nio.file.Path;
import java.util.Objects;

import com.pg85.otg.util.bo3.NamedBinaryTag;
import com.pg85.otg.util.bo3.Rotation;

import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap;
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;

public abstract class BlockContainer
{
protected final LocalMaterialData material;

protected BlockContainer(LocalMaterialData material)
{
this.material = Objects.requireNonNull(material);
}

public static BlockContainer of(LocalMaterialData material)
{
return WithoutTag.of(material);
}

public static BlockContainer of(LocalMaterialData material, Path directory, String relativePath)
{
return WithTag.of(material, directory, relativePath);
}

public LocalMaterialData material()
{
return material;
}

public abstract boolean hasTag();

public abstract NamedBinaryTag tag();

public abstract String tagPath();

public BlockContainer withMaterial(BlockContainer other)
{
return withMaterial(other.material);
}

public abstract BlockContainer withMaterial(LocalMaterialData material);

public abstract BlockContainer rotate(Rotation rotation);

public static class WithoutTag extends BlockContainer
{
private static final Reference2ReferenceMap<LocalMaterialData, WithoutTag> INSTANCES = new Reference2ReferenceOpenHashMap<>();

private WithoutTag(LocalMaterialData material)
{
super(material);
}

public static BlockContainer of(LocalMaterialData material)
{
return INSTANCES.computeIfAbsent(material.withBlockData(), WithoutTag::new);
}

@Override
public boolean hasTag()
{
return false;
}

@Override
public NamedBinaryTag tag()
{
return null;
}

@Override
public String tagPath()
{
return null;
}

@Override
public BlockContainer withMaterial(LocalMaterialData material)
{
if(material == this.material)
return this;
return of(material);
}

@Override
public BlockContainer rotate(Rotation rotation)
{
LocalMaterialData rotatedMaterial;
if((rotatedMaterial = material.rotate(rotation)) == material)
{
return this;
}
return of(rotatedMaterial);
}
}

public static class WithTag extends BlockContainer
{
private final TagContainer tagContainer;

private WithTag(LocalMaterialData material, TagContainer tagContainer)
{
super(material);
this.tagContainer = Objects.requireNonNull(tagContainer);
}

public static BlockContainer of(LocalMaterialData material, Path directory, String tagFileName)
{
// TODO implement cache?
return new WithTag(material, TagContainer.of(directory, tagFileName));
}

@Override
public boolean hasTag()
{
return true;
}

@Override
public NamedBinaryTag tag()
{
return tagContainer.getTag();
}

@Override
public String tagPath()
{
return tagContainer.getRelativePath();
}

@Override
public BlockContainer withMaterial(LocalMaterialData material)
{
if(material == this.material)
return this;
return new WithTag(material, tagContainer);
}

@Override
public BlockContainer rotate(Rotation rotation)
{
LocalMaterialData rotatedMaterial;
if((rotatedMaterial = material.rotate(rotation)) == material)
{
return this;
}
return new WithTag(rotatedMaterial, tagContainer);
}
}
}
Loading