Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FabricMC/fabric
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.96.1+1.20.5
Choose a base ref
...
head repository: FabricMC/fabric
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.96.3+1.20.5
Choose a head ref
  • 9 commits
  • 39 files changed
  • 3 contributors

Commits on Feb 14, 2024

  1. 24w07a

    modmuss50 committed Feb 14, 2024
    Copy the full SHA
    548b1e1 View commit details

Commits on Feb 18, 2024

  1. [1.20.5] Misc networking cleanup (#3594)

    * Misc networking cleanup
    
    * Dont invoke event twice
    
    * Review tweaks
    modmuss50 authored Feb 18, 2024
    Copy the full SHA
    ac5f717 View commit details
  2. Fix teal sign testmod crash by registering the wood type. (#3599)

    modmuss50 authored Feb 18, 2024
    Copy the full SHA
    98c5af8 View commit details
  3. Fix registry sync (#3598)

    * Fix registry sync
    
    * Don't use read/writeByteArray, as we know the whole payload is the bytearray
    
    * Add unit tests
    modmuss50 authored Feb 18, 2024
    Copy the full SHA
    ea0cfbb View commit details
  4. Fluid rendering fixes (#3593)

    * Fluid rendering fixes
    
    - Fix default overlay block check using TransparentBlock instead of TranslucentBlock
    - Fix setBlockTransparency/isBlockTransparent not being thread-safe
    - Reuse the same render handler objects for water and lava
    
    * Fix implementation issues
    
    - Fix custom geometry being buffered twice if FluidRenderHandler#renderFluid is invoked directly
    - Fix calling FluidRenderHandler.super.renderFluid not using passed arguments to calculate color
    - Fix calling FluidRenderHandler.super.renderFluid more than once producing incorrect geometry
    - Fix fluids with no handler never receiving water overlay instead of using default behavior
    
    * Add way to render fluid with non-vanilla default
    
    - Fix testmod
    
    (cherry picked from commit e761c66)
    PepperCode1 authored and modmuss50 committed Feb 18, 2024
    Copy the full SHA
    2c869de View commit details
  5. Remove unnecessary recreation of identifiers in VillagerTypeHelper.re…

    …gister (#3597)
    
    (cherry picked from commit c0751a9)
    Syst3ms authored and modmuss50 committed Feb 18, 2024
    Copy the full SHA
    e2e84a3 View commit details
  6. Improve handling of empty item groups in the creative menu (#3600)

    * Better handling of empty item groups in pagination
    
    Empty/non-displayable item groups are now put after all other groups and only then are they split into pages.
    
    * Serendipitious bugfix
    
    Fixed an issue where empty item groups could get selected when switching pages
    
    * checkstyle
    
    (cherry picked from commit f9b333c)
    Syst3ms authored and modmuss50 committed Feb 18, 2024
    Copy the full SHA
    a9531dc View commit details
  7. Fix ClientPlayNetworking.Contexnt.player() being null (#3603)

    * Fix ClientPlayNetworking.Contexnt.player() being null
    
    * Minor cleanup
    modmuss50 authored Feb 18, 2024
    Copy the full SHA
    793274c View commit details
  8. Bump version

    modmuss50 committed Feb 18, 2024
    Copy the full SHA
    4fcbeea View commit details
Showing with 691 additions and 338 deletions.
  1. +39 −0 fabric-biome-api-v1/src/testmod/java/net/fabricmc/fabric/test/biome/DataGeneratorEntrypoint.java
  2. +2 −11 fabric-biome-api-v1/src/testmod/java/net/fabricmc/fabric/test/biome/FabricBiomeTest.java
  3. +3 −21 fabric-biome-api-v1/src/testmod/java/net/fabricmc/fabric/test/biome/WorldgenProvider.java
  4. +6 −6 ...egistries-v0/src/main/java/net/fabricmc/fabric/mixin/content/registry/LandPathNodeMakerMixin.java
  5. +2 −2 ...ttachment-api-v1/src/main/java/net/fabricmc/fabric/impl/attachment/AttachmentSerializingImpl.java
  6. +27 −15 ...ta-attachment-api-v1/src/test/java/net/fabricmc/fabric/test/attachment/CommonAttachmentTests.java
  7. +1 −1 ...n-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricAdvancementProvider.java
  8. +1 −1 ...ion-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricCodecDataProvider.java
  9. +1 −1 ...i-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricDynamicRegistryProvider.java
  10. +1 −1 ...ration-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricRecipeProvider.java
  11. +1 −1 ...ation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/loot/FabricLootTableProviderImpl.java
  12. +1 −0 fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/mixin/gametest/TestFunctionsMixin.java
  13. +4 −7 ...i-v1/src/client/java/net/fabricmc/fabric/mixin/itemgroup/client/CreativeInventoryScreenMixin.java
  14. +27 −9 fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/mixin/itemgroup/ItemGroupsMixin.java
  15. +15 −0 fabric-item-group-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/group/ItemGroupTest.java
  16. +80 −0 ...g-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientCommonNetworkAddon.java
  17. +6 −48 ...1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientConfigurationNetworkAddon.java
  18. +16 −49 ...ing-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientPlayNetworkAddon.java
  19. +18 −1 ...rking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/AbstractChanneledNetworkAddon.java
  20. +5 −0 ...c-networking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/GlobalReceiverRegistry.java
  21. +6 −2 ...-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerConfigurationNetworkAddon.java
  22. +5 −0 ...rking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerPlayNetworkAddon.java
  23. +3 −0 ...ng-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/play/NetworkingPlayPacketTest.java
  24. +9 −1 ...odClient/java/net/fabricmc/fabric/test/networking/client/play/NetworkingPlayPacketClientTest.java
  25. +1 −1 ...r-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/villager/VillagerTypeHelper.java
  26. +2 −0 ...-object-builder-api-v1/src/testmod/java/net/fabricmc/fabric/test/object/builder/TealSignTest.java
  27. +9 −3 ...c-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/packet/DirectRegistryPacketHandler.java
  28. +118 −0 ...sync-v0/src/test/java/net/fabricmc/fabric/test/registry/sync/DirectRegistryPacketHandlerTest.java
  29. +10 −10 ...-fluids-v1/src/client/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandler.java
  30. +72 −0 ...ring-fluids-v1/src/client/java/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRendering.java
  31. +1 −1 ...s-v1/src/client/java/net/fabricmc/fabric/api/client/render/fluid/v1/SimpleFluidRenderHandler.java
  32. +17 −25 ...abric/impl/client/rendering/fluid/{FluidRendererHookContainer.java → FluidRenderHandlerInfo.java}
  33. +58 −43 ...c/client/java/net/fabricmc/fabric/impl/client/rendering/fluid/FluidRenderHandlerRegistryImpl.java
  34. +76 −0 ...fluids-v1/src/client/java/net/fabricmc/fabric/impl/client/rendering/fluid/FluidRenderingImpl.java
  35. +27 −57 ...luids-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/fluid/FluidRendererMixin.java
  36. +2 −2 ...c/testmodClient/java/net/fabricmc/fabric/test/client/rendering/fluid/CustomizedFluidRenderer.java
  37. +2 −2 ...-handler-api-v1/src/testmod/java/net/fabricmc/fabric/test/screenhandler/block/BoxBlockEntity.java
  38. +1 −1 ...sfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/gametests/VanillaStorageTests.java
  39. +16 −16 gradle.properties
Original file line number Diff line number Diff line change
@@ -16,12 +16,33 @@

package net.fabricmc.fabric.test.biome;

import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryBuilder;
import net.minecraft.registry.RegistryEntryLookup;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredFeatures;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.PlacedFeatures;
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;

public class DataGeneratorEntrypoint implements net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint {
public static final RegistryKey<ConfiguredFeature<?, ?>> COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.CONFIGURED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
);
public static final RegistryKey<PlacedFeature> PLACED_COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
);

@Override
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
FabricDataGenerator.Pack pack = dataGenerator.createPack();
@@ -31,6 +52,24 @@ public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {

@Override
public void buildRegistry(RegistryBuilder registryBuilder) {
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, this::bootstrapConfiguredFeatures);
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, this::bootstrapPlacedFeatures);
registryBuilder.addRegistry(RegistryKeys.BIOME, TestBiomes::bootstrap);
}

private void bootstrapConfiguredFeatures(Registerable<ConfiguredFeature<?, ?>> registerable) {
ConfiguredFeatures.register(registerable, COMMON_DESERT_WELL, Feature.DESERT_WELL);
}

private void bootstrapPlacedFeatures(Registerable<PlacedFeature> registerable) {
RegistryEntryLookup<ConfiguredFeature<?, ?>> configuredFeatures = registerable.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE);
RegistryEntry<ConfiguredFeature<?, ?>> commonDesertWell = configuredFeatures.getOrThrow(COMMON_DESERT_WELL);

// The placement config is taken from the vanilla desert well, but no randomness
PlacedFeatures.register(registerable, PLACED_COMMON_DESERT_WELL, commonDesertWell,
SquarePlacementModifier.of(),
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
BiomePlacementModifier.of()
);
}
}
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@

package net.fabricmc.fabric.test.biome;

import static net.fabricmc.fabric.test.biome.DataGeneratorEntrypoint.PLACED_COMMON_DESERT_WELL;

import com.google.common.base.Preconditions;

import net.minecraft.registry.RegistryKey;
@@ -25,8 +27,6 @@
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
@@ -48,15 +48,6 @@
public class FabricBiomeTest implements ModInitializer {
public static final String MOD_ID = "fabric-biome-api-v1-testmod";

public static final RegistryKey<ConfiguredFeature<?, ?>> COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.CONFIGURED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
);
public static final RegistryKey<PlacedFeature> PLACED_COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
);

@Override
public void onInitialize() {
Preconditions.checkArgument(NetherBiomes.canGenerateInNether(BiomeKeys.NETHER_WASTES));
Original file line number Diff line number Diff line change
@@ -16,20 +16,10 @@

package net.fabricmc.fabric.test.biome;

import java.util.List;
import java.util.concurrent.CompletableFuture;

import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.PlacedFeatures;
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
@@ -41,17 +31,9 @@ public WorldgenProvider(FabricDataOutput output, CompletableFuture<RegistryWrapp

@Override
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
final RegistryWrapper.Impl<Biome> biomeRegistry = registries.getWrapperOrThrow(RegistryKeys.BIOME);

entries.addAll(biomeRegistry);

ConfiguredFeature<?, ?> COMMON_DESERT_WELL = new ConfiguredFeature<>(Feature.DESERT_WELL, DefaultFeatureConfig.INSTANCE);

RegistryEntry<ConfiguredFeature<?, ?>> featureRef = entries.add(FabricBiomeTest.COMMON_DESERT_WELL, COMMON_DESERT_WELL);

// The placement config is taken from the vanilla desert well, but no randomness
PlacedFeature PLACED_COMMON_DESERT_WELL = new PlacedFeature(featureRef, List.of(SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()));
entries.add(FabricBiomeTest.PLACED_COMMON_DESERT_WELL, PLACED_COMMON_DESERT_WELL);
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.BIOME));
entries.add(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE), DataGeneratorEntrypoint.COMMON_DESERT_WELL);
entries.add(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE), DataGeneratorEntrypoint.PLACED_COMMON_DESERT_WELL);
}

