9
0
mirror of https://github.com/PSYCHEER/VanillaCustomizer.git synced 2025-12-19 15:09:17 +00:00

1.21.4 NMS

Properly tested 1.21.4 NMS for VanillaCustomizer, working on production.
This commit is contained in:
PSYCHEER
2025-02-16 12:49:55 +01:00
parent c058c92d52
commit 201ce31710
4 changed files with 108 additions and 0 deletions

View File

@@ -85,6 +85,11 @@
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<dependency>
<groupId>dev.lone</groupId>
<artifactId>VanillaCustomizer-nms-v1_21_4</artifactId>
<version>1.0</version>
</dependency>
<dependency> <dependency>
<groupId>dev.lone</groupId> <groupId>dev.lone</groupId>
<artifactId>VanillaCustomizer-nms-v1_21_3</artifactId> <artifactId>VanillaCustomizer-nms-v1_21_3</artifactId>

View File

@@ -0,0 +1,54 @@
<?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">
<parent>
<artifactId>VanillaCustomizer</artifactId>
<groupId>dev.lone</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>VanillaCustomizer-nms-v1_21_4</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>ca.bkaw</groupId>
<artifactId>paper-nms-maven-plugin</artifactId>
<version>1.4.5</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>remap</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>ca.bkaw</groupId>
<artifactId>paper-nms</artifactId>
<version>1.21.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.lone</groupId>
<artifactId>VanillaCustomizer-core</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,48 @@
package dev.lone.vanillacustomizer.nms.items.impl;
import dev.lone.vanillacustomizer.nms.items.IItemsNms;
import dev.lone.vanillacustomizer.nms.items.Rarity;
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.level.block.Block;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.ItemStack;
@SuppressWarnings("unused")
public class v1_21_4 implements IItemsNms
{
@Override
public Rarity getRarity(ItemStack bukkitItem)
{
net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(bukkitItem);
return Rarity.values()[item.getRarity().ordinal()];
}
@Override
public float getDestroySpeed(ItemStack bukkitItem)
{
Block block = CraftMagicNumbers.getBlock(bukkitItem.getType());
return block.defaultBlockState().destroySpeed;
}
@Override
public int getNutrition(ItemStack bukkitItem)
{
net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
FoodProperties foodProperties = itemStack.get(DataComponents.FOOD);
if(foodProperties != null)
return foodProperties.nutrition();
return 0;
}
@Override
public float getSaturation(ItemStack bukkitItem)
{
net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
FoodProperties foodProperties = itemStack.get(DataComponents.FOOD);
if(foodProperties != null)
return foodProperties.saturation();
return 0;
}
}

View File

@@ -22,6 +22,7 @@
<modules> <modules>
<module>VanillaCustomizer-core</module> <module>VanillaCustomizer-core</module>
<module>VanillaCustomizer-jar</module> <module>VanillaCustomizer-jar</module>
<module>VanillaCustomizer-nms-v1_21_4</module>
<module>VanillaCustomizer-nms-v1_21_3</module> <module>VanillaCustomizer-nms-v1_21_3</module>
<module>VanillaCustomizer-nms-v1_21_1</module> <module>VanillaCustomizer-nms-v1_21_1</module>
<module>VanillaCustomizer-nms-v1_20_6</module> <module>VanillaCustomizer-nms-v1_20_6</module>