mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-14 19:25:23 -05:00
Finish port to 24w20a (#3777)
* [BREAKING] pass entity to EquipmentSlotProvider * Improve mixin for chunk unload event * `TestContext#getBlockEntity` result can be used without checks/casts now * Fix typos
This commit is contained in:
parent
3c207badd1
commit
0684cd12de
14 changed files with 43 additions and 40 deletions
|
@ -47,10 +47,10 @@ public final class ConventionalBiomeTags {
|
||||||
/**
|
/**
|
||||||
* Biomes that spawn in the Overworld.
|
* Biomes that spawn in the Overworld.
|
||||||
* (This is for people who want to tag their biomes as Overworld without getting
|
* (This is for people who want to tag their biomes as Overworld without getting
|
||||||
* side effects from {@link net.minecraft.registry.tag.BiomeTags.IS_OVERWORLD}.
|
* side effects from {@link net.minecraft.registry.tag.BiomeTags#IS_OVERWORLD}.
|
||||||
* <p></p>
|
* <p></p>
|
||||||
* NOTE: If you do not add to the vanilla Overworld tag, be sure to add to
|
* NOTE: If you do not add to the vanilla Overworld tag, be sure to add to
|
||||||
* {@link net.minecraft.registry.tag.BiomeTags.STRONGHOLD_HAS_STRUCTURE} so
|
* {@link net.minecraft.registry.tag.BiomeTags#STRONGHOLD_HAS_STRUCTURE} so
|
||||||
* some Strongholds do not go missing.)
|
* some Strongholds do not go missing.)
|
||||||
*/
|
*/
|
||||||
public static final TagKey<Biome> IS_OVERWORLD = register("is_overworld");
|
public static final TagKey<Biome> IS_OVERWORLD = register("is_overworld");
|
||||||
|
@ -169,7 +169,7 @@ public final class ConventionalBiomeTags {
|
||||||
/**
|
/**
|
||||||
* Biomes that spawn in the Nether.
|
* Biomes that spawn in the Nether.
|
||||||
* (This is for people who want to tag their biomes as Nether without getting
|
* (This is for people who want to tag their biomes as Nether without getting
|
||||||
* side effects from {@link net.minecraft.registry.tag.BiomeTags.IS_NETHER})
|
* side effects from {@link net.minecraft.registry.tag.BiomeTags#IS_NETHER})
|
||||||
*/
|
*/
|
||||||
public static final TagKey<Biome> IS_NETHER = register("is_nether");
|
public static final TagKey<Biome> IS_NETHER = register("is_nether");
|
||||||
public static final TagKey<Biome> IS_NETHER_FOREST = register("is_nether_forest");
|
public static final TagKey<Biome> IS_NETHER_FOREST = register("is_nether_forest");
|
||||||
|
@ -177,7 +177,7 @@ public final class ConventionalBiomeTags {
|
||||||
/**
|
/**
|
||||||
* Biomes that spawn in the End.
|
* Biomes that spawn in the End.
|
||||||
* (This is for people who want to tag their biomes as End without getting
|
* (This is for people who want to tag their biomes as End without getting
|
||||||
* side effects from {@link net.minecraft.registry.tag.BiomeTags.IS_END})
|
* side effects from {@link net.minecraft.registry.tag.BiomeTags#IS_END})
|
||||||
*/
|
*/
|
||||||
public static final TagKey<Biome> IS_END = register("is_end");
|
public static final TagKey<Biome> IS_END = register("is_end");
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -216,7 +216,7 @@ public final class ConventionalItemTags {
|
||||||
/**
|
/**
|
||||||
* Tag that holds all blocks and items that can be dyed a specific color.
|
* Tag that holds all blocks and items that can be dyed a specific color.
|
||||||
* (Does not include color blending items like leather armor.
|
* (Does not include color blending items like leather armor.
|
||||||
* Use {@link net.minecraft.registry.tag.ItemTags.DYEABLE} tag instead for color blending items)
|
* Use {@link net.minecraft.registry.tag.ItemTags#DYEABLE} tag instead for color blending items)
|
||||||
* <p></p>
|
* <p></p>
|
||||||
* Note: Use custom ingredients in recipes to do tag intersections and/or tag exclusions
|
* Note: Use custom ingredients in recipes to do tag intersections and/or tag exclusions
|
||||||
* to make more powerful recipes utilizing multiple tags such as dyed tags for an ingredient.
|
* to make more powerful recipes utilizing multiple tags such as dyed tags for an ingredient.
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class EnchantmentEvents {
|
||||||
*
|
*
|
||||||
* @see AllowEnchanting#allowEnchanting(RegistryEntry, ItemStack, EnchantingContext)
|
* @see AllowEnchanting#allowEnchanting(RegistryEntry, ItemStack, EnchantingContext)
|
||||||
* @see Enchantment#isAcceptableItem(ItemStack)
|
* @see Enchantment#isAcceptableItem(ItemStack)
|
||||||
* @see FabricItem#canBeEnchantedWith(ItemStack, Enchantment, EnchantingContext)
|
* @see FabricItem#canBeEnchantedWith(ItemStack, RegistryEntry, EnchantingContext)
|
||||||
*/
|
*/
|
||||||
public static final Event<AllowEnchanting> ALLOW_ENCHANTING = EventFactory.createArrayBacked(
|
public static final Event<AllowEnchanting> ALLOW_ENCHANTING = EventFactory.createArrayBacked(
|
||||||
AllowEnchanting.class,
|
AllowEnchanting.class,
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package net.fabricmc.fabric.api.item.v1;
|
package net.fabricmc.fabric.api.item.v1;
|
||||||
|
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,8 +25,8 @@ import net.minecraft.item.ItemStack;
|
||||||
* This can be used to give non-armor items, such as blocks,
|
* This can be used to give non-armor items, such as blocks,
|
||||||
* an armor slot that they can go in.
|
* an armor slot that they can go in.
|
||||||
*
|
*
|
||||||
* <p>The preferred requipment slot of an item stack can be queried using
|
* <p>The preferred equipment slot of an item stack can be queried using
|
||||||
* {@link net.minecraft.entity.LivingEntity#getPreferredEquipmentSlot(ItemStack) LivingEntity.getPreferredEquipmentSlot()}.
|
* {@link LivingEntity#getPreferredEquipmentSlot(ItemStack) LivingEntity.getPreferredEquipmentSlot()}.
|
||||||
*
|
*
|
||||||
* <p>Equipment slot providers can be set with {@link FabricItem.Settings#equipmentSlot(EquipmentSlotProvider)}.
|
* <p>Equipment slot providers can be set with {@link FabricItem.Settings#equipmentSlot(EquipmentSlotProvider)}.
|
||||||
*
|
*
|
||||||
|
@ -40,8 +41,13 @@ public interface EquipmentSlotProvider {
|
||||||
* <p>If there is no preferred armor equipment slot for the stack,
|
* <p>If there is no preferred armor equipment slot for the stack,
|
||||||
* {@link EquipmentSlot#MAINHAND} can be returned.
|
* {@link EquipmentSlot#MAINHAND} can be returned.
|
||||||
*
|
*
|
||||||
|
* <p>Callers are expected to check themselves whether the slot is available for the
|
||||||
|
* {@code entity} using {@link LivingEntity#canUseSlot}. For example, players
|
||||||
|
* cannot use {@link EquipmentSlot#BODY}, which is instead used for items like horse armors.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
* @param stack the item stack
|
* @param stack the item stack
|
||||||
* @return the preferred equipment slot
|
* @return the preferred equipment slot
|
||||||
*/
|
*/
|
||||||
EquipmentSlot getPreferredEquipmentSlot(ItemStack stack);
|
EquipmentSlot getPreferredEquipmentSlot(LivingEntity entity, ItemStack stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ abstract class LivingEntityMixin {
|
||||||
EquipmentSlotProvider equipmentSlotProvider = ((ItemExtensions) stack.getItem()).fabric_getEquipmentSlotProvider();
|
EquipmentSlotProvider equipmentSlotProvider = ((ItemExtensions) stack.getItem()).fabric_getEquipmentSlotProvider();
|
||||||
|
|
||||||
if (equipmentSlotProvider != null) {
|
if (equipmentSlotProvider != null) {
|
||||||
info.setReturnValue(equipmentSlotProvider.getPreferredEquipmentSlot(stack));
|
info.setReturnValue(equipmentSlotProvider.getPreferredEquipmentSlot((LivingEntity) (Object) this, stack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package net.fabricmc.fabric.test.item.gametest;
|
package net.fabricmc.fabric.test.item.gametest;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||||
import net.minecraft.component.DataComponentTypes;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
@ -41,7 +39,7 @@ public class BrewingStandGameTest implements FabricGameTest {
|
||||||
@GameTest(templateName = EMPTY_STRUCTURE)
|
@GameTest(templateName = EMPTY_STRUCTURE)
|
||||||
public void basicBrewing(TestContext context) {
|
public void basicBrewing(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.BREWING_STAND);
|
context.setBlockState(POS, Blocks.BREWING_STAND);
|
||||||
BrewingStandBlockEntity blockEntity = (BrewingStandBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
BrewingStandBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
loadFuel(blockEntity, context);
|
loadFuel(blockEntity, context);
|
||||||
|
|
||||||
|
@ -62,7 +60,7 @@ public class BrewingStandGameTest implements FabricGameTest {
|
||||||
@GameTest(templateName = EMPTY_STRUCTURE)
|
@GameTest(templateName = EMPTY_STRUCTURE)
|
||||||
public void vanillaRemainderTest(TestContext context) {
|
public void vanillaRemainderTest(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.BREWING_STAND);
|
context.setBlockState(POS, Blocks.BREWING_STAND);
|
||||||
BrewingStandBlockEntity blockEntity = (BrewingStandBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
BrewingStandBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
loadFuel(blockEntity, context);
|
loadFuel(blockEntity, context);
|
||||||
|
|
||||||
|
@ -84,7 +82,7 @@ public class BrewingStandGameTest implements FabricGameTest {
|
||||||
// Skip see: https://github.com/FabricMC/fabric/pull/2874
|
// Skip see: https://github.com/FabricMC/fabric/pull/2874
|
||||||
public void fabricRemainderTest(TestContext context) {
|
public void fabricRemainderTest(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.BREWING_STAND);
|
context.setBlockState(POS, Blocks.BREWING_STAND);
|
||||||
BrewingStandBlockEntity blockEntity = (BrewingStandBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
BrewingStandBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
loadFuel(blockEntity, context);
|
loadFuel(blockEntity, context);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package net.fabricmc.fabric.test.item.gametest;
|
package net.fabricmc.fabric.test.item.gametest;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||||
|
@ -37,7 +35,7 @@ public class FurnaceGameTest implements FabricGameTest {
|
||||||
@GameTest(templateName = EMPTY_STRUCTURE)
|
@GameTest(templateName = EMPTY_STRUCTURE)
|
||||||
public void basicSmelt(TestContext context) {
|
public void basicSmelt(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.FURNACE);
|
context.setBlockState(POS, Blocks.FURNACE);
|
||||||
FurnaceBlockEntity blockEntity = (FurnaceBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
FurnaceBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 8), new ItemStack(Items.COAL, 2));
|
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 8), new ItemStack(Items.COAL, 2));
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ public class FurnaceGameTest implements FabricGameTest {
|
||||||
@GameTest(templateName = EMPTY_STRUCTURE)
|
@GameTest(templateName = EMPTY_STRUCTURE)
|
||||||
public void vanillaRemainderTest(TestContext context) {
|
public void vanillaRemainderTest(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.FURNACE);
|
context.setBlockState(POS, Blocks.FURNACE);
|
||||||
FurnaceBlockEntity blockEntity = (FurnaceBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
FurnaceBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 64), new ItemStack(Items.LAVA_BUCKET));
|
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 64), new ItemStack(Items.LAVA_BUCKET));
|
||||||
|
|
||||||
|
@ -75,7 +73,7 @@ public class FurnaceGameTest implements FabricGameTest {
|
||||||
@GameTest(templateName = EMPTY_STRUCTURE)
|
@GameTest(templateName = EMPTY_STRUCTURE)
|
||||||
public void fabricRemainderTest(TestContext context) {
|
public void fabricRemainderTest(TestContext context) {
|
||||||
context.setBlockState(POS, Blocks.FURNACE);
|
context.setBlockState(POS, Blocks.FURNACE);
|
||||||
FurnaceBlockEntity blockEntity = (FurnaceBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));
|
FurnaceBlockEntity blockEntity = context.getBlockEntity(POS);
|
||||||
|
|
||||||
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 32), new ItemStack(CustomDamageTest.WEIRD_PICK));
|
setInputs(blockEntity, new ItemStack(Blocks.COBBLESTONE, 32), new ItemStack(CustomDamageTest.WEIRD_PICK));
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package net.fabricmc.fabric.mixin.event.lifecycle;
|
package net.fabricmc.fabric.mixin.event.lifecycle;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
@ -44,7 +45,7 @@ public abstract class ServerChunkLoadingManagerMixin {
|
||||||
* We inject just after "setLoadedToWorld" is made false, since here the WorldChunk is guaranteed to be unloaded.
|
* We inject just after "setLoadedToWorld" is made false, since here the WorldChunk is guaranteed to be unloaded.
|
||||||
*/
|
*/
|
||||||
@Inject(method = "method_60440", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/WorldChunk;setLoadedToWorld(Z)V", shift = At.Shift.AFTER))
|
@Inject(method = "method_60440", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/WorldChunk;setLoadedToWorld(Z)V", shift = At.Shift.AFTER))
|
||||||
private void onChunkUnload(ChunkHolder chunkHolder, long l, CallbackInfo ci) {
|
private void onChunkUnload(ChunkHolder chunkHolder, long l, CallbackInfo ci, @Local WorldChunk chunk) {
|
||||||
ServerChunkEvents.CHUNK_UNLOAD.invoker().onChunkUnload(this.world, (WorldChunk) chunkHolder.getLatest());
|
ServerChunkEvents.CHUNK_UNLOAD.invoker().onChunkUnload(this.world, chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||||
import net.fabricmc.fabric.test.networking.NetworkingTestmods;
|
import net.fabricmc.fabric.test.networking.NetworkingTestmods;
|
||||||
|
|
||||||
public class NetworkingCommonTest implements ModInitializer {
|
public class NetworkingCommonTest implements ModInitializer {
|
||||||
private List<String> recievedPlay = new ArrayList<>();
|
private List<String> receivedPlay = new ArrayList<>();
|
||||||
private List<String> recievedConfig = new ArrayList<>();
|
private List<String> receivedConfig = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
@ -52,8 +52,8 @@ public class NetworkingCommonTest implements ModInitializer {
|
||||||
ServerConfigurationConnectionEvents.CONFIGURE.register((handler, server) -> ServerConfigurationNetworking.send(handler, new CommonPayload("configuration")));
|
ServerConfigurationConnectionEvents.CONFIGURE.register((handler, server) -> ServerConfigurationNetworking.send(handler, new CommonPayload("configuration")));
|
||||||
|
|
||||||
// Store the player uuid once received from the client
|
// Store the player uuid once received from the client
|
||||||
ServerPlayNetworking.registerGlobalReceiver(CommonPayload.ID, (payload, context) -> recievedPlay.add(context.player().getUuidAsString()));
|
ServerPlayNetworking.registerGlobalReceiver(CommonPayload.ID, (payload, context) -> receivedPlay.add(context.player().getUuidAsString()));
|
||||||
ServerConfigurationNetworking.registerGlobalReceiver(CommonPayload.ID, (payload, context) -> recievedConfig.add(context.networkHandler().getDebugProfile().getId().toString()));
|
ServerConfigurationNetworking.registerGlobalReceiver(CommonPayload.ID, (payload, context) -> receivedConfig.add(context.networkHandler().getDebugProfile().getId().toString()));
|
||||||
|
|
||||||
// Ensure that the packets were received on the server
|
// Ensure that the packets were received on the server
|
||||||
ServerEntityEvents.ENTITY_LOAD.register((entity, world) -> {
|
ServerEntityEvents.ENTITY_LOAD.register((entity, world) -> {
|
||||||
|
@ -62,20 +62,20 @@ public class NetworkingCommonTest implements ModInitializer {
|
||||||
|
|
||||||
// Allow a few ticks for the packets to be received
|
// Allow a few ticks for the packets to be received
|
||||||
executeIn(world.getServer(), 50, () -> {
|
executeIn(world.getServer(), 50, () -> {
|
||||||
if (!recievedPlay.remove(uuid)) {
|
if (!receivedPlay.remove(uuid)) {
|
||||||
throw new IllegalStateException("Did not receive play response");
|
throw new IllegalStateException("Did not receive play response");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recievedConfig.remove(uuid)) {
|
if (!receivedConfig.remove(uuid)) {
|
||||||
throw new IllegalStateException("Did not receive configuration response");
|
throw new IllegalStateException("Did not receive configuration response");
|
||||||
}
|
}
|
||||||
});;
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// A payload registered on both sides, for play and configuration
|
// A payload registered on both sides, for play and configuration
|
||||||
// This tests that the server can send a packet to the client, and then recieve a response from the client
|
// This tests that the server can send a packet to the client, and then receive a response from the client
|
||||||
public record CommonPayload(String data) implements CustomPayload {
|
public record CommonPayload(String data) implements CustomPayload {
|
||||||
public static final CustomPayload.Id<CommonPayload> ID = new Id<>(NetworkingTestmods.id("common_payload"));
|
public static final CustomPayload.Id<CommonPayload> ID = new Id<>(NetworkingTestmods.id("common_payload"));
|
||||||
public static final PacketCodec<PacketByteBuf, CommonPayload> CODEC = PacketCodecs.STRING.xmap(CommonPayload::new, CommonPayload::data).cast();
|
public static final PacketCodec<PacketByteBuf, CommonPayload> CODEC = PacketCodecs.STRING.xmap(CommonPayload::new, CommonPayload::data).cast();
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ModResourcePackCreator implements ResourcePackProvider {
|
||||||
};
|
};
|
||||||
public static final ModResourcePackCreator CLIENT_RESOURCE_PACK_PROVIDER = new ModResourcePackCreator(ResourceType.CLIENT_RESOURCES);
|
public static final ModResourcePackCreator CLIENT_RESOURCE_PACK_PROVIDER = new ModResourcePackCreator(ResourceType.CLIENT_RESOURCES);
|
||||||
/**
|
/**
|
||||||
* The maximum ammount of known data packs requested from the client, including vanilla data packs.
|
* The maximum number of known data packs requested from the client, including vanilla data packs.
|
||||||
*/
|
*/
|
||||||
public static final int MAX_KNOWN_PACKS = Integer.getInteger("fabric-resource-loader-v0:maxKnownPacks", 1024);
|
public static final int MAX_KNOWN_PACKS = Integer.getInteger("fabric-resource-loader-v0:maxKnownPacks", 1024);
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ public final class ModResourcePackUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the ResousePackManager used by the ClientDataPackManager and replaces
|
* Creates the ResourcePackManager used by the ClientDataPackManager and replaces
|
||||||
* {@code VanillaDataPackProvider.createClientManager} used by vanilla.
|
* {@code VanillaDataPackProvider.createClientManager} used by vanilla.
|
||||||
*/
|
*/
|
||||||
public static ResourcePackManager createClientManager() {
|
public static ResourcePackManager createClientManager() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public abstract class SynchronizeRegistriesTaskMixin {
|
||||||
|
|
||||||
@Inject(method = "syncRegistryAndTags", at = @At("HEAD"))
|
@Inject(method = "syncRegistryAndTags", at = @At("HEAD"))
|
||||||
public void syncRegistryAndTags(Consumer<Packet<?>> sender, Set<VersionedIdentifier> commonKnownPacks, CallbackInfo ci) {
|
public void syncRegistryAndTags(Consumer<Packet<?>> sender, Set<VersionedIdentifier> commonKnownPacks, CallbackInfo ci) {
|
||||||
LOGGER.debug("Syncronizing registries with common known packs: {}", commonKnownPacks);
|
LOGGER.debug("Synchronizing registries with common known packs: {}", commonKnownPacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SynchronizeRegistriesTaskMixin {
|
||||||
|
|
||||||
@Inject(method = "syncRegistryAndTags", at = @At("HEAD"))
|
@Inject(method = "syncRegistryAndTags", at = @At("HEAD"))
|
||||||
public void syncRegistryAndTags(Consumer<Packet<?>> sender, Set<VersionedIdentifier> commonKnownPacks, CallbackInfo ci) {
|
public void syncRegistryAndTags(Consumer<Packet<?>> sender, Set<VersionedIdentifier> commonKnownPacks, CallbackInfo ci) {
|
||||||
BuiltinResourcePackTestMod.LOGGER.info("Syncronizing registries with common known packs: {}", commonKnownPacks);
|
BuiltinResourcePackTestMod.LOGGER.info("Synchronizing registries with common known packs: {}", commonKnownPacks);
|
||||||
|
|
||||||
if (!commonKnownPacks.containsAll(this.knownPacks)) {
|
if (!commonKnownPacks.containsAll(this.knownPacks)) {
|
||||||
BuiltinResourcePackTestMod.LOGGER.error("(Ignore when not local client) Not all server mod data packs known to client. Missing: {}", this.knownPacks.stream().filter(knownPack -> !commonKnownPacks.contains(knownPack)).toList());
|
BuiltinResourcePackTestMod.LOGGER.error("(Ignore when not local client) Not all server mod data packs known to client. Missing: {}", this.knownPacks.stream().filter(knownPack -> !commonKnownPacks.contains(knownPack)).toList());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class VanillaStorageTests {
|
||||||
public void testFurnaceCookTime(TestContext context) {
|
public void testFurnaceCookTime(TestContext context) {
|
||||||
BlockPos pos = new BlockPos(0, 1, 0);
|
BlockPos pos = new BlockPos(0, 1, 0);
|
||||||
context.setBlockState(pos, Blocks.FURNACE.getDefaultState());
|
context.setBlockState(pos, Blocks.FURNACE.getDefaultState());
|
||||||
FurnaceBlockEntity furnace = (FurnaceBlockEntity) context.getBlockEntity(pos);
|
FurnaceBlockEntity furnace = context.getBlockEntity(pos);
|
||||||
AbstractFurnaceBlockEntityAccessor accessor = (AbstractFurnaceBlockEntityAccessor) furnace;
|
AbstractFurnaceBlockEntityAccessor accessor = (AbstractFurnaceBlockEntityAccessor) furnace;
|
||||||
|
|
||||||
ItemVariant rawIron = ItemVariant.of(Items.RAW_IRON);
|
ItemVariant rawIron = ItemVariant.of(Items.RAW_IRON);
|
||||||
|
@ -109,7 +109,7 @@ public class VanillaStorageTests {
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(0, 2, 0);
|
BlockPos pos = new BlockPos(0, 2, 0);
|
||||||
context.setBlockState(pos, block.getDefaultState());
|
context.setBlockState(pos, block.getDefaultState());
|
||||||
Inventory inventory = (Inventory) context.getBlockEntity(pos);
|
Inventory inventory = context.getBlockEntity(pos);
|
||||||
InventoryStorage storage = InventoryStorage.of(inventory, null);
|
InventoryStorage storage = InventoryStorage.of(inventory, null);
|
||||||
|
|
||||||
BlockPos comparatorPos = new BlockPos(1, 2, 0);
|
BlockPos comparatorPos = new BlockPos(1, 2, 0);
|
||||||
|
@ -166,7 +166,7 @@ public class VanillaStorageTests {
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(0, 1, 0);
|
BlockPos pos = new BlockPos(0, 1, 0);
|
||||||
context.setBlockState(pos, Blocks.CHISELED_BOOKSHELF.getDefaultState());
|
context.setBlockState(pos, Blocks.CHISELED_BOOKSHELF.getDefaultState());
|
||||||
ChiseledBookshelfBlockEntity bookshelf = (ChiseledBookshelfBlockEntity) context.getBlockEntity(pos);
|
ChiseledBookshelfBlockEntity bookshelf = context.getBlockEntity(pos);
|
||||||
InventoryStorage storage = InventoryStorage.of(bookshelf, null);
|
InventoryStorage storage = InventoryStorage.of(bookshelf, null);
|
||||||
|
|
||||||
// First, check that we can correctly undo insert operations, because vanilla's setStack doesn't permit it without our patches.
|
// First, check that we can correctly undo insert operations, because vanilla's setStack doesn't permit it without our patches.
|
||||||
|
@ -227,7 +227,7 @@ public class VanillaStorageTests {
|
||||||
public void testShulkerNoInsert(TestContext context) {
|
public void testShulkerNoInsert(TestContext context) {
|
||||||
BlockPos pos = new BlockPos(0, 2, 0);
|
BlockPos pos = new BlockPos(0, 2, 0);
|
||||||
context.setBlockState(pos, Blocks.SHULKER_BOX);
|
context.setBlockState(pos, Blocks.SHULKER_BOX);
|
||||||
ShulkerBoxBlockEntity shulker = (ShulkerBoxBlockEntity) context.getBlockEntity(pos);
|
ShulkerBoxBlockEntity shulker = context.getBlockEntity(pos);
|
||||||
InventoryStorage storage = InventoryStorage.of(shulker, null);
|
InventoryStorage storage = InventoryStorage.of(shulker, null);
|
||||||
|
|
||||||
if (StorageUtil.simulateInsert(storage, ItemVariant.of(Items.SHULKER_BOX), 1, null) > 0) {
|
if (StorageUtil.simulateInsert(storage, ItemVariant.of(Items.SHULKER_BOX), 1, null) > 0) {
|
||||||
|
@ -246,7 +246,7 @@ public class VanillaStorageTests {
|
||||||
public void testBadFurnaceIsValid(TestContext context) {
|
public void testBadFurnaceIsValid(TestContext context) {
|
||||||
BlockPos pos = new BlockPos(0, 1, 0);
|
BlockPos pos = new BlockPos(0, 1, 0);
|
||||||
context.setBlockState(pos, Blocks.FURNACE.getDefaultState());
|
context.setBlockState(pos, Blocks.FURNACE.getDefaultState());
|
||||||
FurnaceBlockEntity furnace = (FurnaceBlockEntity) context.getBlockEntity(pos);
|
FurnaceBlockEntity furnace = context.getBlockEntity(pos);
|
||||||
InventoryStorage furnaceWrapper = InventoryStorage.of(furnace, null);
|
InventoryStorage furnaceWrapper = InventoryStorage.of(furnace, null);
|
||||||
|
|
||||||
try (Transaction tx = Transaction.openOuter()) {
|
try (Transaction tx = Transaction.openOuter()) {
|
||||||
|
@ -265,7 +265,7 @@ public class VanillaStorageTests {
|
||||||
public void testBadBrewingStandIsValid(TestContext context) {
|
public void testBadBrewingStandIsValid(TestContext context) {
|
||||||
BlockPos pos = new BlockPos(0, 1, 0);
|
BlockPos pos = new BlockPos(0, 1, 0);
|
||||||
context.setBlockState(pos, Blocks.BREWING_STAND.getDefaultState());
|
context.setBlockState(pos, Blocks.BREWING_STAND.getDefaultState());
|
||||||
BrewingStandBlockEntity brewingStand = (BrewingStandBlockEntity) context.getBlockEntity(pos);
|
BrewingStandBlockEntity brewingStand = context.getBlockEntity(pos);
|
||||||
InventoryStorage brewingStandWrapper = InventoryStorage.of(brewingStand, null);
|
InventoryStorage brewingStandWrapper = InventoryStorage.of(brewingStand, null);
|
||||||
|
|
||||||
try (Transaction tx = Transaction.openOuter()) {
|
try (Transaction tx = Transaction.openOuter()) {
|
||||||
|
|
Loading…
Reference in a new issue