Skip to content
Draft

26.2 #20

Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.15-SNAPSHOT';
id 'net.fabricmc.fabric-loom' version "${loom_version}"
id 'maven-publish'
}

Expand All @@ -17,13 +17,12 @@ repositories {

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"

modImplementation include('net.kyori:adventure-platform-fabric:6.8.0')
implementation include('net.kyori:adventure-platform-fabric:7.1.1')

modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:1.2.2")
runtimeOnly("me.djtheredstoner:DevAuth-fabric:1.2.2")
}

processResources {
Expand All @@ -39,7 +38,7 @@ processResources {
}
}

def targetJavaVersion = 21
def targetJavaVersion = 25
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.21.11
yarn_mappings=1.21.11+build.4
loader_version=0.18.4
minecraft_version=26.2
loader_version=0.19.3
loom_version=1.17-SNAPSHOT

# Mod Properties
mod_version=1.0.0
maven_group=io.github.redvortexdev
archives_base_name=Flint

# Dependencies
fabric_api_version=0.141.3+1.21.11
fabric_api_version=0.157.0+26.2
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
32 changes: 17 additions & 15 deletions src/main/java/dev/dfonline/flint/Flint.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.fabricmc.fabric.api.client.rendering.v1.world.WorldRenderEvents;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.level.LevelExtractionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.level.LevelRenderEvents;
import net.kyori.adventure.platform.modcommon.MinecraftAudiences;
import net.kyori.adventure.platform.modcommon.MinecraftClientAudiences;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.Identifier;

import java.util.Arrays;

Expand All @@ -43,10 +45,10 @@ public class Flint implements ClientModInitializer {
public static final MinecraftAudiences AUDIENCE = MinecraftClientAudiences.builder().build();

private static final Logger LOGGER = Logger.of(Flint.class);
private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
private static final Minecraft CLIENT = Minecraft.getInstance();
private static final User user = new User();

public static MinecraftClient getClient() {
public static Minecraft getClient() {
return CLIENT;
}

Expand Down Expand Up @@ -94,7 +96,7 @@ private void registerEventCallbacks() {
)
);

HudRenderCallback.EVENT.register((drawContext, renderTickCounter) ->
HudElementRegistry.addLast(Identifier.fromNamespaceAndPath(MOD_ID, "features"), (drawContext, renderTickCounter) ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.RENDERED).forEach(feature ->
((RenderedFeature) feature).render(drawContext, renderTickCounter)
)
Expand All @@ -106,49 +108,49 @@ private void registerEventCallbacks() {
)
);

WorldRenderEvents.AFTER_BLOCK_OUTLINE_EXTRACTION.register((context, hit) ->
LevelExtractionEvents.AFTER_BLOCK_OUTLINE_EXTRACTION.register((context, hit) ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderAfterBlockOutlineExtraction(context, hit)
)
);

WorldRenderEvents.END_EXTRACTION.register(context ->
LevelExtractionEvents.END_EXTRACTION.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderEndExtraction(context)
)
);

WorldRenderEvents.START_MAIN.register(context ->
LevelRenderEvents.START_MAIN.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderStartMain(context)
)
);

WorldRenderEvents.BEFORE_ENTITIES.register(context ->
LevelRenderEvents.COLLECT_SUBMITS.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderBeforeEntities(context)
)
);

WorldRenderEvents.AFTER_ENTITIES.register(context ->
LevelRenderEvents.AFTER_SOLID_FEATURES.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderAfterEntities(context)
)
);

WorldRenderEvents.BEFORE_DEBUG_RENDER.register(context ->
LevelRenderEvents.BEFORE_GIZMOS.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderBeforeDebugRender(context)
)
);

WorldRenderEvents.BEFORE_TRANSLUCENT.register(context ->
LevelRenderEvents.BEFORE_TRANSLUCENT_TERRAIN.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderBeforeTranslucent(context)
)
);

