1.21-pre1 port (#3811)

* 1.21-pre1 port

* Bump version
This commit is contained in:
modmuss 2024-05-29 16:25:22 +01:00 committed by GitHub
parent 29e5f1d91b
commit b55973447a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 131 additions and 656 deletions

View file

@ -1,6 +0,0 @@
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-model-loading-api-v1'
])

View file

@ -1,53 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedModelManager;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.FabricBakedModelManager;
/**
* @deprecated Use {@link FabricBakedModelManager#getModel(Identifier)} instead.
*/
@Deprecated
public final class BakedModelManagerHelper {
/**
* An alternative to {@link BakedModelManager#getModel(ModelIdentifier)} that accepts an
* {@link Identifier} instead. Models loaded using {@link ExtraModelProvider} do not have a
* corresponding {@link ModelIdentifier}, so the vanilla method cannot be used to retrieve them.
* The Identifier that was used to load them can be used in this method to retrieve them.
*
* <p><b>This method, as well as its vanilla counterpart, should only be used after the
* {@link BakedModelManager} has completed reloading.</b> Otherwise, the result will be
* null or an old model.
*
* @param manager the manager that holds models
* @param id the id of the model
* @return the model
*/
@Nullable
public static BakedModel getModel(BakedModelManager manager, Identifier id) {
return manager.getModel(id);
}
private BakedModelManagerHelper() { }
}

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import java.util.function.Consumer;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
/**
* @deprecated Use {@link ModelLoadingPlugin} and related classes instead.
*/
@Deprecated
@FunctionalInterface
public interface ExtraModelProvider {
/**
* Provides an opportunity inform the game that you would like it to load and bake a model,
* even if that model is not used by any blocks or items.
* @param out Accepts paths to be loaded. Arguments that are {@link ModelIdentifier} will be
* loaded through the blockstate JSON system or, if the variant is {@code inventory}, the item model folder.
* Otherwise, the argument is directly loaded as a JSON.
* For example, <pre>Identifier.of("mymod", "foo/bar")</pre> will request loading of the file
* <pre>/assets/mymod/models/foo/bar.json</pre>
*/
void provideExtraModels(ResourceManager manager, Consumer<Identifier> out);
}

View file

@ -1,33 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import java.util.function.Consumer;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
/**
* @deprecated use {@link ExtraModelProvider}, which supports loading of plain {@link Identifier}s
*/
@Deprecated
@FunctionalInterface
public interface ModelAppender {
@Deprecated
void appendAll(ResourceManager manager, Consumer<ModelIdentifier> out);
}

View file

@ -1,60 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import java.util.function.Function;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.impl.client.model.ModelLoadingRegistryImpl;
/**
* @deprecated Register a {@link ModelLoadingPlugin} instead.
*/
@Deprecated
public interface ModelLoadingRegistry {
ModelLoadingRegistry INSTANCE = new ModelLoadingRegistryImpl();
/**
* Register a model provider, which can request loading additional models.
* @see ExtraModelProvider
*/
void registerModelProvider(ExtraModelProvider appender);
/**
* Register a model appender, which can request loading additional models.
* @deprecated Use {@link #registerModelProvider(ExtraModelProvider)} instead, which supports loading of plain {@link Identifier}s
*/
@Deprecated
void registerAppender(ModelAppender appender);
/**
* Register a ModelResourceProvider supplier.
*
* @param providerSupplier The ModelResourceProvider supplier, instantiated with every ModelLoader.
*/
void registerResourceProvider(Function<ResourceManager, ModelResourceProvider> providerSupplier);
/**
* Register a ModelVariantProvider supplier.
*
* @param providerSupplier The ModelVariantProvider supplier, instantiated with every ModelLoader.
*/
void registerVariantProvider(Function<ResourceManager, ModelVariantProvider> providerSupplier);
}

View file

@ -1,40 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
/**
* The model loading context used during model providing.
* @deprecated Use {@link ModelLoadingPlugin} and related classes instead.
*/
@Deprecated
public interface ModelProviderContext {
/**
* Load a model using a {@link Identifier}, {@link ModelIdentifier}, ...
*
* <p>Please note that the game engine keeps track of circular model loading calls on its own.
*
* @param id The model identifier.
* @return The UnbakedModel. Can return a missing model if it's not present!
*/
UnbakedModel loadModel(Identifier id);
}

View file

@ -1,33 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
/**
* @deprecated Use {@link ModelLoadingPlugin} and related classes instead.
*/
@Deprecated
public class ModelProviderException extends Exception {
public ModelProviderException(String s) {
super(s);
}
public ModelProviderException(String s, Throwable t) {
super(s, t);
}
}

View file

@ -1,58 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
/**
* Interface for model resource providers.
*
* <p>Model resource providers hook the loading of model *files* from the resource tree;
* that is, in vanilla, it handles going from "minecraft:block/stone" to a
* "assets/minecraft/models/block/stone.json" file.
*
* <p>This is where you want to add your own custom model formats.
*
* <p>As providers are instantiated with a new provider, it is safe
* (and recommended!) to cache information inside a loader.
*
* <p>Keep in mind that only *one* ModelResourceProvider may respond to a given model
* at any time. If you're writing, say, an OBJ loader, this means you could
* easily conflict with another OBJ loader unless you take some precautions,
* for example:
*
* <ul><li>Only load files with a mod-suffixed name, such as .architect.obj,
* <li>Only load files from an explicit list of namespaces, registered elsewhere.</ul>
*
* @deprecated Use {@link ModelLoadingPlugin} and related classes instead.
*/
@Deprecated
@FunctionalInterface
public interface ModelResourceProvider {
/**
* @param resourceId The resource identifier to be loaded.
* @return The loaded UnbakedModel, or null if this ModelResourceProvider doesn't handle a specific Identifier
* (or if there was no error!).
*/
@Nullable
UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException;
}

View file

