Skip to content

Commit 3d9de4a

Browse files
committed
*: update to 1.21.4
1 parent 71cfaef commit 3d9de4a

File tree

7 files changed

+31
-28
lines changed

7 files changed

+31
-28
lines changed

api/src/main/java/team/unnamed/hephaestus/writer/ResourceModelWriter.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import team.unnamed.creative.atlas.Atlas;
3131
import team.unnamed.creative.atlas.AtlasSource;
3232
import team.unnamed.creative.base.Vector3Float;
33+
import team.unnamed.creative.item.Item;
34+
import team.unnamed.creative.item.ItemModel;
3335
import team.unnamed.creative.model.Element;
3436
import team.unnamed.creative.model.ItemOverride;
3537
import team.unnamed.creative.model.ItemPredicate;
@@ -60,7 +62,7 @@
6062
* @since 1.0.0
6163
*/
6264
final class ResourceModelWriter implements ModelWriter<ResourcePack> {
63-
65+
private static final Key LEATHER_HORSE_ARMOR_ITEM_MODEL_KEY = Key.key("leather_horse_armor");
6466
private static final Key LEATHER_HORSE_ARMOR_KEY = Key.key("item/leather_horse_armor");
6567

6668
@Subst(Hephaestus.NAMESPACE)
@@ -124,6 +126,13 @@ public void write(ResourcePack resourcePack, Collection<Model> models) {
124126
.build()
125127
);
126128

129+
resourcePack.item(Item.item(LEATHER_HORSE_ARMOR_ITEM_MODEL_KEY, ItemModel.composite(
130+
ItemOverride.toItemModels(
131+
ItemModel.reference(LEATHER_HORSE_ARMOR_KEY),
132+
overrides
133+
)
134+
)));
135+
127136
resourcePack.atlas(Atlas.atlas()
128137
.key(Atlas.BLOCKS)
129138
.sources(sources)

buildSrc/src/main/kotlin/hephaestus.common-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ java {
1818
withSourcesJar()
1919
withJavadocJar()
2020
toolchain {
21-
languageVersion.set(JavaLanguageVersion.of(17))
21+
languageVersion.set(JavaLanguageVersion.of(21))
2222
}
2323
}
2424

buildSrc/src/main/kotlin/hephaestus.runtime-bukkit-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ plugins {
44

55
repositories {
66
maven("https://repo.codemc.io/repository/nms/")
7-
maven("https://papermc.io/repo/repository/maven-public/")
7+
maven("https://repo.papermc.io/repository/maven-public/")
88
}

runtime-bukkit/adapt-v1_21_4/src/main/java/team/unnamed/hephaestus/bukkit/v1_21_4/BoneEntity.java

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
package team.unnamed.hephaestus.bukkit.v1_21_4;
2525

2626
import com.mojang.math.Transformation;
27+
import io.papermc.paper.datacomponent.DataComponentTypes;
2728
import net.kyori.adventure.nbt.BinaryTagTypes;
2829
import net.kyori.adventure.nbt.CompoundBinaryTag;
30+
import net.minecraft.core.component.DataComponentType;
31+
import net.minecraft.core.component.DataComponents;
2932
import net.minecraft.core.registries.BuiltInRegistries;
3033
import net.minecraft.nbt.CompoundTag;
3134
import net.minecraft.nbt.NbtAccounter;
@@ -37,8 +40,11 @@
3740
import net.minecraft.resources.ResourceLocation;
3841
import net.minecraft.world.entity.Display;
3942
import net.minecraft.world.entity.EntityType;
43+
import net.minecraft.world.item.DyeColor;
4044
import net.minecraft.world.item.ItemDisplayContext;
4145
import net.minecraft.world.item.ItemStack;
46+
import net.minecraft.world.item.component.CustomModelData;
47+
import net.minecraft.world.item.component.DyedItemColor;
4248
import net.minecraft.world.phys.Vec3;
4349
import org.bukkit.Color;
4450
import org.jetbrains.annotations.NotNull;
@@ -196,27 +202,17 @@ public void updateTransformation() {
196202
@Override
197203
public void updateItem() {
198204
final var itemKey = modifiers.modifyItem(Hephaestus.BONE_ITEM_KEY);
199-
final var tag = modifiers.modifyItemTag(CompoundBinaryTag.builder()
200-
.put(Minecraft.DISPLAY_TAG, CompoundBinaryTag.builder()
201-
.putInt(Minecraft.COLOR_TAG, color)
202-
.build())
203-
.putInt(Minecraft.CUSTOM_MODEL_DATA_TAG, bone.customModelData())
204-
.build());
205-
206-
final var item = BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(itemKey.namespace(), itemKey.value()));
207-
final var itemStack = new ItemStack(item, 1);
208205

209-
try {
210-
final var bytes = new ByteArrayOutputStream();
211-
final var output = new DataOutputStream(bytes);
212-
BinaryTagTypes.COMPOUND.write(tag, output);
213-
output.flush();
206+
final var item = BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(itemKey.namespace(), itemKey.value())).orElseThrow();
207+
final var itemStack = new ItemStack(item, 1);
214208

215-
final var nmsTag = CompoundTag.TYPE.load(new DataInputStream(new ByteArrayInputStream(bytes.toByteArray())), NbtAccounter.unlimitedHeap());
216-
itemStack.setTag(nmsTag);
217-
} catch (final IOException e) {
218-
throw new RuntimeException("Failed to write item tag", e);
219-
}
209+
itemStack.set(DataComponents.DYED_COLOR, new DyedItemColor(color, true));
210+
itemStack.set(DataComponents.CUSTOM_MODEL_DATA, new CustomModelData(
211+
List.of((float) bone.customModelData()),
212+
List.of(),
213+
List.of(),
214+
List.of()
215+
));
220216

221217
setItemStack(itemStack);
222218
}

runtime-bukkit/adapt-v1_21_4/src/main/java/team/unnamed/hephaestus/bukkit/v1_21_4/BukkitModelViewTrackerImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public boolean stopTracking(final @NotNull AbstractModelView<Player> abstractVie
8787

8888
final var old = replacementTracker.replaced();
8989
chunkMap.entityMap.put(base.getEntityId(), old);
90-
baseHandle.tracker = old;
9190
tracker = old;
9291
}
9392

@@ -159,7 +158,6 @@ public boolean startTrackingOn(final @NotNull AbstractModelView<Player> abstract
159158
baseHandle.getType().trackDeltas()
160159
);
161160
chunkMap.entityMap.put(base.getEntityId(), entityTracker);
162-
baseHandle.tracker = entityTracker;
163161
broadcastChangesFunction = packet -> {
164162
((ServerPlayer) baseHandle).connection.send(packet);
165163
entityTracker.broadcast(packet);

runtime-bukkit/api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ plugins {
55

66
dependencies {
77
api(project(":hephaestus-api"))
8-
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
8+
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
99
}

runtime-bukkit/test-plugin/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ java {
1212

1313
dependencies {
1414
// server api
15-
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
15+
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
1616

1717
// resource-pack plugin api
1818
compileOnly("team.unnamed:creative-central-api:1.4.0")
@@ -27,10 +27,10 @@ dependencies {
2727
tasks {
2828
runServer {
2929
downloadPlugins {
30-
modrinth("central", "1.4.0") // creative-central
30+
//modrinth("central", "1.3.0") // creative-central
3131
}
3232

33-
minecraftVersion("1.21")
33+
minecraftVersion("1.21.4")
3434
}
3535
shadowJar {
3636
dependencies {

0 commit comments

Comments
 (0)