WorldRenderEvents.BEFORE_BLOCK_OUTLINE.register((context, outlineRenderState) -> {
LevelRenderEvents.BEFORE_BLOCK_OUTLINE.register((context, outlineRenderState) -> {
boolean shouldRender = true;
for (FeatureTrait feature : FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER)) {
if (((WorldRenderFeature) feature).worldRenderBeforeBlockOutline(context, outlineRenderState) == EventResult.CANCEL) {
Expand All @@ -159,7 +161,7 @@ private void registerEventCallbacks() {
return shouldRender;
});

WorldRenderEvents.END_MAIN.register(context ->
LevelRenderEvents.END_MAIN.register(context ->
FEATURE_MANAGER.getByTrait(FeatureTraitType.WORLD_RENDER).forEach(feature ->
((WorldRenderFeature) feature).worldRenderEndMain(context)
)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/dfonline/flint/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import dev.dfonline.flint.hypercube.Node;
import dev.dfonline.flint.hypercube.Plot;
import dev.dfonline.flint.util.message.Message;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.player.LocalPlayer;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -22,8 +22,8 @@ public final class User {
private @Nullable Node node;
private int nodeId;

public ClientPlayerEntity getPlayer() {
ClientPlayerEntity player = Flint.getClient().player;
public LocalPlayer getPlayer() {
LocalPlayer player = Flint.getClient().player;

if (player == null) {
throw new NullPointerException("Player is null, User#getPlayer should only be used as a shorthand when it is known that the player is not null.");
Expand Down
47 changes: 23 additions & 24 deletions src/main/java/dev/dfonline/flint/data/DFItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ContainerComponent;
import net.minecraft.component.type.CustomModelDataComponent;
import net.minecraft.component.type.DyedColorComponent;
import net.minecraft.component.type.LoreComponent;
import net.minecraft.component.type.ProfileComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Unit;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.CustomModelData;
import net.minecraft.world.item.component.DyedItemColor;
import net.minecraft.world.item.component.ItemContainerContents;
import net.minecraft.world.item.component.ItemLore;
import net.minecraft.world.item.component.ResolvableProfile;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
Expand Down Expand Up @@ -125,7 +124,7 @@ public boolean hasHypercubeKey(String key) {
*/
public ItemStack getItemStack() {
if (this.data != null) {
this.item.set(DataComponentTypes.CUSTOM_DATA, this.getItemData().toComponent());
this.item.set(DataComponents.CUSTOM_DATA, this.getItemData().toComponent());
}
return this.item;
}
Expand All @@ -144,8 +143,8 @@ public PublicBukkitValues getPublicBukkitValues() {
*
* @return The lore of the item.
*/
public List<Text> getLore() {
LoreComponent loreComponent = this.item.get(DataComponentTypes.LORE);
public List<Component> getLore() {
ItemLore loreComponent = this.item.get(DataComponents.LORE);
if (loreComponent == null) {
return List.of();
}
Expand All @@ -157,26 +156,26 @@ public List<Text> getLore() {
*
* @param lore The new lore to set.
*/
public void setLore(List<Text> lore) {
this.item.set(DataComponentTypes.LORE, new LoreComponent(lore));
public void setLore(List<Component> lore) {
this.item.set(DataComponents.LORE, new ItemLore(lore));
}

/**
* Gets the name of the item.
*
* @return The name of the item.
*/
public Text getName() {
return this.item.getName();
public Component getName() {
return this.item.getHoverName();
}

/**
* Sets the name of the item.
*
* @param name The new name to set.
*/
public void setName(Text name) {
this.item.set(DataComponentTypes.CUSTOM_NAME, name);
public void setName(Component name) {
this.item.set(DataComponents.CUSTOM_NAME, name);
}

// Since this is currently unused we can keep it that way for now
Expand All @@ -197,7 +196,7 @@ public void setName(Text name) {
* @param color The new dye color to set.
*/
public void setDyeColor(int color) {
this.item.set(DataComponentTypes.DYED_COLOR, new DyedColorComponent(color));
this.item.set(DataComponents.DYED_COLOR, new DyedItemColor(color));
}

/**
Expand All @@ -206,7 +205,7 @@ public void setDyeColor(int color) {
* @param modelData The new custom model data to set.
*/
public void setCustomModelData(int modelData) {
this.item.set(DataComponentTypes.CUSTOM_MODEL_DATA, new CustomModelDataComponent(List.of((float) modelData), List.of(), List.of(), List.of()));
this.item.set(DataComponents.CUSTOM_MODEL_DATA, new CustomModelData(List.of((float) modelData), List.of(), List.of(), List.of()));
}

/**
Expand All @@ -220,14 +219,14 @@ public void setProfile(UUID uuid, String value, String signature) {
Multimap<String, Property> map = ImmutableMultimap.<String, Property>builder()
.put("textures", new Property("textures", value, signature))
.build();
this.item.set(DataComponentTypes.PROFILE, ProfileComponent.ofStatic(new GameProfile(uuid, value, new PropertyMap(map))));
this.item.set(DataComponents.PROFILE, ResolvableProfile.createResolved(new GameProfile(uuid, value, new PropertyMap(map))));
}

/**
* Removes the item's data.
*/
public void removeItemData() {
this.item.remove(DataComponentTypes.CUSTOM_DATA);
this.item.remove(DataComponents.CUSTOM_DATA);
this.data = null;
}

Expand All @@ -240,8 +239,8 @@ public void removeItemData() {
* @return The container of the item.
*/
@Nullable
public ContainerComponent getContainer() {
return this.item.get(DataComponentTypes.CONTAINER);
public ItemContainerContents getContainer() {
return this.item.get(DataComponents.CONTAINER);
}

}
24 changes: 12 additions & 12 deletions src/main/java/dev/dfonline/flint/data/ItemData.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package dev.dfonline.flint.data;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.CustomData;
import org.jetbrains.annotations.Nullable;

public class ItemData {

private NbtCompound customData;
private CompoundTag customData;
private PublicBukkitValues publicBukkitValues;

/**
Expand All @@ -18,17 +18,17 @@ public class ItemData {
* @implNote Most operations won't work if the item doesn't have custom data.
*/
public ItemData(ItemStack item) {
NbtComponent customDataComponent = item.get(DataComponentTypes.CUSTOM_DATA);
CustomData customDataComponent = item.get(DataComponents.CUSTOM_DATA);
if (customDataComponent != null) {
this.customData = customDataComponent.copyNbt();
this.customData = customDataComponent.copyTag();
}
}

/**
* Creates an ItemData with an existing empty NbtCompound.
*/
private ItemData() {
this.customData = new NbtCompound();
this.customData = new CompoundTag();
}

/**
Expand All @@ -37,10 +37,10 @@ private ItemData() {
* @return The NBT Compound of the CUSTOM_DATA item component.
* @apiNote This should only be used in very specific cases; the entire point of this class is to abstract the NBT data.
*/
public NbtCompound getNbt() {
public CompoundTag getNbt() {
// Should only be used in very specific cases, the entire point of this class is to abstract the NBT data.
if (this.customData == null) {
this.customData = new NbtCompound();
this.customData = new CompoundTag();
}
if (this.publicBukkitValues != null) {
this.customData.put(PublicBukkitValues.PUBLIC_BUKKIT_VALUES_KEY, this.publicBukkitValues.getNbt());
Expand Down Expand Up @@ -173,8 +173,8 @@ public boolean hasHypercubeKey(String key) {
* @return The NbtComponent.
* @apiNote This should only be used in very specific cases; the entire point of this class is to abstract the NBT data.
*/
public NbtComponent toComponent() {
return NbtComponent.of(this.getNbt());
public CustomData toComponent() {
return CustomData.of(this.getNbt());
}

}
Loading