@Override
Original file line number Diff line number Diff line change
@@ -16,11 +16,11 @@

package net.fabricmc.fabric.mixin.content.registry;

import com.llamalad7.mixinextras.sugar.Local;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import net.minecraft.block.BlockState;
import net.minecraft.entity.ai.pathing.LandPathNodeMaker;
@@ -36,8 +36,8 @@ public class LandPathNodeMakerMixin {
/**
* Overrides the node type for the specified position, if the position is a direct target in a path.
*/
@Inject(method = "getCommonNodeType", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/BlockView;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
private static void getCommonNodeType(BlockView world, BlockPos pos, CallbackInfoReturnable<PathNodeType> cir, BlockState state) {
@Inject(method = "getCommonNodeType", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), cancellable = true)
private static void getCommonNodeType(BlockView world, BlockPos pos, CallbackInfoReturnable<PathNodeType> cir, @Local BlockState state) {
PathNodeType nodeType = LandPathNodeTypesRegistry.getPathNodeType(state, world, pos, false);

if (nodeType != null) {
@@ -48,9 +48,9 @@ private static void getCommonNodeType(BlockView world, BlockPos pos, CallbackInf
/**
* Overrides the node type for the specified position, if the position is found as neighbor block in a path.
*/
@Inject(method = "getNodeTypeFromNeighbors", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/BlockView;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
private static void getNodeTypeFromNeighbors(BlockView world, BlockPos.Mutable pos, PathNodeType nodeType, CallbackInfoReturnable<PathNodeType> cir, int i, int j, int k, int l, int m, int n, BlockState state) {
PathNodeType neighborNodeType = LandPathNodeTypesRegistry.getPathNodeType(state, world, pos, true);
@Inject(method = "getNodeTypeFromNeighbors", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/entity/ai/pathing/LandPathNodeMaker;getCommonNodeType(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/entity/ai/pathing/PathNodeType;"), cancellable = true)
private static void getNodeTypeFromNeighbors(BlockView world, BlockPos.Mutable pos, PathNodeType nodeType, CallbackInfoReturnable<PathNodeType> cir) {
PathNodeType neighborNodeType = LandPathNodeTypesRegistry.getPathNodeType(world.getBlockState(pos), world, pos, true);

if (neighborNodeType != null) {
cir.setReturnValue(neighborNodeType);
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public static void serializeAttachmentData(NbtCompound nbt, RegistryWrapper.Wrap
Codec<Object> codec = (Codec<Object>) type.persistenceCodec();

if (codec != null) {
RegistryOps<NbtElement> registryOps = RegistryOps.of(NbtOps.INSTANCE, wrapperLookup);
RegistryOps<NbtElement> registryOps = wrapperLookup.method_57093(NbtOps.INSTANCE);
codec.encodeStart(registryOps, entry.getValue())
.get()
.ifRight(partial -> {
@@ -81,7 +81,7 @@ public static IdentityHashMap<AttachmentType<?>, Object> deserializeAttachmentDa
Codec<?> codec = type.persistenceCodec();

if (codec != null) {
RegistryOps<NbtElement> registryOps = RegistryOps.of(NbtOps.INSTANCE, wrapperLookup);
RegistryOps<NbtElement> registryOps = wrapperLookup.method_57093(NbtOps.INSTANCE);
codec.parse(registryOps, compound.get(key))
.get()
.ifRight(partial -> {
Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.CALLS_REAL_METHODS;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;

import java.util.IdentityHashMap;
import java.util.Map;
@@ -45,9 +45,13 @@
import net.minecraft.entity.MarkerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.RegistryOps;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ProtoChunk;
import net.minecraft.world.chunk.WorldChunk;

@@ -134,11 +138,11 @@ void testStaticReadWrite() {
map.put(dummy, 0.5d);
var fakeSave = new NbtCompound();

AttachmentSerializingImpl.serializeAttachmentData(fakeSave, null, map);
AttachmentSerializingImpl.serializeAttachmentData(fakeSave, mockDRM(), map);
assertTrue(fakeSave.contains(AttachmentTarget.NBT_ATTACHMENT_KEY, NbtElement.COMPOUND_TYPE));
assertTrue(fakeSave.getCompound(AttachmentTarget.NBT_ATTACHMENT_KEY).contains(dummy.identifier().toString()));

map = AttachmentSerializingImpl.deserializeAttachmentData(fakeSave, null);
map = AttachmentSerializingImpl.deserializeAttachmentData(fakeSave, mockDRM());
assertEquals(1, map.size());
Map.Entry<AttachmentType<?>, Object> entry = map.entrySet().stream().findFirst().orElseThrow();
// in this case the key should be the exact same object
@@ -150,19 +154,19 @@ void testStaticReadWrite() {
@Test
void deserializeNull() {
var nbt = new NbtCompound();
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, null));
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, mockDRM()));

nbt.put(new Identifier("test").toString(), new NbtCompound());
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, null));
assertNull(AttachmentSerializingImpl.deserializeAttachmentData(nbt, mockDRM()));
}

@Test
void serializeNullOrEmpty() {
var nbt = new NbtCompound();
AttachmentSerializingImpl.serializeAttachmentData(nbt, null, null);
AttachmentSerializingImpl.serializeAttachmentData(nbt, mockDRM(), null);
assertFalse(nbt.contains(AttachmentTarget.NBT_ATTACHMENT_KEY));

AttachmentSerializingImpl.serializeAttachmentData(nbt, null, new IdentityHashMap<>());
AttachmentSerializingImpl.serializeAttachmentData(nbt, mockDRM(), new IdentityHashMap<>());
assertFalse(nbt.contains(AttachmentTarget.NBT_ATTACHMENT_KEY));
}

@@ -192,17 +196,19 @@ void testEntityCopy() {

@Test
void testEntityPersistence() {
Entity entity = new MarkerEntity(EntityType.MARKER, mock());
DynamicRegistryManager drm = mockDRM();
World mockWorld = mock(World.class);
when(mockWorld.getRegistryManager()).thenReturn(drm);
Entity entity = new MarkerEntity(EntityType.MARKER, mockWorld);
assertFalse(entity.hasAttached(PERSISTENT));

int expected = 1;
entity.setAttached(PERSISTENT, expected);
NbtCompound fakeSave = new NbtCompound();
entity.writeNbt(fakeSave);

entity = spy(new MarkerEntity(EntityType.MARKER, mock())); // fresh object, like on restart
entity = new MarkerEntity(EntityType.MARKER, mockWorld); // fresh object, like on restart
entity.setChangeListener(mock());
doNothing().when(entity).calculateDimensions();
entity.readNbt(fakeSave);
assertTrue(entity.hasAttached(PERSISTENT));
assertEquals(expected, entity.getAttached(PERSISTENT));
@@ -215,9 +221,9 @@ void testBlockEntityPersistence() {

int expected = 1;
blockEntity.setAttached(PERSISTENT, expected);
NbtCompound fakeSave = blockEntity.createNbtWithId(null);
NbtCompound fakeSave = blockEntity.createNbtWithId(mockDRM());

blockEntity = BlockEntity.createFromNbt(BlockPos.ORIGIN, mock(), fakeSave, null);
blockEntity = BlockEntity.createFromNbt(BlockPos.ORIGIN, mock(), fakeSave, mockDRM());
assertNotNull(blockEntity);
assertTrue(blockEntity.hasAttached(PERSISTENT));
assertEquals(expected, blockEntity.getAttached(PERSISTENT));
@@ -232,10 +238,10 @@ void testWorldPersistentState() {

int expected = 1;
world.setAttached(PERSISTENT, expected);
NbtCompound fakeSave = state.writeNbt(new NbtCompound(), null);
NbtCompound fakeSave = state.writeNbt(new NbtCompound(), mockDRM());

world = mock(ServerWorld.class, CALLS_REAL_METHODS);
AttachmentPersistentState.read(world, fakeSave, null);
AttachmentPersistentState.read(world, fakeSave, mockDRM());
assertTrue(world.hasAttached(PERSISTENT));
assertEquals(expected, world.getAttached(PERSISTENT));
}
@@ -244,4 +250,10 @@ void testWorldPersistentState() {
* Chunk serializing is coupled with world saving in ChunkSerializer which is too much of a pain to mock,
* so testing is handled by the testmod instead.
*/

private static DynamicRegistryManager mockDRM() {
DynamicRegistryManager drm = mock(DynamicRegistryManager.class);
when(drm.method_57093(any())).thenReturn((RegistryOps<Object>) (Object) RegistryOps.of(NbtOps.INSTANCE, drm));
return drm;
}
}
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ public CompletableFuture<?> run(DataWriter writer) {
generateAdvancement(advancements::add);

return this.registryLookup.thenCompose(lookup -> {
RegistryOps<JsonElement> ops = RegistryOps.of(JsonOps.INSTANCE, lookup);
RegistryOps<JsonElement> ops = lookup.method_57093(JsonOps.INSTANCE);
final List<CompletableFuture<?>> futures = new ArrayList<>();

for (AdvancementEntry advancement : advancements) {
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ protected FabricCodecDataProvider(FabricDataOutput dataOutput, CompletableFuture
public CompletableFuture<?> run(DataWriter writer) {
return this.registriesFuture.thenCompose(lookup -> {
Map<Identifier, JsonElement> entries = new HashMap<>();
RegistryOps<JsonElement> ops = RegistryOps.of(JsonOps.INSTANCE, lookup);
RegistryOps<JsonElement> ops = lookup.method_57093(JsonOps.INSTANCE);

BiConsumer<Identifier, T> provider = (id, value) -> {
JsonElement json = this.convert(id, value, ops);
Original file line number Diff line number Diff line change
@@ -208,7 +208,7 @@ public CompletableFuture<?> run(DataWriter writer) {
return entries;
})
.thenCompose(entries -> {
final RegistryOps<JsonElement> dynamicOps = RegistryOps.of(JsonOps.INSTANCE, registries);
final RegistryOps<JsonElement> dynamicOps = registries.method_57093(JsonOps.INSTANCE);
ArrayList<CompletableFuture<?>> futures = new ArrayList<>();

for (RegistryEntries<?> registryEntries : entries.queuedEntries.values()) {
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public void accept(Identifier recipeId, Recipe<?> recipe, @Nullable AdvancementE
throw new IllegalStateException("Duplicate recipe " + identifier);
}

RegistryOps<JsonElement> registryOps = RegistryOps.of(JsonOps.INSTANCE, wrapperLookup);
RegistryOps<JsonElement> registryOps = wrapperLookup.method_57093(JsonOps.INSTANCE);
JsonObject recipeJson = Util.getResult(Recipe.CODEC.encodeStart(registryOps, recipe), IllegalStateException::new).getAsJsonObject();
ConditionJsonProvider[] conditions = FabricDataGenHelper.consumeConditions(recipe);
ConditionJsonProvider.write(recipeJson, conditions);
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ public static CompletableFuture<?> run(
});

return registryLookup.thenCompose(lookup -> {
RegistryOps<JsonElement> ops = RegistryOps.of(JsonOps.INSTANCE, lookup);
RegistryOps<JsonElement> ops = lookup.method_57093(JsonOps.INSTANCE);
final List<CompletableFuture<?>> futures = new ArrayList<>();

for (Map.Entry<Identifier, LootTable> entry : builders.entrySet()) {
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ private static void getTestFunction(Method method, CallbackInfoReturnable<TestFu
gameTest.required(),
gameTest.requiredSuccesses(),
gameTest.maxAttempts(),
gameTest.method_57098(),
FabricGameTestHelper.getTestMethodInvoker(method)
);

Original file line number Diff line number Diff line change
@@ -93,13 +93,10 @@ public boolean fabric_isButtonEnabled(FabricCreativeGuiComponents.Type type) {

private void fabric_updateSelection() {
if (!fabric_isGroupVisible(selectedTab)) {
ItemGroups.getGroups().stream()
ItemGroups.getGroups()
.stream()
.filter(this::fabric_isGroupVisible)
.min((a, b) -> {
if (a.isSpecial() && !b.isSpecial()) return 1;
if (!a.isSpecial() && b.isSpecial()) return -1;
return 0;
})
.min((a, b) -> Boolean.compare(a.isSpecial(), b.isSpecial()))
.ifPresent(this::setSelectedTab);
}
}
@@ -144,7 +141,7 @@ private void renderTabIcon(DrawContext drawContext, ItemGroup itemGroup, Callbac
}

private boolean fabric_isGroupVisible(ItemGroup itemGroup) {
return fabric_currentPage == fabric_getPage(itemGroup);
return itemGroup.shouldDisplay() && fabric_currentPage == fabric_getPage(itemGroup);
}

private static int fabric_getPage(ItemGroup itemGroup) {
Loading