@ -1,55 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.client.model;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.util.ModelIdentifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
/**
* Interface for model variant providers.
*
* <p>Model variant providers hook the resolution of ModelIdentifiers. In vanilla, this is
* the part where a "minecraft:stone#normal" identifier triggers the loading of a
* "minecraft:models/stone" model ({@link ModelResourceProvider} handles the later step).
*
* <p>The most common use of this is to cooperate with a {@link ModelAppender}, but it can
* also allow you to add your own block- or item-state formats. To trigger the loading
* of another model, use the passed {@link ModelProviderContext}.
*
* <p>As every model loading is instantiated with a new provider, it is safe
* (and recommended!) to cache information.
*
* <p>Keep in mind that only *one* ModelVariantProvider may respond to a given model
* at any time.
*
* @deprecated Use {@link ModelLoadingPlugin} and related classes instead.
*/
@Deprecated
@FunctionalInterface
public interface ModelVariantProvider {
/**
* @param modelId The model identifier, complete with variant.
* @return The loaded UnbakedModel, or null if this ModelVariantProvider doesn't handle a specific Identifier
* (or if there was no error!).
*/
@Nullable
UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException;
}

View file

@ -1,111 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.client.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.ExtraModelProvider;
import net.fabricmc.fabric.api.client.model.ModelAppender;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
import net.fabricmc.fabric.api.client.model.ModelProviderException;
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
import net.fabricmc.fabric.api.client.model.ModelVariantProvider;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.api.client.model.loading.v1.PreparableModelLoadingPlugin;
import net.fabricmc.fabric.impl.client.model.loading.ModelLoaderPluginContextImpl;
public class ModelLoadingRegistryImpl implements ModelLoadingRegistry {
private final List<ExtraModelProvider> modelProviders = new ArrayList<>();
private final List<ModelAppender> modelAppenders = new ArrayList<>();
private final List<Function<ResourceManager, ModelResourceProvider>> resourceProviderSuppliers = new ArrayList<>();
private final List<Function<ResourceManager, ModelVariantProvider>> variantProviderSuppliers = new ArrayList<>();
{
// Grabs the resource manager to use it in the main model loading code.
// When using the v1 API, data should be loaded in parallel before model loading starts.
PreparableModelLoadingPlugin.register(
(resourceManager, executor) -> CompletableFuture.completedFuture(resourceManager),
this::onInitializeModelLoader);
}
private void onInitializeModelLoader(ResourceManager resourceManager, ModelLoadingPlugin.Context pluginContext) {
Consumer<Identifier> extraModelConsumer = pluginContext::addModels;
Consumer<ModelIdentifier> extraModelConsumer2 = pluginContext::addModels;
// A bit hacky, but avoids the allocation of a new context wrapper every time.
ModelProviderContext resourceProviderContext = ((ModelLoaderPluginContextImpl) pluginContext).modelGetter::apply;
for (ExtraModelProvider provider : modelProviders) {
provider.provideExtraModels(resourceManager, extraModelConsumer);
}
for (ModelAppender appender : modelAppenders) {
appender.appendAll(resourceManager, extraModelConsumer2);
}
for (Function<ResourceManager, ModelResourceProvider> supplier : resourceProviderSuppliers) {
ModelResourceProvider provider = supplier.apply(resourceManager);
pluginContext.resolveModel().register(resolverContext -> {
try {
return provider.loadModelResource(resolverContext.id(), resourceProviderContext);
} catch (ModelProviderException e) {
throw new RuntimeException(e);
}
});
}
for (Function<ResourceManager, ModelVariantProvider> supplier : variantProviderSuppliers) {
ModelVariantProvider provider = supplier.apply(resourceManager);
((ModelLoaderPluginContextImpl) pluginContext).legacyVariantProviders().register(modelId -> {
try {
return provider.loadModelVariant(modelId, resourceProviderContext);
} catch (ModelProviderException e) {
throw new RuntimeException(e);
}
});
}
}
@Override
public void registerModelProvider(ExtraModelProvider provider) {
modelProviders.add(provider);
}
@Override
public void registerAppender(ModelAppender appender) {
modelAppenders.add(appender);
}
@Override
public void registerResourceProvider(Function<ResourceManager, ModelResourceProvider> providerSupplier) {
resourceProviderSuppliers.add(providerSupplier);
}
@Override
public void registerVariantProvider(Function<ResourceManager, ModelVariantProvider> providerSupplier) {
variantProviderSuppliers.add(providerSupplier);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,27 +0,0 @@
{
"schemaVersion": 1,
"id": "fabric-models-v0",
"name": "Fabric Models (v0)",
"version": "${version}",
"environment": "client",
"license": "Apache-2.0",
"icon": "assets/fabric-models-v0/icon.png",
"contact": {
"homepage": "https://fabricmc.net",
"irc": "irc://irc.esper.net:6667/fabric",
"issues": "https://github.com/FabricMC/fabric/issues",
"sources": "https://github.com/FabricMC/fabric"
},
"authors": [
"FabricMC"
],
"depends": {
"fabricloader": ">=0.15.11",
"fabric-api-base": "*",
"fabric-model-loading-api-v1": "*"
},
"description": "Hooks for models and model loading.",
"custom": {
"fabric-api:module-lifecycle": "deprecated"
}
}

View file

@ -22,7 +22,7 @@ import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.Identifier;
public class InspectablePigEntityRenderer extends PigEntityRenderer {
private static final Identifier TEXTURE = Identifier.ofDefaultNamespace("missingno");
private static final Identifier TEXTURE = Identifier.ofVanilla("missingno");
public InspectablePigEntityRenderer(EntityRendererFactory.Context context) {
super(context);

View file

@ -140,7 +140,7 @@ public final class ContentRegistryTest implements ModInitializer {
VillagerInteractionRegistries.registerCollectable(Items.OAK_SAPLING);
VillagerInteractionRegistries.registerGiftLootTable(VillagerProfession.NITWIT, RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.ofDefaultNamespace("fake_loot_table")));
VillagerInteractionRegistries.registerGiftLootTable(VillagerProfession.NITWIT, RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.ofVanilla("fake_loot_table")));
Registry.register(Registries.BLOCK, TEST_EVENT_ID, new TestEventBlock(AbstractBlock.Settings.copy(Blocks.STONE)));
SculkSensorFrequencyRegistry.register(TEST_EVENT.registryKey(), 2);

View file

@ -30,6 +30,7 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ProtoChunk;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.poi.PointOfInterestStorage;
import net.minecraft.world.storage.StorageKey;
import net.fabricmc.fabric.impl.attachment.AttachmentTargetImpl;
@ -42,7 +43,7 @@ abstract class ChunkSerializerMixin {
),
method = "deserialize"
)
private static WorldChunk readWorldChunkAttachments(WorldChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, ChunkPos chunkPos, NbtCompound nbt) {
private static WorldChunk readWorldChunkAttachments(WorldChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, StorageKey storageKey, ChunkPos chunkPos, NbtCompound nbt) {
((AttachmentTargetImpl) chunk).fabric_readAttachmentsFromNbt(nbt, world.getRegistryManager());
return chunk;
}
@ -54,7 +55,7 @@ abstract class ChunkSerializerMixin {
),
method = "deserialize"
)
private static ProtoChunk readProtoChunkAttachments(ProtoChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, ChunkPos chunkPos, NbtCompound nbt) {
private static ProtoChunk readProtoChunkAttachments(ProtoChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, StorageKey storageKey, ChunkPos chunkPos, NbtCompound nbt) {
((AttachmentTargetImpl) chunk).fabric_readAttachmentsFromNbt(nbt, world.getRegistryManager());
return chunk;
}

View file

@ -156,7 +156,7 @@ public class CommonAttachmentTests {
var nbt = new NbtCompound();
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, mockDRM()));
nbt.put(Identifier.ofDefaultNamespace("test").toString(), new NbtCompound());
nbt.put(Identifier.ofVanilla("test").toString(), new NbtCompound());
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, mockDRM()));
}

