Fix build

This commit is contained in:
Sollace 2024-01-26 16:10:59 +00:00
parent 0910ad72ca
commit 7c7ea1e555
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 8 additions and 6 deletions

View file

@ -60,10 +60,10 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
@SuppressWarnings("deprecation")
public interface URenderers { public interface URenderers {
BlockEntity CHEST_RENDER_ENTITY = new CloudChestBlock.TileData(BlockPos.ORIGIN, UBlocks.CLOUD_CHEST.getDefaultState()); BlockEntity CHEST_RENDER_ENTITY = new CloudChestBlock.TileData(BlockPos.ORIGIN, UBlocks.CLOUD_CHEST.getDefaultState());
@SuppressWarnings("unchecked")
static void bootstrap() { static void bootstrap() {
ParticleFactoryRegistry.getInstance().register(UParticles.UNICORN_MAGIC, createFactory(MagicParticle::new)); ParticleFactoryRegistry.getInstance().register(UParticles.UNICORN_MAGIC, createFactory(MagicParticle::new));
ParticleFactoryRegistry.getInstance().register(UParticles.CHANGELING_MAGIC, createFactory(ChangelingMagicParticle::new)); ParticleFactoryRegistry.getInstance().register(UParticles.CHANGELING_MAGIC, createFactory(ChangelingMagicParticle::new));

View file

@ -14,6 +14,7 @@ import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.feature.FeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRendererContext; import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -23,9 +24,10 @@ public class AccessoryFeatureRenderer<
T extends LivingEntity, T extends LivingEntity,
M extends EntityModel<T>> extends FeatureRenderer<T, M> { M extends EntityModel<T>> extends FeatureRenderer<T, M> {
private static final List<FeatureFactory<?>> REGISTRY = new ArrayList<>(); private static final List<FeatureFactory<?, ?>> REGISTRY = new ArrayList<>();
public static void register(FeatureFactory<?>...factories) { @SafeVarargs
public static <T extends LivingEntity> void register(FeatureFactory<T, BipedEntityModel<T>>...factories) {
for (var factory : factories) { for (var factory : factories) {
REGISTRY.add(factory); REGISTRY.add(factory);
} }
@ -36,7 +38,7 @@ public class AccessoryFeatureRenderer<
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public AccessoryFeatureRenderer(FeatureRendererContext<T, M> context) { public AccessoryFeatureRenderer(FeatureRendererContext<T, M> context) {
super(context); super(context);
features = REGISTRY.stream().map(f -> ((FeatureFactory<T>)f).create(context)).toList(); features = REGISTRY.stream().map(f -> ((FeatureFactory<T, M>)f).create(context)).toList();
} }
@Override @Override
@ -68,8 +70,8 @@ public class AccessoryFeatureRenderer<
return cancelled; return cancelled;
} }
public interface FeatureFactory<T extends LivingEntity> { public interface FeatureFactory<T extends LivingEntity, M extends EntityModel<T>> {
Feature<T> create(FeatureRendererContext<T, ? extends EntityModel<T>> context); Feature<T> create(FeatureRendererContext<T, M> context);
} }
public interface Feature<T extends LivingEntity> { public interface Feature<T extends LivingEntity> {