Skip to content

Commit

Permalink
24w38a (#4101)
Browse files Browse the repository at this point in the history
* 24w38a part 1

* Fix tests

* Bump version
  • Loading branch information
modmuss50 committed Sep 18, 2024
1 parent 67421c4 commit 50ed0fa
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static <T> boolean isInLocal(TagKey<T> tagKey, RegistryKey<T> registryKey
Objects.requireNonNull(tagKey);
Objects.requireNonNull(registryKey);

if (tagKey.registry().getValue().equals(registryKey.getRegistry())) {
if (tagKey.registryRef().getValue().equals(registryKey.getRegistry())) {
// Check local tags
Set<Identifier> ids = getOrCreateLocalTag(tagKey);
return ids.contains(registryKey.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public static <T> Optional<? extends Registry<T>> getRegistry(TagKey<T> tagKey)
if (MinecraftClient.getInstance().world != null) {
if (MinecraftClient.getInstance().world.getRegistryManager() != null) {
Optional<? extends Registry<T>> maybeRegistry = MinecraftClient.getInstance().world
.getRegistryManager().getOptional(tagKey.registry());
.getRegistryManager().getOptional(tagKey.registryRef());
if (maybeRegistry.isPresent()) return maybeRegistry;
}
}
}

return (Optional<? extends Registry<T>>) Registries.REGISTRIES.getOptionalValue(tagKey.registry().getValue());
return (Optional<? extends Registry<T>>) Registries.REGISTRIES.getOptionalValue(tagKey.registryRef().getValue());
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ClientTagsLoader {
*/
public static LoadedTag loadTag(TagKey<?> tagKey) {
var tags = new HashSet<TagEntry>();
HashSet<Path> tagFiles = getTagFiles(tagKey.registry(), tagKey.id());
HashSet<Path> tagFiles = getTagFiles(tagKey.registryRef(), tagKey.id());

for (Path tagPath : tagFiles) {
try (BufferedReader tagReader = Files.newBufferedReader(tagPath)) {
Expand Down Expand Up @@ -88,7 +88,7 @@ public Identifier direct(Identifier id) {
@Nullable
@Override
public Collection<Identifier> tag(Identifier id) {
TagKey<?> tag = TagKey.of(tagKey.registry(), id);
TagKey<?> tag = TagKey.of(tagKey.registryRef(), id);
immediateChildTags.add(tag);
return ClientTagsImpl.getOrCreatePartiallySyncedTag(tag).completeIds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.class_10209;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.text.Texts;
import net.minecraft.util.profiler.Profilers;

import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.mixin.command.HelpCommandAccessor;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static boolean executeCommand(String command) {
// noinspection ConstantConditions
FabricClientCommandSource commandSource = (FabricClientCommandSource) client.getNetworkHandler().getCommandSource();

class_10209.method_64146().push(command);
Profilers.get().push(command);

try {
// TODO: Check for server commands before executing.
Expand All @@ -101,7 +101,7 @@ public static boolean executeCommand(String command) {
commandSource.sendError(Text.of(e.getMessage()));
return true;
} finally {
class_10209.method_64146().pop();
Profilers.get().pop();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ default String getTranslationKey() {
stringBuilder.append("tag.");

TagKey<?> tagKey = (TagKey<?>) this;
Identifier registryIdentifier = tagKey.registry().getValue();
Identifier registryIdentifier = tagKey.registryRef().getValue();
Identifier tagIdentifier = tagKey.id();

if (!registryIdentifier.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public static <T> boolean isIn(@Nullable DynamicRegistryManager registryManager,
Objects.requireNonNull(entry);

if (registryManager != null) {
maybeRegistry = registryManager.getOptional(tagKey.registry());
maybeRegistry = registryManager.getOptional(tagKey.registryRef());
} else {
maybeRegistry = Registries.REGISTRIES.getOptionalValue(tagKey.registry().getValue());
maybeRegistry = Registries.REGISTRIES.getOptionalValue(tagKey.registryRef().getValue());
}

if (maybeRegistry.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testCrossWorldTeleport(TestContext context) {
ServerWorld end = server.getWorld(World.END);
// using overworld and end to avoid portal code related to the nether

Entity entity = EntityType.PIG.create(overworld, SpawnReason.SPAWN_EGG);
Entity entity = EntityType.PIG.create(overworld, SpawnReason.SPAWN_ITEM_USE);
Objects.requireNonNull(entity, "entity was null");
entity.setAttached(DUMMY, () -> 10);
entity.setAttached(COPY_ON_DEATH, () -> 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void beforeEach(TestContext context) {

private void afterEach(TestContext context) {
context.addInstantFinalTask(() ->
context.checkBlock(new BlockPos(0, 2, 0), (block) -> block == Blocks.DIAMOND_BLOCK, "Expect block to be gold")
context.checkBlock(new BlockPos(0, 1, 0), (block) -> block == Blocks.DIAMOND_BLOCK, "Expect block to be diamond")
);
}

Expand All @@ -58,6 +58,6 @@ public void diamond(TestContext context) {

@GameTest(templateName = EMPTY_STRUCTURE)
public void noStructure(TestContext context) {
context.setBlockState(0, 2, 0, Blocks.DIAMOND_BLOCK);
context.setBlockState(0, 1, 0, Blocks.DIAMOND_BLOCK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ExampleTestSuite {
@GameTest
public void diamond(TestContext context) {
context.addInstantFinalTask(() ->
context.checkBlock(new BlockPos(0, 2, 0), (block) -> block == Blocks.DIAMOND_BLOCK, "Expect block to be diamond")
context.checkBlock(new BlockPos(0, 1, 0), (block) -> block == Blocks.DIAMOND_BLOCK, "Expect block to be diamond")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

@Mixin(CapeFeatureRenderer.class)
public class CapeFeatureRendererMixin {
@WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/CapeFeatureRenderer;method_64257(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/equipment/EquipmentModel$LayerType;)Z"), method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V")
@WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/CapeFeatureRenderer;hasCustomModelForLayer(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/equipment/EquipmentModel$LayerType;)Z"), method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V")
public boolean injectCapeRenderCheck(CapeFeatureRenderer instance, ItemStack itemStack, EquipmentModel.LayerType layerType, Operation<Boolean> original, @Local(argsOnly = true) PlayerEntityRenderState state) {
if (!LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.invoker().allowCapeRender(state)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public <T> TagsPopulatedResourceCondition(Identifier registry, TagKey<T>... tags

@SafeVarargs
public <T> TagsPopulatedResourceCondition(TagKey<T>... tags) {
this(tags[0].registry().getValue(), Arrays.stream(tags).map(TagKey::id).toList());
this(tags[0].registryRef().getValue(), Arrays.stream(tags).map(TagKey::id).toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ private CreateWorldScreenMixin() {
super(null);
}

@ModifyVariable(method = "method_64244",
@ModifyVariable(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/class_10241;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/CreateWorldScreen;createServerConfig(Lnet/minecraft/resource/ResourcePackManager;Lnet/minecraft/resource/DataConfiguration;)Lnet/minecraft/server/SaveLoading$ServerConfig;"))
private static ResourcePackManager onCreateResManagerInit(ResourcePackManager manager) {
// Add mod data packs to the initial res pack manager so they are active even if the user doesn't use custom data packs
manager.providers.add(new ModResourcePackCreator(ResourceType.SERVER_DATA));
return manager;
}

@Redirect(method = "method_64244", at = @At(value = "FIELD", target = "Lnet/minecraft/resource/DataConfiguration;SAFE_MODE:Lnet/minecraft/resource/DataConfiguration;", ordinal = 0))
@Redirect(method = "show(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/screen/Screen;Ljava/util/function/Function;Lnet/minecraft/client/world/GeneratorOptionsFactory;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/class_10241;)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/resource/DataConfiguration;SAFE_MODE:Lnet/minecraft/resource/DataConfiguration;", ordinal = 0))
private static DataConfiguration replaceDefaultSettings() {
return ModResourcePackUtil.createDefaultDataConfiguration();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.mojang.serialization.codecs.RecordCodecBuilder;

import net.minecraft.component.ComponentChanges;
import net.minecraft.component.ComponentMapImpl;
import net.minecraft.component.MergedComponentMap;
import net.minecraft.item.ItemStack;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
Expand Down Expand Up @@ -60,6 +60,6 @@ public class VariantCodecs {
);

private static DataResult<ItemVariant> validateComponents(ItemVariant variant) {
return ItemStack.validateComponents(ComponentMapImpl.create(variant.getItem().getComponents(), variant.getComponents())).map(v -> variant);
return ItemStack.validateComponents(MergedComponentMap.create(variant.getItem().getComponents(), variant.getComponents())).map(v -> variant);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import net.minecraft.component.ComponentChanges;
import net.minecraft.component.ComponentMap;
import net.minecraft.component.ComponentMapImpl;
import net.minecraft.component.MergedComponentMap;
import net.minecraft.fluid.FlowableFluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
Expand Down Expand Up @@ -71,7 +71,7 @@ public static FluidVariant of(RegistryEntry<Fluid> fluid, ComponentChanges compo
public FluidVariantImpl(Fluid fluid, ComponentChanges components) {
this.fluid = fluid;
this.components = components;
this.componentMap = components == ComponentChanges.EMPTY ? ComponentMap.EMPTY : ComponentMapImpl.create(ComponentMap.EMPTY, components);
this.componentMap = components == ComponentChanges.EMPTY ? ComponentMap.EMPTY : MergedComponentMap.create(ComponentMap.EMPTY, components);
this.hashCode = Objects.hash(fluid, components);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void onFinalCommit() {
location.setBlockState(newState);

if (newLevel == 7) {
location.world.scheduleBlockTick(location.pos, state.getBlock(), 20);
location.world.method_64310(location.pos, state.getBlock(), 20);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void testBadBrewingStandIsValid(TestContext context) {
*/
@GameTest(templateName = "fabric-transfer-api-v1-testmod:double_chest_comparators", skyAccess = true)
public void testDoubleChestComparator(TestContext context) {
BlockPos chestPos = new BlockPos(2, 2, 2);
BlockPos chestPos = new BlockPos(2, 1, 2);
Storage<ItemVariant> storage = ItemStorage.SIDED.find(context.getWorld(), context.getAbsolutePos(chestPos), Direction.UP);
context.assertTrue(storage != null, "Storage must not be null");

Expand Down
102 changes: 51 additions & 51 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true

version=0.104.1
minecraft_version=24w37a
yarn_version=+build.1
version=0.104.2
minecraft_version=24w38a
yarn_version=+build.2
loader_version=0.16.4
installer_version=1.0.1

prerelease=true
curseforge_minecraft_version=1.21.2-Snapshot

# Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.45
fabric-api-lookup-api-v1-version=1.6.74
fabric-biome-api-v1-version=14.0.2
fabric-block-api-v1-version=1.0.25
fabric-block-view-api-v2-version=1.0.13
fabric-blockrenderlayer-v1-version=1.1.55
fabric-command-api-v1-version=1.2.53
fabric-command-api-v2-version=2.2.32
fabric-commands-v0-version=0.2.70
fabric-content-registries-v0-version=9.0.5
fabric-crash-report-info-v1-version=0.3.0
fabric-data-attachment-api-v1-version=1.1.33
fabric-data-generation-api-v1-version=21.0.6
fabric-dimensions-v1-version=4.0.3
fabric-entity-events-v1-version=2.0.1
fabric-events-interaction-v0-version=2.0.3
fabric-game-rule-api-v1-version=1.0.56
fabric-gametest-api-v1-version=2.0.8
fabric-item-api-v1-version=11.0.5
fabric-item-group-api-v1-version=4.1.9
fabric-key-binding-api-v1-version=1.0.50
fabric-keybindings-v0-version=0.2.48
fabric-lifecycle-events-v1-version=2.3.18
fabric-loot-api-v2-version=3.0.18
fabric-loot-api-v3-version=1.0.6
fabric-message-api-v1-version=6.0.16
fabric-model-loading-api-v1-version=3.0.4
fabric-networking-api-v1-version=4.2.6
fabric-object-builder-api-v1-version=17.0.2
fabric-particles-v1-version=4.0.5
fabric-recipe-api-v1-version=6.0.3
fabric-registry-sync-v0-version=5.1.7
fabric-renderer-api-v1-version=3.5.2
fabric-renderer-indigo-version=1.8.2
fabric-rendering-data-attachment-v1-version=0.3.51
fabric-rendering-fluids-v1-version=3.1.9
fabric-rendering-v0-version=1.1.76
fabric-rendering-v1-version=8.0.0
fabric-resource-conditions-api-v1-version=5.0.2
fabric-resource-loader-v0-version=3.0.0
fabric-screen-api-v1-version=2.0.28
fabric-screen-handler-api-v1-version=1.3.91
fabric-sound-api-v1-version=1.0.26
fabric-transfer-api-v1-version=5.2.1
fabric-transitive-access-wideners-v1-version=6.1.4
fabric-convention-tags-v1-version=2.0.27
fabric-convention-tags-v2-version=2.7.1
fabric-client-tags-api-v1-version=1.1.18
fabric-api-base-version=0.4.46
fabric-api-lookup-api-v1-version=1.6.75
fabric-biome-api-v1-version=14.0.3
fabric-block-api-v1-version=1.0.26
fabric-block-view-api-v2-version=1.0.14
fabric-blockrenderlayer-v1-version=2.0.0
fabric-command-api-v1-version=1.2.54
fabric-command-api-v2-version=2.2.33
fabric-commands-v0-version=0.2.71
fabric-content-registries-v0-version=9.0.6
fabric-crash-report-info-v1-version=0.3.1
fabric-data-attachment-api-v1-version=1.1.34
fabric-data-generation-api-v1-version=21.0.7
fabric-dimensions-v1-version=4.0.4
fabric-entity-events-v1-version=2.0.2
fabric-events-interaction-v0-version=2.0.4
fabric-game-rule-api-v1-version=1.0.57
fabric-gametest-api-v1-version=2.0.9
fabric-item-api-v1-version=11.0.6
fabric-item-group-api-v1-version=4.1.10
fabric-key-binding-api-v1-version=1.0.51
fabric-keybindings-v0-version=0.2.49
fabric-lifecycle-events-v1-version=2.3.19
fabric-loot-api-v2-version=3.0.19
fabric-loot-api-v3-version=1.0.7
fabric-message-api-v1-version=6.0.17
fabric-model-loading-api-v1-version=3.0.5
fabric-networking-api-v1-version=4.2.7
fabric-object-builder-api-v1-version=17.0.3
fabric-particles-v1-version=4.0.6
fabric-recipe-api-v1-version=6.0.4
fabric-registry-sync-v0-version=5.1.8
fabric-renderer-api-v1-version=4.0.0
fabric-renderer-indigo-version=1.9.0
fabric-rendering-data-attachment-v1-version=0.3.52
fabric-rendering-fluids-v1-version=3.1.10
fabric-rendering-v0-version=1.1.77
fabric-rendering-v1-version=8.0.1
fabric-resource-conditions-api-v1-version=5.0.3
fabric-resource-loader-v0-version=3.0.1
fabric-screen-api-v1-version=2.0.29
fabric-screen-handler-api-v1-version=1.3.92
fabric-sound-api-v1-version=1.0.27
fabric-transfer-api-v1-version=5.2.2
fabric-transitive-access-wideners-v1-version=6.1.5
fabric-convention-tags-v1-version=2.0.28
fabric-convention-tags-v2-version=2.7.2
fabric-client-tags-api-v1-version=1.1.19

0 comments on commit 50ed0fa

Please sign in to comment.