View file

@ -57,7 +57,7 @@ public class AttachmentCopyTests implements FabricGameTest {
entity.setAttached(DUMMY, () -> 10);
entity.setAttached(COPY_ON_DEATH, () -> 10);
Entity moved = entity.teleportTo(new TeleportTarget(end));
Entity moved = entity.teleportTo(new TeleportTarget(end, entity, TeleportTarget.field_52245));
if (moved == null) throw new GameTestException("Cross-world teleportation failed");
IntSupplier attached1 = moved.getAttached(DUMMY);

View file

@ -117,7 +117,7 @@ transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider off
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerReversibleCompactingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider method_60922 (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateCookingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerFoodCookingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerWaxingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V

View file

@ -373,7 +373,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
SIMPLE_BLOCK,
Text.translatable("advancements.test.root.title"),
Text.translatable("advancements.test.root.description"),
Identifier.ofDefaultNamespace("textures/gui/advancements/backgrounds/end.png"),
Identifier.ofVanilla("textures/gui/advancements/backgrounds/end.png"),
AdvancementFrame.TASK,
false, false, false)
.criterion("killed_something", OnKilledCriterion.Conditions.createPlayerKilledEntity())
@ -383,7 +383,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
SIMPLE_BLOCK,
Text.translatable("advancements.test.root_not_loaded.title"),
Text.translatable("advancements.test.root_not_loaded.description"),
Identifier.ofDefaultNamespace("textures/gui/advancements/backgrounds/end.png"),
Identifier.ofVanilla("textures/gui/advancements/backgrounds/end.png"),
AdvancementFrame.TASK,
false, false, false)
.criterion("killed_something", OnKilledCriterion.Conditions.createPlayerKilledEntity())

View file

@ -18,9 +18,9 @@ package net.fabricmc.fabric.api.client.item.v1;
import java.util.List;
import net.minecraft.client.item.TooltipType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.fabricmc.fabric.api.event.Event;

View file

@ -24,10 +24,10 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.item.TooltipType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;

View file

