Skip to content

Commit

Permalink
24w36a (#4068)
Browse files Browse the repository at this point in the history
* 24w36a

* Some fixes

* More work

* Fixes

* Update yarn

* Update fabric loader

* Bump versions
  • Loading branch information
modmuss50 committed Sep 5, 2024
1 parent 2ade441 commit d48ec15
Show file tree
Hide file tree
Showing 127 changed files with 492 additions and 942 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"fabric-command-api-v2": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"fabric-command-api-v2": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.18.2"
},
"description": "Contains common tags used by mods for vanilla things.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-key-binding-api-v1": "*"
},
"description": "Keybinding registry API.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"fabric-resource-loader-v0": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-block-view-api-v2": "*"
},
"description": "Thread-safe hooks for block entity data use during terrain rendering.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*",
"fabric-rendering-v1": "*"
Expand Down
2 changes: 1 addition & 1 deletion fabric-api-base/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"description": "Contains the essentials for Fabric API modules.",
"custom": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"fabric-lifecycle-events-v1": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public class FabricApiLookupTest implements ModInitializer {
// It's meant to work with unsided containers: chests, dispensers, droppers and hoppers.
public static final RegistryKey<Block> CHUTE_BLOCK_KEY = keyOf("chute");
public static final ChuteBlock CHUTE_BLOCK = new ChuteBlock(AbstractBlock.Settings.create().registryKey(CHUTE_BLOCK_KEY));
public static final BlockItem CHUTE_ITEM = new BlockItem(CHUTE_BLOCK, new Item.Settings());
public static final BlockItem CHUTE_ITEM = new BlockItem(CHUTE_BLOCK, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, CHUTE_BLOCK_KEY.getValue())));
public static BlockEntityType<ChuteBlockEntity> CHUTE_BLOCK_ENTITY_TYPE;
// Cobble gen - Block without model that can generate infinite cobblestone when placed above a chute.
// It's meant to test BlockApiLookup#registerSelf.
public static final RegistryKey<Block> COBBLE_GEN_BLOCK_KEY = keyOf("cobble_gen");
public static final CobbleGenBlock COBBLE_GEN_BLOCK = new CobbleGenBlock(AbstractBlock.Settings.create().registryKey(COBBLE_GEN_BLOCK_KEY));
public static final BlockItem COBBLE_GEN_ITEM = new BlockItem(COBBLE_GEN_BLOCK, new Item.Settings());
public static final BlockItem COBBLE_GEN_ITEM = new BlockItem(COBBLE_GEN_BLOCK, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, COBBLE_GEN_BLOCK_KEY.getValue())));
public static BlockEntityType<CobbleGenBlockEntity> COBBLE_GEN_BLOCK_ENTITY_TYPE;
// Testing for item api lookups is done in the `item` package.

public static final RegistryKey<Block> INSPECTOR_BLOCK_KEY = keyOf("inspector");
public static final InspectorBlock INSPECTOR_BLOCK = new InspectorBlock(AbstractBlock.Settings.create().registryKey(INSPECTOR_BLOCK_KEY));
public static final BlockItem INSPECTOR_ITEM = new BlockItem(INSPECTOR_BLOCK, new Item.Settings());
public static final BlockItem INSPECTOR_ITEM = new BlockItem(INSPECTOR_BLOCK, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, INSPECTOR_BLOCK_KEY.getValue())));

