mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-28 16:22:18 +00:00
Update to latest NeoForge
Welllll, latest when I wrote the code, not at actual time of writing.
This commit is contained in:
parent
64d10ad45b
commit
846f9dff03
@ -9,7 +9,7 @@
|
||||
# Remember to update corresponding versions in fabric.mod.json/neoforge.mods.toml
|
||||
fabric-api = "0.127.0+1.21.6"
|
||||
fabric-loader = "0.16.14"
|
||||
neoForge = "21.6.0-beta"
|
||||
neoForge = "21.6.12-beta"
|
||||
neoMergeTool = "2.0.0"
|
||||
mixin = "0.8.5"
|
||||
parchment = "2025.04.19"
|
||||
|
@ -67,7 +67,7 @@ public final class ClientRegistry {
|
||||
private static final Map<ResourceLocation, ModelKey<StandaloneModel>> models = new ConcurrentHashMap<>();
|
||||
|
||||
public static ModelKey<StandaloneModel> getModel(ResourceLocation model) {
|
||||
return models.computeIfAbsent(model, m -> ClientPlatformHelper.get().createModelKey(m, m::toString));
|
||||
return models.computeIfAbsent(model, m -> ClientPlatformHelper.get().createModelKey(m::toString));
|
||||
}
|
||||
|
||||
public static StandaloneModel getModel(ModelManager manager, ResourceLocation modelId) {
|
||||
|
@ -9,7 +9,6 @@ import com.mojang.serialization.JsonOps;
|
||||
import dan200.computercraft.client.platform.ClientPlatformHelper;
|
||||
import dan200.computercraft.client.platform.ModelKey;
|
||||
import dan200.computercraft.shared.util.ResourceUtils;
|
||||
import net.minecraft.client.resources.model.MissingBlockModel;
|
||||
import net.minecraft.client.resources.model.ModelBaker;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.client.resources.model.ResolvableModel;
|
||||
@ -48,12 +47,12 @@ public class CustomModelManager<U extends ResolvableModel, T> {
|
||||
this.codec = codec;
|
||||
this.bake = bake;
|
||||
|
||||
this.missingModelKey = ClientPlatformHelper.get().createModelKey(MissingBlockModel.LOCATION, () -> "Missing " + kind);
|
||||
this.missingModelKey = ClientPlatformHelper.get().createModelKey(() -> "Missing " + kind);
|
||||
this.missingModel = missingModel;
|
||||
}
|
||||
|
||||
private ModelKey<T> getModelKey(ResourceLocation id) {
|
||||
return modelKeys.computeIfAbsent(id, o -> ClientPlatformHelper.get().createModelKey(o, () -> kind + " " + o));
|
||||
return modelKeys.computeIfAbsent(id, o -> ClientPlatformHelper.get().createModelKey(() -> kind + " " + o));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@ package dan200.computercraft.client.platform;
|
||||
|
||||
import dan200.computercraft.impl.Services;
|
||||
import net.minecraft.client.resources.model.ModelDebugName;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@ -19,13 +18,12 @@ public interface ClientPlatformHelper {
|
||||
/**
|
||||
* Create a new unique {@link ModelKey}.
|
||||
*
|
||||
* @param id An identifier for this model key.
|
||||
* @param name The debug name for this model key.
|
||||
* @param <T> The type of baked model.
|
||||
* @return The newly created model key.
|
||||
*/
|
||||
@Contract("_, _ -> new")
|
||||
<T> ModelKey<T> createModelKey(ResourceLocation id, ModelDebugName name);
|
||||
@Contract("_ -> new")
|
||||
<T> ModelKey<T> createModelKey(ModelDebugName name);
|
||||
|
||||
final class Instance {
|
||||
static final @Nullable ClientPlatformHelper INSTANCE;
|
||||
|
@ -7,12 +7,11 @@ package dan200.computercraft.client.platform;
|
||||
import com.google.auto.service.AutoService;
|
||||
import net.fabricmc.fabric.api.client.model.loading.v1.ExtraModelKey;
|
||||
import net.minecraft.client.resources.model.ModelDebugName;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
@AutoService(ClientPlatformHelper.class)
|
||||
public class ClientPlatformHelperImpl implements ClientPlatformHelper {
|
||||
@Override
|
||||
public <T> ModelKey<T> createModelKey(ResourceLocation id, ModelDebugName name) {
|
||||
public <T> ModelKey<T> createModelKey(ModelDebugName name) {
|
||||
return new FabricModelKey<>(ExtraModelKey.create(name::debugName));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import java.util.function.BiFunction;
|
||||
/**
|
||||
* Registers textures and models for items.
|
||||
*/
|
||||
@EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID, value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
|
||||
@EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID, value = Dist.CLIENT)
|
||||
public final class ForgeClientRegistry {
|
||||
static final ContextKey<ExtendedItemFrameRenderState> ITEM_FRAME_STATE = new ContextKey<>(ResourceLocation.fromNamespaceAndPath(ComputerCraftAPI.MOD_ID, "item_frame"));
|
||||
|
||||
|
@ -6,13 +6,12 @@ package dan200.computercraft.client.platform;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import net.minecraft.client.resources.model.ModelDebugName;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.client.model.standalone.StandaloneModelKey;
|
||||
|
||||
@AutoService(ClientPlatformHelper.class)
|
||||
public class ClientPlatformHelperImpl implements ClientPlatformHelper {
|
||||
@Override
|
||||
public <T> ModelKey<T> createModelKey(ResourceLocation id, ModelDebugName name) {
|
||||
return new ForgeModelKey<>(new StandaloneModelKey<T>(id));
|
||||
public <T> ModelKey<T> createModelKey(ModelDebugName name) {
|
||||
return new ForgeModelKey<>(new StandaloneModelKey<T>(name));
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
@EventBusSubscriber
|
||||
public class ForgeDataProviders {
|
||||
@SubscribeEvent
|
||||
public static void gather(GatherDataEvent.Client event) {
|
||||
|
@ -17,7 +17,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
/**
|
||||
* Data generators for the Forge version of our example mod.
|
||||
*/
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
@EventBusSubscriber
|
||||
public class ForgeExampleModDataGenerator {
|
||||
@SubscribeEvent
|
||||
public static void gather(GatherDataEvent.Client event) {
|
||||
|
@ -66,7 +66,7 @@ import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
@Mod(ComputerCraftAPI.MOD_ID)
|
||||
@EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
|
||||
@EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID)
|
||||
public final class ComputerCraft {
|
||||
private static @Nullable IEventBus eventBus;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user