@ -28,6 +28,7 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.class_9824;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedModelManager;
import net.minecraft.client.render.model.ModelLoader;
@ -62,8 +63,8 @@ public class BakedModelManagerMixin implements FabricBakedModelManager {
allow = 1)
private CompletableFuture<ModelLoader> loadModelPluginData(
CompletableFuture<Map<Identifier, JsonUnbakedModel>> self,
CompletionStage<Map<Identifier, List<ModelLoader.SourceTrackedData>>> otherFuture,
BiFunction<Map<Identifier, JsonUnbakedModel>, Map<Identifier, List<ModelLoader.SourceTrackedData>>, ModelLoader> modelLoaderConstructor,
CompletionStage<Map<Identifier, List<class_9824.SourceTrackedData>>> otherFuture,
BiFunction<Map<Identifier, JsonUnbakedModel>, Map<Identifier, List<class_9824.SourceTrackedData>>, ModelLoader> modelLoaderConstructor,
Executor executor,
// reload args
ResourceReloader.Synchronizer synchronizer,
@ -73,7 +74,7 @@ public class BakedModelManagerMixin implements FabricBakedModelManager {
Executor prepareExecutor,
Executor applyExecutor) {
CompletableFuture<List<ModelLoadingPlugin>> pluginsFuture = ModelLoadingPluginManager.preparePlugins(manager, prepareExecutor);
CompletableFuture<Pair<Map<Identifier, JsonUnbakedModel>, Map<Identifier, List<ModelLoader.SourceTrackedData>>>> pairFuture = self.thenCombine(otherFuture, Pair::new);
CompletableFuture<Pair<Map<Identifier, JsonUnbakedModel>, Map<Identifier, List<class_9824.SourceTrackedData>>>> pairFuture = self.thenCombine(otherFuture, Pair::new);
return pairFuture.thenCombineAsync(pluginsFuture, (pair, plugins) -> {
ModelLoadingPluginManager.CURRENT_PLUGINS.set(plugins);
return modelLoaderConstructor.apply(pair.getLeft(), pair.getRight());

View file

@ -30,6 +30,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.class_9824;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.UnbakedModel;
@ -77,14 +78,14 @@ public abstract class ModelLoaderMixin implements ModelLoaderHooks {
}
@Shadow
private void putModel(Identifier id, UnbakedModel unbakedModel) {
private void method_61076(ModelIdentifier id, UnbakedModel unbakedModel) {
}
@Shadow
public abstract JsonUnbakedModel loadModelFromJson(Identifier id);
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "net/minecraft/util/profiler/Profiler.swap(Ljava/lang/String;)V", ordinal = 0))
private void afterMissingModelInit(BlockColors blockColors, Profiler profiler, Map<Identifier, JsonUnbakedModel> jsonUnbakedModels, Map<Identifier, List<ModelLoader.SourceTrackedData>> blockStates, CallbackInfo info) {
private void afterMissingModelInit(BlockColors blockColors, Profiler profiler, Map<Identifier, JsonUnbakedModel> jsonUnbakedModels, Map<Identifier, List<class_9824.SourceTrackedData>> blockStates, CallbackInfo info) {
// Sanity check
if (!unbakedModels.containsKey(MISSING_ID)) {
throw new AssertionError("Missing model not initialized. This is likely a Fabric API porting bug.");
@ -133,8 +134,8 @@ public abstract class ModelLoaderMixin implements ModelLoaderHooks {
}
}
@ModifyVariable(method = "putModel", at = @At("HEAD"), argsOnly = true)
private UnbakedModel onPutModel(UnbakedModel model, Identifier id) {
@ModifyVariable(method = "method_61076", at = @At("HEAD"), argsOnly = true)
private UnbakedModel onPutModel(UnbakedModel model, ModelIdentifier id) {
fabric_guardGetOrLoadModel++;
try {

View file

@ -99,7 +99,7 @@ public class ModelTestModClient implements ClientModInitializer {
// All the block state models are top-level...
// Use a delegating unbaked model to make sure the identical models only get baked a single time.
Identifier wheatStage0Id = Identifier.ofDefaultNamespace("block/wheat_stage0");
Identifier wheatStage0Id = Identifier.ofVanilla("block/wheat_stage0");
UnbakedModel stage0Model = new DelegatingUnbakedModel(wheatStage0Id);
@ -107,7 +107,7 @@ public class ModelTestModClient implements ClientModInitializer {
context.setModel(state.with(CropBlock.AGE, age), stage0Model);
}
context.setModel(state.with(CropBlock.AGE, 7), context.getOrLoadModel(Identifier.ofDefaultNamespace("block/wheat_stage7")));
context.setModel(state.with(CropBlock.AGE, 7), context.getOrLoadModel(Identifier.ofVanilla("block/wheat_stage7")));
});
});

View file

@ -42,7 +42,7 @@ public class NestedModelLoadingTest implements ClientModInitializer {
private static final Identifier NESTED_MODEL_3 = id("nested_3");
private static final Identifier NESTED_MODEL_4 = id("nested_4");
private static final Identifier NESTED_MODEL_5 = id("nested_5");
private static final Identifier TARGET_MODEL = Identifier.ofDefaultNamespace("block/stone");
private static final Identifier TARGET_MODEL = Identifier.ofVanilla("block/stone");
@Override
public void onInitializeClient() {

View file

@ -30,12 +30,12 @@ public final class NetworkingImpl {
/**
* Id of packet used to register supported channels.
*/
public static final Identifier REGISTER_CHANNEL = Identifier.ofDefaultNamespace("register");
public static final Identifier REGISTER_CHANNEL = Identifier.ofVanilla("register");
/**
* Id of packet used to unregister supported channels.
*/
public static final Identifier UNREGISTER_CHANNEL = Identifier.ofDefaultNamespace("unregister");
public static final Identifier UNREGISTER_CHANNEL = Identifier.ofVanilla("unregister");
public static boolean isReservedCommonChannel(Identifier channelName) {
return channelName.equals(REGISTER_CHANNEL) || channelName.equals(UNREGISTER_CHANNEL);

View file

@ -76,7 +76,7 @@ abstract class ClientConnectionMixin implements ChannelInfoHolder {
}
}
@Inject(method = "handleDisconnection", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/listener/PacketListener;onDisconnected(Lnet/minecraft/class_9812;)V"))
@Inject(method = "handleDisconnection", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/listener/PacketListener;onDisconnected(Lnet/minecraft/network/DisconnectionInfo;)V"))
private void disconnectAddon(CallbackInfo ci) {
if (packetListener instanceof NetworkHandlerExtensions extension) {
extension.getAddon().handleDisconnect();

View file

@ -32,7 +32,7 @@ public abstract class HangingSignEditScreenMixin extends AbstractSignEditScreen
super(blockEntity, filtered, bl);
}
@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofDefaultNamespace(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"))
@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofVanilla(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"))
private Identifier init(String id, Operation<Identifier> original) {
if (signType.name().indexOf(Identifier.NAMESPACE_SEPARATOR) != -1) {
Identifier identifier = Identifier.of(signType.name());

View file

@ -137,21 +137,21 @@ public final class TradeOfferHelper {
* <p>In vanilla, this pool contains offers to buy water buckets, baked potatoes, etc.
* for emeralds.
*/
Identifier BUY_ITEMS_POOL = Identifier.ofDefaultNamespace("buy_items");
Identifier BUY_ITEMS_POOL = Identifier.ofVanilla("buy_items");
/**
* The pool ID for the "sell special items" pool.
* Two trade offers are picked from this pool.
*
* <p>In vanilla, this pool contains offers to sell logs, enchanted iron pickaxes, etc.
*/
Identifier SELL_SPECIAL_ITEMS_POOL = Identifier.ofDefaultNamespace("sell_special_items");
Identifier SELL_SPECIAL_ITEMS_POOL = Identifier.ofVanilla("sell_special_items");
/**
* The pool ID for the "sell common items" pool.
* Five trade offers are picked from this pool.
*
* <p>In vanilla, this pool contains offers to sell flowers, saplings, etc.
*/
Identifier SELL_COMMON_ITEMS_POOL = Identifier.ofDefaultNamespace("sell_common_items");
Identifier SELL_COMMON_ITEMS_POOL = Identifier.ofVanilla("sell_common_items");
/**
* Adds a new pool to the offer list. Exactly {@code count} offers are picked from

View file

@ -6,7 +6,7 @@ testDependencies(project, [
':fabric-block-api-v1',
':fabric-block-view-api-v2',
':fabric-blockrenderlayer-v1',
':fabric-model-loading-api-v1',
// ':fabric-model-loading-api-v1', TODO 1.21
':fabric-object-builder-api-v1',
':fabric-renderer-indigo',
':fabric-resource-loader-v0'

View file

@ -39,7 +39,7 @@ import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
public class FrameUnbakedModel implements UnbakedModel {
private static final SpriteIdentifier OBSIDIAN_SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofDefaultNamespace("block/obsidian"));
private static final SpriteIdentifier OBSIDIAN_SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofVanilla("block/obsidian"));
@Override
public Collection<Identifier> getModelDependencies() {
@ -56,7 +56,7 @@ public class FrameUnbakedModel implements UnbakedModel {
*/
@Nullable
@Override
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer) {
// The renderer API may not have an implementation, so we should check if it exists.
if (!RendererAccess.INSTANCE.hasRenderer()) {
// No renderer implementation is present.

View file

@ -16,15 +16,7 @@
package net.fabricmc.fabric.test.renderer.client;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelResolver;
import net.fabricmc.fabric.test.renderer.RendererTest;
/* TODO 1.21
public class ModelResolverImpl implements ModelResolver {
private static final Set<Identifier> FRAME_MODEL_LOCATIONS = Set.of(
@ -73,3 +65,4 @@ public class ModelResolverImpl implements ModelResolver {
return null;
}
}
*/

View file

@ -42,7 +42,7 @@ import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
import net.fabricmc.fabric.api.util.TriState;
public class OctagonalColumnUnbakedModel implements UnbakedModel {
private static final SpriteIdentifier WHITE_CONCRETE_SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofDefaultNamespace("block/white_concrete"));
private static final SpriteIdentifier WHITE_CONCRETE_SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofVanilla("block/white_concrete"));
// (B - A) is the side length of a regular octagon that fits in a unit square.
// The line from A to B is centered on the line from 0 to 1.
@ -60,7 +60,7 @@ public class OctagonalColumnUnbakedModel implements UnbakedModel {
@Nullable
@Override
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer) {
if (!RendererAccess.INSTANCE.hasRenderer()) {
return null;
}

View file

@ -51,7 +51,7 @@ public class PillarUnbakedModel implements UnbakedModel {
@Nullable
@Override
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer) {
Sprite[] sprites = new Sprite[SPRITES.size()];
for (int i = 0; i < sprites.length; ++i) {

View file

@ -20,16 +20,16 @@ import net.minecraft.client.render.RenderLayer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.test.renderer.FrameBlock;
import net.fabricmc.fabric.test.renderer.Registration;
public final class RendererClientTest implements ClientModInitializer {
@Override
public void onInitializeClient() {
ModelLoadingPlugin.register(pluginContext -> {
pluginContext.resolveModel().register(new ModelResolverImpl());
});
// TODO 1.21
// ModelLoadingPlugin.register(pluginContext -> {
// pluginContext.resolveModel().register(new ModelResolverImpl());
// });
for (FrameBlock frameBlock : Registration.FRAME_BLOCKS) {
// We don't specify a material for the frame mesh,

View file

@ -31,8 +31,8 @@ import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;
public class RiverstoneUnbakedModel implements UnbakedModel {
private static final Identifier STONE_MODEL_ID = Identifier.ofDefaultNamespace("block/stone");
private static final Identifier GOLD_BLOCK_MODEL_ID = Identifier.ofDefaultNamespace("block/gold_block");
private static final Identifier STONE_MODEL_ID = Identifier.ofVanilla("block/stone");
private static final Identifier GOLD_BLOCK_MODEL_ID = Identifier.ofVanilla("block/gold_block");
@Override
public Collection<Identifier> getModelDependencies() {
@ -45,7 +45,7 @@ public class RiverstoneUnbakedModel implements UnbakedModel {
@Nullable
@Override
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer) {
BakedModel stoneModel = baker.bake(STONE_MODEL_ID, rotationContainer);
BakedModel goldBlockModel = baker.bake(GOLD_BLOCK_MODEL_ID, rotationContainer);
return new RiverstoneBakedModel(stoneModel, goldBlockModel);

View file

@ -22,14 +22,14 @@ import it.unimi.dsi.fastutil.longs.Long2FloatOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import net.minecraft.block.BlockState;
import net.minecraft.class_9799;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.chunk.BlockBufferBuilderStorage;
import net.minecraft.client.render.chunk.BlockBufferAllocatorStorage;
import net.minecraft.client.render.chunk.ChunkRendererRegion;
import net.minecraft.client.util.BufferAllocator;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView;
@ -70,7 +70,7 @@ public class ChunkRenderInfo {
private final Long2FloatOpenHashMap aoLevelCache;
private final BlockPos.Mutable chunkOrigin = new BlockPos.Mutable();
BlockBufferBuilderStorage builders;
BlockBufferAllocatorStorage builders;
Map<RenderLayer, BufferBuilder> buffers;
BlockRenderView blockView;
@ -81,7 +81,7 @@ public class ChunkRenderInfo {
aoLevelCache.defaultReturnValue(Float.MAX_VALUE);
}
void prepare(ChunkRendererRegion blockView, BlockPos chunkOrigin, BlockBufferBuilderStorage builders, Map<RenderLayer, BufferBuilder> buffers) {
void prepare(ChunkRendererRegion blockView, BlockPos chunkOrigin, BlockBufferAllocatorStorage builders, Map<RenderLayer, BufferBuilder> buffers) {
this.blockView = blockView;
this.chunkOrigin.set(chunkOrigin);
this.builders = builders;
@ -99,7 +99,7 @@ public class ChunkRenderInfo {
BufferBuilder builder = buffers.get(renderLayer);
if (builder == null) {
class_9799 byteBuilder = builders.get(renderLayer);
BufferAllocator byteBuilder = builders.get(renderLayer);
builder = new BufferBuilder(byteBuilder, VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
buffers.put(renderLayer, builder);

View file

@ -23,7 +23,7 @@ import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.chunk.BlockBufferBuilderStorage;
import net.minecraft.client.render.chunk.BlockBufferAllocatorStorage;
import net.minecraft.client.render.chunk.ChunkRendererRegion;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.util.math.MatrixStack;
@ -72,7 +72,7 @@ public class TerrainRenderContext extends AbstractBlockRenderContext {
return chunkInfo.getInitializedBuffer(layer);
}
public void prepare(ChunkRendererRegion blockView, BlockPos chunkOrigin, BlockBufferBuilderStorage builders, Map<RenderLayer, BufferBuilder> builderMap) {
public void prepare(ChunkRendererRegion blockView, BlockPos chunkOrigin, BlockBufferAllocatorStorage builders, Map<RenderLayer, BufferBuilder> builderMap) {
blockInfo.prepareForWorld(blockView, true);
chunkInfo.prepare(blockView, chunkOrigin, builders, builderMap);
}

View file

@ -31,13 +31,13 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.class_9810;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.chunk.BlockBufferBuilderStorage;
import net.minecraft.client.render.chunk.BlockBufferAllocatorStorage;
import net.minecraft.client.render.chunk.ChunkRendererRegion;
import net.minecraft.client.render.chunk.SectionBuilder;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.BlockPos;
@ -65,14 +65,14 @@ import net.fabricmc.fabric.impl.client.indigo.renderer.render.TerrainRenderConte
* Renderer authors are responsible for creating the hooks they need.
* (Though they can use these as an example if they wish.)
*/
@Mixin(class_9810.class)
public abstract class ChunkBuilderBuiltChunkRebuildTaskMixin {
@Inject(method = "method_60904",
@Mixin(SectionBuilder.class)
public abstract class SectionBuilderMixin {
@Inject(method = "build",
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos;iterate(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Ljava/lang/Iterable;"),
locals = LocalCapture.CAPTURE_FAILHARD)
private void hookChunkBuild(ChunkSectionPos sectionPos, ChunkRendererRegion region, VertexSorter sorter,
BlockBufferBuilderStorage builder,
CallbackInfoReturnable<class_9810.class_9811> ci,
BlockBufferAllocatorStorage builder,
CallbackInfoReturnable<SectionBuilder.RenderData> ci,
@Local(ordinal = 0) Map<RenderLayer, BufferBuilder> builderMap) {
// hook just before iterating over the render chunk's chunks blocks, captures the buffer builder map
@ -97,7 +97,7 @@ public abstract class ChunkBuilderBuiltChunkRebuildTaskMixin {
* Normally this does nothing but will allow mods to create rendering hooks that are
* driven off of render type. (Not recommended or encouraged, but also not prevented.)
*/
@Redirect(method = "method_60904", require = 1, at = @At(value = "INVOKE",
@Redirect(method = "build", require = 1, at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/render/block/BlockRenderManager;renderBlock(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;)V"))
private void hookChunkBuildTessellate(BlockRenderManager renderManager, BlockState blockState, BlockPos blockPos, BlockRenderView blockView, MatrixStack matrix, VertexConsumer bufferBuilder, boolean checkSides, Random random) {
if (blockState.getRenderType() == BlockRenderType.MODEL) {
@ -115,7 +115,7 @@ public abstract class ChunkBuilderBuiltChunkRebuildTaskMixin {
/**
* Release all references. Probably not necessary but would be $#%! to debug if it is.
*/
@Inject(method = "method_60904",
@Inject(method = "build",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockModelRenderer;disableBrightnessCache()V"))
private void hookRebuildChunkReturn(CallbackInfoReturnable<Set<BlockEntity>> ci) {
// hook after iterating over the render chunk's chunks blocks, must be called if and only if hookChunkBuild happened

View file

@ -8,7 +8,7 @@
"client": [
"BakedModelMixin",
"BlockModelRendererMixin",
"ChunkBuilderBuiltChunkRebuildTaskMixin",
"SectionBuilderMixin",
"ChunkRendererRegionMixin",
"ItemRendererMixin"
],

View file

@ -42,27 +42,27 @@ public class SimpleFluidRenderHandler implements FluidRenderHandler {
/**
* The vanilla still water texture identifier.
*/
public static final Identifier WATER_STILL = Identifier.ofDefaultNamespace("block/water_still");
public static final Identifier WATER_STILL = Identifier.ofVanilla("block/water_still");
/**
* The vanilla flowing water texture identifier.
*/
public static final Identifier WATER_FLOWING = Identifier.ofDefaultNamespace("block/water_flow");
public static final Identifier WATER_FLOWING = Identifier.ofVanilla("block/water_flow");
/**
* The vanilla water overlay texture identifier.
*/
public static final Identifier WATER_OVERLAY = Identifier.ofDefaultNamespace("block/water_overlay");
public static final Identifier WATER_OVERLAY = Identifier.ofVanilla("block/water_overlay");
/**
* The vanilla still lava texture identifier.
*/
public static final Identifier LAVA_STILL = Identifier.ofDefaultNamespace("block/lava_still");
public static final Identifier LAVA_STILL = Identifier.ofVanilla("block/lava_still");
/**
* The vanilla flowing lava texture identifier.
*/
public static final Identifier LAVA_FLOWING = Identifier.ofDefaultNamespace("block/lava_flow");
public static final Identifier LAVA_FLOWING = Identifier.ofVanilla("block/lava_flow");
protected final Identifier stillTexture;
protected final Identifier flowingTexture;

View file

@ -19,8 +19,8 @@ package net.fabricmc.fabric.api.client.rendering.v1;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.item.TooltipData;
import net.minecraft.item.Item;
import net.minecraft.item.tooltip.TooltipData;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;

View file

@ -22,14 +22,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.item.TooltipData;
import net.minecraft.item.tooltip.TooltipData;
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
@Mixin(TooltipComponent.class)
public interface TooltipComponentMixin {
@Inject(
method = "of(Lnet/minecraft/client/item/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;",
method = "of(Lnet/minecraft/item/tooltip/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;",
at = @At("HEAD"),
cancellable = true
)

View file

@ -38,7 +38,7 @@ abstract class ShaderProgramMixin {
private String name;
// Allow loading FabricShaderPrograms from arbitrary namespaces.
@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofDefaultNamespace(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"), allow = 1)
@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofVanilla(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"), allow = 1)
private Identifier modifyId(String id, Operation<Identifier> original) {
if ((Object) this instanceof FabricShaderProgram) {
return FabricShaderProgram.rewriteAsId(id, name);
@ -57,7 +57,7 @@ abstract class ShaderProgramMixin {
return id;
}
@WrapOperation(method = "loadShader", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofDefaultNamespace(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"), allow = 1)
@WrapOperation(method = "loadShader", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Identifier;ofVanilla(Ljava/lang/String;)Lnet/minecraft/util/Identifier;"), allow = 1)
private static Identifier allowNoneMinecraftId(String id, Operation<Identifier> original) {
if (id.contains(String.valueOf(Identifier.NAMESPACE_SEPARATOR))) {
return Identifier.of(id);

View file

@ -20,12 +20,12 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Optional;
import net.minecraft.client.item.TooltipData;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.tooltip.TooltipData;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

View file

@ -29,7 +29,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer;
public class ArmorRenderingTests implements ClientModInitializer {
private BipedEntityModel<LivingEntity> armorModel;
private final Identifier texture = Identifier.ofDefaultNamespace("textures/block/dirt.png");
private final Identifier texture = Identifier.ofVanilla("textures/block/dirt.png");
// Renders a biped model with dirt texture, replacing diamond helmet and diamond chest plate rendering
@Override

View file

@ -35,7 +35,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.DimensionRenderingRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
public class DimensionalRenderingTest implements ClientModInitializer {
private static final Identifier END_SKY = Identifier.ofDefaultNamespace("textures/block/dirt.png");
private static final Identifier END_SKY = Identifier.ofVanilla("textures/block/dirt.png");
private static void render(WorldRenderContext context) {
RenderSystem.enableBlend();
@ -44,7 +44,7 @@ public class DimensionalRenderingTest implements ClientModInitializer {
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram);
RenderSystem.setShaderTexture(0, END_SKY);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.method_60827(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
BufferBuilder bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
Matrix4f matrix4f = context.positionMatrix();
bufferBuilder.vertex(matrix4f, -100.0f, -100.0f, -100.0f).texture(0.0F, 0.0F).color(255, 255, 255, 255);
@ -76,7 +76,7 @@ public class DimensionalRenderingTest implements ClientModInitializer {
bufferBuilder.vertex(matrix4f, -100.0f, 100.0f, 100.0f).texture(0.0F, 1.0F).color(255, 255, 255, 255);
bufferBuilder.vertex(matrix4f, -100.0f, -100.0f, 100.0f).texture(1.0F, 1.0F).color(255, 255, 255, 255);
bufferBuilder.vertex(matrix4f, -100.0f, -100.0f, -100.0f).texture(1.0F, 0.0F).color(255, 255, 255, 255);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.method_60800());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.depthMask(true);
RenderSystem.disableBlend();

View file

@ -56,12 +56,12 @@ public class HudAndShaderTest implements ClientModInitializer {
RenderSystem.setShader(() -> testShader);
RenderSystem.setShaderColor(0f, 1f, 0f, 1f);
Matrix4f positionMatrix = drawContext.getMatrices().peek().getPositionMatrix();
BufferBuilder buffer = Tessellator.getInstance().method_60827(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder buffer = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
buffer.vertex(positionMatrix, x, y, 50);
buffer.vertex(positionMatrix, x, y + 10, 50);
buffer.vertex(positionMatrix, x + 10, y + 10, 50);
buffer.vertex(positionMatrix, x + 10, y, 50);
BufferRenderer.drawWithGlobalProgram(buffer.method_60800());
BufferRenderer.drawWithGlobalProgram(buffer.end());
// Reset shader color
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
});

View file

@ -66,7 +66,7 @@ public class WorldRenderEventsTests implements ClientModInitializer {
MatrixStack matrices = context.matrixStack();
Vec3d camera = context.camera().getPos();
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder buffer = tessellator.method_60827(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
matrices.push();
matrices.translate(-camera.x, -camera.y, -camera.z);
@ -77,7 +77,7 @@ public class WorldRenderEventsTests implements ClientModInitializer {
RenderSystem.defaultBlendFunc();
WorldRenderer.renderFilledBox(matrices, buffer, 0, 100, 0, 1, 101, 1, 0, 1, 0, 0.5f);
BufferRenderer.drawWithGlobalProgram(buffer.method_60800());
BufferRenderer.drawWithGlobalProgram(buffer.end());
matrices.pop();
RenderSystem.disableBlend();

View file

@ -58,7 +58,7 @@ public abstract class KeyedResourceReloadListenerClientMixin implements Identifi
} else if (self instanceof TextureManager) {
this.fabric$id = ResourceReloadListenerKeys.TEXTURES;
} else {
this.fabric$id = Identifier.ofDefaultNamespace("private/" + self.getClass().getSimpleName().toLowerCase(Locale.ROOT));
this.fabric$id = Identifier.ofVanilla("private/" + self.getClass().getSimpleName().toLowerCase(Locale.ROOT));
}
}

View file

@ -25,17 +25,17 @@ import net.minecraft.util.Identifier;
*/
public final class ResourceReloadListenerKeys {
// client
public static final Identifier SOUNDS = Identifier.ofDefaultNamespace("sounds");
public static final Identifier FONTS = Identifier.ofDefaultNamespace("fonts");
public static final Identifier MODELS = Identifier.ofDefaultNamespace("models");
public static final Identifier LANGUAGES = Identifier.ofDefaultNamespace("languages");
public static final Identifier TEXTURES = Identifier.ofDefaultNamespace("textures");
public static final Identifier SOUNDS = Identifier.ofVanilla("sounds");
public static final Identifier FONTS = Identifier.ofVanilla("fonts");
public static final Identifier MODELS = Identifier.ofVanilla("models");
public static final Identifier LANGUAGES = Identifier.ofVanilla("languages");
public static final Identifier TEXTURES = Identifier.ofVanilla("textures");
// server
public static final Identifier TAGS = Identifier.ofDefaultNamespace("tags");
public static final Identifier RECIPES = Identifier.ofDefaultNamespace("recipes");
public static final Identifier ADVANCEMENTS = Identifier.ofDefaultNamespace("advancements");
public static final Identifier FUNCTIONS = Identifier.ofDefaultNamespace("functions");
public static final Identifier TAGS = Identifier.ofVanilla("tags");
public static final Identifier RECIPES = Identifier.ofVanilla("recipes");
public static final Identifier ADVANCEMENTS = Identifier.ofVanilla("advancements");
public static final Identifier FUNCTIONS = Identifier.ofVanilla("functions");
private ResourceReloadListenerKeys() { }
}

View file

@ -55,7 +55,7 @@ public abstract class KeyedResourceReloadListenerMixin implements IdentifiableRe
} else if (self instanceof TagManagerLoader) {
this.fabric$id = ResourceReloadListenerKeys.TAGS;
} else {
this.fabric$id = Identifier.ofDefaultNamespace("private/" + self.getClass().getSimpleName().toLowerCase(Locale.ROOT));
this.fabric$id = Identifier.ofVanilla("private/" + self.getClass().getSimpleName().toLowerCase(Locale.ROOT));
}
}

View file

@ -33,7 +33,7 @@ import net.fabricmc.fabric.api.client.screen.v1.ScreenKeyboardEvents;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
public final class ScreenTests implements ClientModInitializer {
public static final Identifier ARMOR_FULL_TEXTURE = Identifier.ofDefaultNamespace("hud/armor_full");
public static final Identifier ARMOR_FULL_TEXTURE = Identifier.ofVanilla("hud/armor_full");
private static final Logger LOGGER = LoggerFactory.getLogger("FabricScreenApiTests");
@Override

View file

@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos;
import net.fabricmc.fabric.test.screenhandler.screen.PositionedScreenHandler;
public class PositionedScreen extends HandledScreen<ScreenHandler> {
private static final Identifier TEXTURE = Identifier.ofDefaultNamespace("textures/gui/container/dispenser.png");
private static final Identifier TEXTURE = Identifier.ofVanilla("textures/gui/container/dispenser.png");
public PositionedScreen(ScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, getPositionText(handler).orElse(title));

View file

@ -20,8 +20,8 @@ import java.util.List;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.item.TooltipType;
import net.minecraft.client.texture.Sprite;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView;

View file

@ -23,9 +23,9 @@ import java.util.Objects;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.item.TooltipType;
import net.minecraft.client.texture.Sprite;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

View file

@ -94,7 +94,7 @@ public class FluidVariantRenderTest implements ClientModInitializer {
RenderSystem.disableDepthTest();
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram);
BufferBuilder bufferBuilder = Tessellator.getInstance().method_60827(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
float x0 = (float) i;
float y0 = (float) j;
float x1 = x0 + 16;
@ -109,7 +109,7 @@ public class FluidVariantRenderTest implements ClientModInitializer {
bufferBuilder.vertex(model, x1, y1, z).color(r, g, b, 1).texture(u1, v1);
bufferBuilder.vertex(model, x1, y0, z).color(r, g, b, 1).texture(u1, v0);
bufferBuilder.vertex(model, x0, y0, z).color(r, g, b, 1).texture(u0, v0);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.method_60800());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.enableDepthTest();
}

View file

@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
version=0.99.1
minecraft_version=24w21b
yarn_version=+build.3
version=0.99.2
minecraft_version=1.21-pre1
yarn_version=+build.2
loader_version=0.15.11
installer_version=1.0.1
@ -13,50 +13,49 @@ curseforge_minecraft_version=1.21-Snapshot
# Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.42
fabric-api-lookup-api-v1-version=1.6.63
fabric-biome-api-v1-version=13.0.27
fabric-api-lookup-api-v1-version=1.6.64
fabric-biome-api-v1-version=13.0.28
fabric-block-api-v1-version=1.0.22
fabric-block-view-api-v2-version=1.0.10
fabric-blockrenderlayer-v1-version=1.1.52
fabric-command-api-v1-version=1.2.47
fabric-command-api-v2-version=2.2.26
fabric-commands-v0-version=0.2.64
fabric-content-registries-v0-version=8.0.9
fabric-command-api-v1-version=1.2.48
fabric-command-api-v2-version=2.2.27
fabric-commands-v0-version=0.2.65
fabric-content-registries-v0-version=8.0.10
fabric-crash-report-info-v1-version=0.2.29
fabric-data-attachment-api-v1-version=1.1.20
fabric-data-generation-api-v1-version=20.2.1
fabric-dimensions-v1-version=3.0.1
fabric-entity-events-v1-version=1.6.11
fabric-data-attachment-api-v1-version=1.1.21
fabric-data-generation-api-v1-version=20.2.2
fabric-dimensions-v1-version=4.0.0
fabric-entity-events-v1-version=1.6.12
fabric-events-interaction-v0-version=0.7.10
fabric-game-rule-api-v1-version=1.0.52
fabric-gametest-api-v1-version=1.3.20
fabric-item-api-v1-version=10.0.0
fabric-item-group-api-v1-version=4.0.42
fabric-gametest-api-v1-version=2.0.0
fabric-item-api-v1-version=10.0.1
fabric-item-group-api-v1-version=4.0.43
fabric-key-binding-api-v1-version=1.0.47
fabric-keybindings-v0-version=0.2.45
fabric-lifecycle-events-v1-version=2.3.8
fabric-loot-api-v2-version=3.0.8
fabric-loot-api-v2-version=3.0.9
fabric-message-api-v1-version=6.0.13
fabric-model-loading-api-v1-version=1.0.14
fabric-models-v0-version=0.4.13
fabric-networking-api-v1-version=4.0.11
fabric-object-builder-api-v1-version=15.1.8
fabric-networking-api-v1-version=4.0.12
fabric-object-builder-api-v1-version=15.1.9
fabric-particles-v1-version=4.0.2
fabric-recipe-api-v1-version=5.0.6
fabric-registry-sync-v0-version=5.0.19
fabric-renderer-api-v1-version=3.2.14
fabric-renderer-indigo-version=1.6.0
fabric-renderer-registries-v1-version=3.2.64
fabric-recipe-api-v1-version=5.0.7
fabric-registry-sync-v0-version=5.0.20
fabric-renderer-api-v1-version=3.2.15
fabric-renderer-indigo-version=1.6.1
fabric-renderer-registries-v1-version=3.2.65
fabric-rendering-data-attachment-v1-version=0.3.48
fabric-rendering-fluids-v1-version=3.1.5
fabric-rendering-v0-version=1.1.67
fabric-rendering-v1-version=5.0.1
fabric-rendering-fluids-v1-version=3.1.6
fabric-rendering-v0-version=1.1.68
fabric-rendering-v1-version=5.0.2
fabric-resource-conditions-api-v1-version=4.2.1
fabric-resource-loader-v0-version=1.1.2
fabric-screen-api-v1-version=2.0.23
fabric-screen-handler-api-v1-version=1.3.76
fabric-resource-loader-v0-version=1.1.3
fabric-screen-api-v1-version=2.0.24
fabric-screen-handler-api-v1-version=1.3.77
fabric-sound-api-v1-version=1.0.23
fabric-transfer-api-v1-version=5.1.10
fabric-transfer-api-v1-version=5.1.11
fabric-transitive-access-wideners-v1-version=6.0.12
fabric-convention-tags-v1-version=2.0.8
fabric-convention-tags-v2-version=2.1.3

View file

@ -39,7 +39,7 @@ include 'fabric-key-binding-api-v1'
include 'fabric-lifecycle-events-v1'
include 'fabric-loot-api-v2'
include 'fabric-message-api-v1'
include 'fabric-model-loading-api-v1'
//include 'fabric-model-loading-api-v1' TODO 1.21
include 'fabric-networking-api-v1'
include 'fabric-object-builder-api-v1'
include 'fabric-particles-v1'
@ -62,7 +62,6 @@ include 'deprecated:fabric-command-api-v1'
include 'deprecated:fabric-commands-v0'
include 'deprecated:fabric-convention-tags-v1'
include 'deprecated:fabric-keybindings-v0'
include 'deprecated:fabric-models-v0'
include 'deprecated:fabric-renderer-registries-v1'
include 'deprecated:fabric-rendering-data-attachment-v1'
include 'deprecated:fabric-rendering-v0'