-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add nms module v1_21_R3 for Minecraft 1.21.4 support
- Loading branch information
Showing
22 changed files
with
1,491 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.craftaro</groupId> | ||
<artifactId>CraftaroCore-Modules</artifactId> | ||
<version>3.6.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>CraftaroCore-NMS-v1_21_R3</artifactId> | ||
|
||
<properties> | ||
<java.version>21</java.version> | ||
<java.release>21</java.release> | ||
|
||
<nms.ver>1.21.4-R0.1-SNAPSHOT</nms.ver> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.md-5</groupId> | ||
<artifactId>specialsource-maven-plugin</artifactId> | ||
<version>2.0.3</version> | ||
|
||
<executions> | ||
<execution> | ||
<id>remap-obf</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>remap</goal> | ||
</goals> | ||
|
||
<configuration> | ||
<srgIn>org.spigotmc:minecraft-server:${nms.ver}:txt:maps-mojang</srgIn> | ||
<reverse>true</reverse> | ||
<remappedDependencies>org.spigotmc:spigot:${nms.ver}:jar:remapped-mojang</remappedDependencies> | ||
<remappedArtifactAttached>true</remappedArtifactAttached> | ||
<remappedClassifierName>remapped-obf</remappedClassifierName> | ||
</configuration> | ||
</execution> | ||
|
||
<execution> | ||
<id>remap-spigot</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>remap</goal> | ||
</goals> | ||
|
||
<configuration> | ||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile> | ||
<srgIn>org.spigotmc:minecraft-server:${nms.ver}:csrg:maps-spigot</srgIn> | ||
<remappedDependencies>org.spigotmc:spigot:${nms.ver}:jar:remapped-obf</remappedDependencies> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<!--suppress VulnerableLibrariesLocal --> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot</artifactId> | ||
<version>${nms.ver}</version> | ||
<classifier>remapped-mojang</classifier> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!--suppress VulnerableLibrariesLocal --> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>CraftaroCore-NMS-API</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>CraftaroCore-Compatibility</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
72 changes: 72 additions & 0 deletions
72
NMS/NMS-v1_21_R3/src/main/java/com/craftaro/core/nms/v1_21_R3/NmsImplementationsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.craftaro.core.nms.v1_21_R3; | ||
|
||
import com.craftaro.core.nms.NmsImplementations; | ||
import com.craftaro.core.nms.entity.NMSPlayer; | ||
import com.craftaro.core.nms.entity.NmsEntity; | ||
import com.craftaro.core.nms.item.NmsItem; | ||
import com.craftaro.core.nms.nbt.NBTCore; | ||
import com.craftaro.core.nms.v1_21_R3.anvil.AnvilCore; | ||
import com.craftaro.core.nms.v1_21_R3.entity.NMSPlayerImpl; | ||
import com.craftaro.core.nms.v1_21_R3.entity.NmsEntityImpl; | ||
import com.craftaro.core.nms.v1_21_R3.item.NmsItemImpl; | ||
import com.craftaro.core.nms.v1_21_R3.nbt.NBTCoreImpl; | ||
import com.craftaro.core.nms.v1_21_R3.world.NmsWorldBorderImpl; | ||
import com.craftaro.core.nms.v1_21_R3.world.WorldCoreImpl; | ||
import com.craftaro.core.nms.world.NmsWorldBorder; | ||
import com.craftaro.core.nms.world.WorldCore; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class NmsImplementationsImpl implements NmsImplementations { | ||
private final NmsEntity entity; | ||
private final NMSPlayer player; | ||
private final WorldCore world; | ||
private final NmsWorldBorder worldBorder; | ||
private final com.craftaro.core.nms.anvil.AnvilCore anvil; | ||
private final NBTCore nbt; | ||
private final NmsItem item; | ||
|
||
public NmsImplementationsImpl() { | ||
this.entity = new NmsEntityImpl(); | ||
this.player = new NMSPlayerImpl(); | ||
this.world = new WorldCoreImpl(); | ||
this.worldBorder = new NmsWorldBorderImpl(); | ||
this.anvil = new AnvilCore(); | ||
this.nbt = new NBTCoreImpl(); | ||
this.item = new NmsItemImpl(); | ||
} | ||
|
||
@Override | ||
public @NotNull NmsEntity getEntity() { | ||
return this.entity; | ||
} | ||
|
||
@Override | ||
public @NotNull NMSPlayer getPlayer() { | ||
return this.player; | ||
} | ||
|
||
@Override | ||
public @NotNull WorldCore getWorld() { | ||
return this.world; | ||
} | ||
|
||
@Override | ||
public @NotNull NmsWorldBorder getWorldBorder() { | ||
return this.worldBorder; | ||
} | ||
|
||
@Override | ||
public @NotNull com.craftaro.core.nms.anvil.AnvilCore getAnvil() { | ||
return this.anvil; | ||
} | ||
|
||
@Override | ||
public @NotNull NBTCore getNbt() { | ||
return this.nbt; | ||
} | ||
|
||
@Override | ||
public @NotNull NmsItem getItem() { | ||
return this.item; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
NMS/NMS-v1_21_R3/src/main/java/com/craftaro/core/nms/v1_21_R3/anvil/AnvilCore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.craftaro.core.nms.v1_21_R3.anvil; | ||
|
||
import com.craftaro.core.nms.anvil.CustomAnvil; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import org.bukkit.craftbukkit.v1_21_R3.entity.CraftPlayer; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.InventoryHolder; | ||
|
||
public class AnvilCore implements com.craftaro.core.nms.anvil.AnvilCore { | ||
@Override | ||
public CustomAnvil createAnvil(Player player) { | ||
ServerPlayer p = ((CraftPlayer) player).getHandle(); | ||
return new AnvilView(p.nextContainerCounter(), p, null); | ||
} | ||
|
||
@Override | ||
public CustomAnvil createAnvil(Player player, InventoryHolder holder) { | ||
ServerPlayer p = ((CraftPlayer) player).getHandle(); | ||
return new AnvilView(p.nextContainerCounter(), p, holder); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...NMS-v1_21_R3/src/main/java/com/craftaro/core/nms/v1_21_R3/anvil/AnvilInventoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.craftaro.core.nms.v1_21_R3.anvil; | ||
|
||
import net.minecraft.world.Container; | ||
import net.minecraft.world.inventory.AnvilMenu; | ||
import org.bukkit.Location; | ||
import org.bukkit.craftbukkit.v1_21_R3.inventory.CraftInventoryAnvil; | ||
import org.bukkit.inventory.InventoryHolder; | ||
|
||
public class AnvilInventoryCustom extends CraftInventoryAnvil { | ||
final InventoryHolder holder; | ||
|
||
public AnvilInventoryCustom(InventoryHolder holder, Location location, Container inventory, Container resultInventory, AnvilMenu container) { | ||
super(location, inventory, resultInventory); | ||
|
||
this.holder = holder; | ||
} | ||
|
||
@Override | ||
public InventoryHolder getHolder() { | ||
return this.holder; | ||
} | ||
} |
Oops, something went wrong.