private static RegistryKey<Block> keyOf(String id) {
return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(MOD_ID, id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
import static net.fabricmc.fabric.test.lookup.FabricApiLookupTest.ensureException;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

Expand All @@ -33,10 +36,11 @@ public class FabricItemApiLookupTest {
public static final ItemApiLookup<Inspectable, Void> INSPECTABLE =
ItemApiLookup.get(Identifier.of("testmod", "inspectable"), Inspectable.class, Void.class);

public static final InspectableItem HELLO_ITEM = new InspectableItem("Hello Fabric API tester!");
public static final RegistryKey<Item> HELLO_ITEM_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(FabricApiLookupTest.MOD_ID, "hello"));
public static final InspectableItem HELLO_ITEM = new InspectableItem("Hello Fabric API tester!", new Item.Settings().registryKey(HELLO_ITEM_KEY));

public static void onInitialize() {
Registry.register(Registries.ITEM, Identifier.of(FabricApiLookupTest.MOD_ID, "hello"), HELLO_ITEM);
Registry.register(Registries.ITEM, HELLO_ITEM_KEY, HELLO_ITEM);

// Diamonds and diamond blocks can be inspected and will also print their name.
INSPECTABLE.registerForItems((stack, ignored) -> () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
public class InspectableItem extends Item implements Inspectable {
private final String inspectionResult;

public InspectableItem(String inspectionResult) {
super(new Settings());
public InspectableItem(String inspectionResult, Item.Settings settings) {
super(settings);
this.inspectionResult = inspectionResult;
}

Expand Down
2 changes: 1 addition & 1 deletion fabric-biome-api-v1/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.16.2"
},
"description": "Hooks for adding biomes to the default world generator.",
Expand Down
2 changes: 1 addition & 1 deletion fabric-block-api-v1/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"entrypoints": {
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"description": "Hooks for block views",
"mixins": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.15-alpha.19.38.b",
"fabric-api-base": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"description": "Adds the ability to load tags from the local mods.",
"custom": {
Expand Down
2 changes: 1 addition & 1 deletion fabric-command-api-v2/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"minecraft": ">1.19-alpha.22.11.a"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-api-base": "*",
"fabric-lifecycle-events-v1": "*",
"fabric-resource-loader-v0": "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ public void onInitialize() {
LOGGER.info("SculkSensorFrequencyRegistry test passed!");
}

var dirtyPotion = new DirtyPotionItem(new Item.Settings().maxCount(1));
Registry.register(Registries.ITEM, Identifier.of("fabric-content-registries-v0-testmod", "dirty_potion"),
dirtyPotion);
RegistryKey<Item> dirtyPotionKey = RegistryKey.of(RegistryKeys.ITEM, Identifier.of("fabric-content-registries-v0-testmod", "dirty_potion"));
var dirtyPotion = new DirtyPotionItem(new Item.Settings().maxCount(1).registryKey(dirtyPotionKey));
Registry.register(Registries.ITEM, dirtyPotionKey, dirtyPotion);
/* Mods should use BrewingRecipeRegistry.registerPotionType(Item), which is access widened by fabric-transitive-access-wideners-v1
* This testmod uses an accessor due to Loom limitations that prevent TAWs from applying across Gradle subproject boundaries */
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.18.2"
},
"description": "Contains common tags used by mods for vanilla things.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.20.5-beta.1",
"fabric-lifecycle-events-v1": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"description": "Adds Fabric-related debug info to crash reports.",
"mixins": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"fabric-entity-events-v1": "*",
"fabric-object-builder-api-v1": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@

package net.fabricmc.fabric.test.attachment.gametest;

import java.util.List;
import java.util.Objects;
import java.util.function.IntSupplier;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.DrownedEntity;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.test.GameTest;
import net.minecraft.test.GameTestException;
import net.minecraft.test.TestContext;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.TeleportTarget;
import net.minecraft.world.World;

import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.fabricmc.fabric.test.attachment.AttachmentTestMod;
import net.fabricmc.fabric.test.attachment.mixin.ZombieEntityAccessor;

public class AttachmentCopyTests implements FabricGameTest {
// using a lambda type because serialization shouldn't play a role in this
Expand Down Expand Up @@ -74,10 +78,19 @@ public void testCrossWorldTeleport(TestContext context) {

@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testMobConversion(TestContext context) {
MobEntity mob = Objects.requireNonNull(EntityType.ZOMBIE.create(context.getWorld(), SpawnReason.SPAWN_EGG));
ZombieEntity mob = context.spawnEntity(EntityType.ZOMBIE, BlockPos.ORIGIN);
mob.setAttached(DUMMY, () -> 42);
mob.setAttached(COPY_ON_DEATH, () -> 42);
MobEntity converted = mob.convertTo(EntityType.DROWNED, false);

ZombieEntityAccessor zombieEntityAccessor = (ZombieEntityAccessor) mob;
zombieEntityAccessor.invokeConvertTo(EntityType.DROWNED);
List<DrownedEntity> drowned = context.getEntities(EntityType.DROWNED);

if (drowned.size() != 1) {
throw new GameTestException("Conversion failed");
}

DrownedEntity converted = drowned.getFirst();
if (converted == null) throw new GameTestException("Conversion failed");

if (converted.hasAttached(DUMMY)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
* limitations under the License.
*/

package net.fabricmc.fabric.test.entity.event;
package net.fabricmc.fabric.test.attachment.mixin;

import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterials;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.mob.ZombieEntity;

public class DiamondElytraItem extends ArmorItem implements FabricElytraItem {
public DiamondElytraItem() {
super(ArmorMaterials.DIAMOND, Type.CHESTPLATE, new Settings().maxCount(1).maxDamage(100));
}
@Mixin(ZombieEntity.class)
public interface ZombieEntityAccessor {
@Invoker("convertTo")
void invokeConvertTo(EntityType<? extends ZombieEntity> entityType);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"package": "net.fabricmc.fabric.test.attachment.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"BlockEntityTypeAccessor"
"BlockEntityTypeAccessor",
"ZombieEntityAccessor"
],
"injectors": {
"defaultRequire": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ transitive-accessible method net/minecraft/data/client/ItemModelGenerator regist
transitive-accessible method net/minecraft/data/client/ItemModelGenerator uploadArmor (Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator uploadArmor (Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator suffixTrim (Lnet/minecraft/util/Identifier;Ljava/lang/String;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator createArmorJson (Lnet/minecraft/util/Identifier;Ljava/util/Map;Lnet/minecraft/registry/entry/RegistryEntry;)Lcom/google/gson/JsonObject;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator registerArmor (Lnet/minecraft/item/ArmorItem;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator createArmorJson (Lnet/minecraft/util/Identifier;Ljava/util/Map;Lnet/minecraft/util/Identifier;)Lcom/google/gson/JsonObject;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator registerArmor (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;Lnet/minecraft/item/equipment/EquipmentModel;Lnet/minecraft/entity/EquipmentSlot;)V
transitive-extendable method net/minecraft/data/MetadataProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/SnbtProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/client/ModelProvider getName ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3"
"fabricloader": ">=0.16.4"
},
"description": "Allows for automatic data generation.",
"mixins": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static Block createBlock(String name, boolean hasItem, AbstractBlock.Set
Block block = Registry.register(Registries.BLOCK, identifier, new Block(settings.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier))));

if (hasItem) {
Registry.register(Registries.ITEM, identifier, new BlockItem(block, new Item.Settings()));
Registry.register(Registries.ITEM, identifier, new BlockItem(block, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))));
}

return block;
Expand Down
2 changes: 1 addition & 1 deletion fabric-dimensions-v1/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.16.3",
"fabricloader": ">=0.16.4",
"minecraft": ">=1.16-rc.3",
"fabric-api-base": "*"
},
Expand Down
Loading

0 comments on commit d48ec15

Please sign in to comment.