Skip to content

Commit

Permalink
Cleaned NMS and cleaned up file system loader, also added more functi…
Browse files Browse the repository at this point in the history
…on into /cswm list
  • Loading branch information
Swofty-Developments committed Nov 2, 2023
1 parent cd7db8d commit aa957c4
Show file tree
Hide file tree
Showing 48 changed files with 348 additions and 286 deletions.
13 changes: 8 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
<groupId>net.swofty</groupId>
<artifactId>swoftyworldmanager</artifactId>
<packaging>pom</packaging>
<version>3.0.2</version>
<version>3.0.5</version>
<modules>
<module>swoftyworldmanager-api</module>
<module>swoftyworldmanager-nms-common</module>
<module>swoftyworldmanager-nms-v1_8_R3</module>
<module>swoftyworldmanager-nms</module>
<module>swoftyworldmanager-plugin</module>
<module>swoftyworldmanager-importer</module>
<module>swoftyworldmanager-classmodifier</module>
Expand Down Expand Up @@ -66,18 +65,22 @@
<profile>
<id>github</id>
<activation>
<property>
<name>useGitHubPackages</name>
<value>true</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</snapshotRepository>
</distributionManagement>
</profile>
Expand Down
2 changes: 1 addition & 1 deletion swoftyworldmanager-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>swoftyworldmanager</artifactId>
<groupId>net.swofty</groupId>
<version>3.0.2</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public interface SlimeChunk {
SlimeChunkSection[] getSections();

/**
* Returns the height maps of the chunk. If it's a pre 1.13 world,
* a {@link com.flowpowered.nbt.IntArrayTag} containing the height
* Returns the height maps of the chunk. A
* {@link com.flowpowered.nbt.IntArrayTag} containing the height
* map will be stored inside here by the name of 'heightMap'.
*
* @return A {@link CompoundTag} containing all the height maps of the chunk.
*/
CompoundTag getHeightMaps();

/**
* Returns all the biomes of the chunk. In case it's a pre 1.13 world,
* every <code>int</code> inside the array will contain two biomes,
* Returns all the biomes of the chunk. Every
* <code>int</code> inside the array will contain two biomes,
* and should be converted into a <code>byte[]</code>.
*
* @return A <code>int[]</code> containing all the biomes of the chunk.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,19 @@
public interface SlimeChunkSection {

/**
* Returns all the blocks of the chunk section, or <code>null</code>
* in case it's a post 1.13 world.
* Returns all the blocks of the chunk section
*
* @return A <code>byte[]</code> with all the blocks of a chunk section.
*/
byte[] getBlocks();

/**
* Returns the data of all the blocks of the chunk section, or
* <code>null</code> if it's a post 1.13 world.
* Returns the data of all the blocks of the chunk section
*
* @return A {@link NibbleArray} containing all the blocks of a chunk section.
*/
NibbleArray getData();

/**
* Returns the block palette of the chunk section, or
* <code>null</code> if it's a pre 1.13 world.
*
* @return The block palette, contained inside a {@link ListTag}
*/
ListTag<CompoundTag> getPalette();

/**
* Returns all the states of the blocks of the chunk section, or
* <code>null</code> in case it's a pre 1.13 world.
*
* @return A <code>long[]</code> with every block state.
*/
long[] getBlockStates();

/**
* Returns the block light data.
*
Expand Down
27 changes: 26 additions & 1 deletion swoftyworldmanager-classmodifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>swoftyworldmanager</artifactId>
<groupId>net.swofty</groupId>
<version>3.0.2</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -89,4 +89,29 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>github</id>
<activation>
<property>
<name>useGitHubPackages</name>
<value>true</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project>
29 changes: 26 additions & 3 deletions swoftyworldmanager-importer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>swoftyworldmanager</artifactId>
<groupId>net.swofty</groupId>
<version>3.0.2</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>swoftyworldmanager-importer</artifactId>
Expand All @@ -16,7 +16,7 @@
</dependency>
<dependency>
<groupId>net.swofty</groupId>
<artifactId>swoftyworldmanager-nms-common</artifactId>
<artifactId>swoftyworldmanager-nms</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -82,5 +82,28 @@
</plugins>
</build>


<profiles>
<profile>
<id>github</id>
<activation>
<property>
<name>useGitHubPackages</name>
<value>true</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import net.swofty.swm.api.utils.SlimeFormat;
import net.swofty.swm.api.world.SlimeChunk;
import net.swofty.swm.api.world.SlimeChunkSection;
import net.swofty.swm.nms.CraftSlimeChunk;
import net.swofty.swm.nms.CraftSlimeChunkSection;
import net.swofty.swm.nms.craft.CraftSlimeChunk;
import net.swofty.swm.nms.craft.CraftSlimeChunkSection;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
35 changes: 0 additions & 35 deletions swoftyworldmanager-nms-common/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
<parent>
<artifactId>swoftyworldmanager</artifactId>
<groupId>net.swofty</groupId>
<version>3.0.2</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<artifactId>swoftyworldmanager-nms-v1_8_R3</artifactId>

<artifactId>swoftyworldmanager-nms</artifactId>
<dependencies>
<dependency>
<groupId>net.swofty</groupId>
<artifactId>swoftyworldmanager-nms-common</artifactId>
<artifactId>swoftyworldmanager-api</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.swofty</groupId>
<artifactId>swoftyworldmanager-api</artifactId>
<version>${project.version}</version>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>1.4.1-1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -39,5 +38,28 @@
</dependency>
</dependencies>


<profiles>
<profile>
<id>github</id>
<activation>
<property>
<name>useGitHubPackages</name>
<value>true</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Swofty-Developments/Continued-Slime-World-Manager</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package net.swofty.swm.nms.v1_8_R3;
package net.swofty.swm.nms;

import net.swofty.swm.clsm.CLSMBridge;
import net.swofty.swm.clsm.ClassModifier;
import lombok.RequiredArgsConstructor;
import net.minecraft.server.v1_8_R3.WorldServer;
import net.swofty.swm.nms.custom.CustomWorldServer;

@RequiredArgsConstructor
public class CraftCLSMBridge implements CLSMBridge {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package net.swofty.swm.nms.v1_8_R3;
package net.swofty.swm.nms;

import com.flowpowered.nbt.*;
import net.swofty.swm.api.utils.NibbleArray;
import net.swofty.swm.api.world.SlimeChunk;
import net.swofty.swm.api.world.SlimeChunkSection;
import net.swofty.swm.nms.CraftSlimeChunkSection;
import net.swofty.swm.nms.craft.CraftSlimeChunkSection;
import lombok.AllArgsConstructor;
import lombok.Data;
import net.minecraft.server.v1_8_R3.*;
import net.swofty.swm.nms.NMSUtil;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down Expand Up @@ -47,10 +48,10 @@ public SlimeChunkSection[] getSections() {

if (!section.a()) { // If the section is empty, just ignore it to save space
// Block Light Nibble Array
NibbleArray blockLightArray = Converter.convertArray(section.getEmittedLightArray());
NibbleArray blockLightArray = NMSUtil.convertArray(section.getEmittedLightArray());

// Sky light Nibble Array
NibbleArray skyLightArray = Converter.convertArray(section.getSkyLightArray());
NibbleArray skyLightArray = NMSUtil.convertArray(section.getSkyLightArray());

// Block Data
byte[] blocks = new byte[4096];
Expand Down Expand Up @@ -91,7 +92,7 @@ public List<CompoundTag> getTileEntities() {
for (TileEntity entity : chunk.getTileEntities().values()) {
NBTTagCompound entityNbt = new NBTTagCompound();
entity.b(entityNbt);
tileEntities.add((CompoundTag) Converter.convertTag("", entityNbt));
tileEntities.add((CompoundTag) NMSUtil.convertTag("", entityNbt));
}

return tileEntities;
Expand All @@ -107,7 +108,7 @@ public List<CompoundTag> getEntities() {

if (entity.d(entityNbt)) {
chunk.g(true);
entities.add((CompoundTag) Converter.convertTag("", entityNbt));
entities.add((CompoundTag) NMSUtil.convertTag("", entityNbt));
}
}
}
Expand Down
Loading

0 comments on commit aa957c4

Please sign in to comment.