From 045efb468251a11b32326cd33d9aa15c8817aa3f Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 3 May 2020 17:56:50 +0100 Subject: [PATCH] Restart Testmods (#593) --- build.gradle | 18 +++ checkstyle.xml | 2 +- .../fabric/test/item/group/ItemGroupTest.java | 41 ++++++ .../src/testmod/resources/fabric.mod.json | 16 +++ .../net/fabricmc/fabric/block/FireMod.java | 29 ---- .../fabric/colormapper/ColorProviderMod.java | 48 ------- .../fabricmc/fabric/commands/CommandMod.java | 44 ------- .../fabric/containers/ContainerMod.java | 106 --------------- .../fabric/containers/ContainerModClient.java | 95 -------------- .../events/PickBlockEventModClient.java | 55 -------- .../fabric/events/ServerEventMod.java | 33 ----- .../fluidrender/FluidRendererModClient.java | 46 ------- .../net/fabricmc/fabric/item/FuelMod.java | 30 ----- .../fabric/itemgroup/ItemGroupMod.java | 65 --------- .../keybinding/KeyBindingModClient.java | 38 ------ .../fabricmc/fabric/loot/LootEntryMod.java | 60 --------- .../fabricmc/fabric/loot/LootTableMod.java | 50 ------- .../fabricmc/fabric/model/ModelModClient.java | 124 ------------------ .../fabric/particle/ParticleModClient.java | 90 ------------- .../resources/ResourceReloadModClient.java | 80 ----------- .../assets/testmod/particles/custom.json | 12 -- .../assets/testmod/particles/simple.json | 1 - .../minecraft/loot_tables/blocks/stone.json | 44 ------- fabric-testmods/resources/mod.json | 15 --- 24 files changed, 76 insertions(+), 1066 deletions(-) create mode 100644 fabric-item-groups-v0/src/testmod/java/net/fabricmc/fabric/test/item/group/ItemGroupTest.java create mode 100644 fabric-item-groups-v0/src/testmod/resources/fabric.mod.json delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/fluidrender/FluidRendererModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/loot/LootTableMod.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/particle/ParticleModClient.java delete mode 100644 fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java delete mode 100644 fabric-testmods/resources/assets/testmod/particles/custom.json delete mode 100644 fabric-testmods/resources/assets/testmod/particles/simple.json delete mode 100644 fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json delete mode 100644 fabric-testmods/resources/mod.json diff --git a/build.gradle b/build.gradle index a7438deab..bc8d7d2a0 100644 --- a/build.gradle +++ b/build.gradle @@ -57,6 +57,13 @@ allprojects { group = "net.fabricmc.fabric-api" + sourceSets { + testmod { + compileClasspath += main.compileClasspath + runtimeClasspath += main.runtimeClasspath + } + } + dependencies { minecraft "com.mojang:minecraft:$Globals.mcVersion" mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2" @@ -149,6 +156,11 @@ task javadocJar(type: Jar) { build.dependsOn javadocJar subprojects { + + dependencies { + testmodCompile sourceSets.main.output + } + task remapMavenJar(type: Copy, dependsOn: remapJar) { afterEvaluate { from("${project.buildDir}/libs/$archivesBaseName-${version}.jar") @@ -228,11 +240,17 @@ task licenseFormatAll subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") } subprojects.each { remapJar.dependsOn("${it.path}:remapJar") } +sourceSets { + testmod +} + dependencies { afterEvaluate { subprojects.each { compile project(path: ":${it.name}", configuration: "dev") include project("${it.name}:") + + testmodCompile project("${it.name}:").sourceSets.testmod.output } } } diff --git a/checkstyle.xml b/checkstyle.xml index 179b92927..c2dd7d56b 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -187,7 +187,7 @@ - largely unconstained trailing subpackages --> + value="^net\.fabricmc\.fabric\.(api(?!\.common\.)(\.client|\.server|)(\.(?!client\.|server\.)[a-z]+[a-rt-z])+\.v[1-9][0-9]*|(impl|mixin|test)(?!\.common\.)(\.client|\.server|)(\.(?!client\.|server\.)[a-z]+[a-rt-z])+|api\.(event|util|biomes\.v1|registry|client\.screen|container|block|entity|client\.itemgroup|client\.keybinding|tag|tools|client\.model|network|server|client\.render|resource|client\.texture))(|\.[a-z]+(\.[a-z0-9]+)*)$"/> diff --git a/fabric-item-groups-v0/src/testmod/java/net/fabricmc/fabric/test/item/group/ItemGroupTest.java b/fabric-item-groups-v0/src/testmod/java/net/fabricmc/fabric/test/item/group/ItemGroupTest.java new file mode 100644 index 000000000..a8c6cdbc5 --- /dev/null +++ b/fabric-item-groups-v0/src/testmod/java/net/fabricmc/fabric/test/item/group/ItemGroupTest.java @@ -0,0 +1,41 @@ +/* + * 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.test.item.group; + +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; + +public class ItemGroupTest implements ModInitializer { + //Adds an item group with all items in it + private static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.create(new Identifier("fabric-item-groups-v0-testmod", "test_group")) + .icon(() -> new ItemStack(Items.DIAMOND)) + .appendItems(stacks -> + Registry.ITEM.stream() + .map(ItemStack::new) + .forEach(stacks::add) + ).build(); + + @Override + public void onInitialize() { + } +} diff --git a/fabric-item-groups-v0/src/testmod/resources/fabric.mod.json b/fabric-item-groups-v0/src/testmod/resources/fabric.mod.json new file mode 100644 index 000000000..8485d086e --- /dev/null +++ b/fabric-item-groups-v0/src/testmod/resources/fabric.mod.json @@ -0,0 +1,16 @@ +{ + "schemaVersion": 1, + "id": "fabric-item-groups-v0-testmod", + "name": "Fabric Item Groups (v0) Test Mod", + "version": "1.0.0", + "environment": "*", + "license": "Apache-2.0", + "depends": { + "fabric-item-groups-v0": "*" + }, + "entrypoints": { + "main": [ + "net.fabricmc.fabric.test.item.group.ItemGroupTest" + ] + } +} diff --git a/fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java b/fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java deleted file mode 100644 index c41acd010..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/block/FireMod.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.block; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.minecraft.block.Blocks; - -public class FireMod implements ModInitializer { - @Override - public void onInitialize() { - FlammableBlockRegistry.getDefaultInstance().add(Blocks.STONE, 100, 100); - FlammableBlockRegistry.getDefaultInstance().remove(Blocks.OAK_PLANKS); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java b/fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java deleted file mode 100644 index 12fc7008a..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/colormapper/ColorProviderMod.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.colormapper; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.render.ColorProviderRegistry; -import net.minecraft.block.Blocks; -import net.minecraft.client.render.block.BlockColorMapper; -import net.minecraft.item.Items; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class ColorProviderMod implements ClientModInitializer { - private static final boolean ENABLED = true; - - private static final Logger LOGGER = LogManager.getLogger(); - - @Override - public void onInitializeClient() { - if (!ENABLED) return; - LOGGER.info("Initialising ColorProviderMod"); - - // Redstone is now the same color as grass - ColorProviderRegistry.BLOCK.register((block, world, pos, layer) -> { - BlockColorMapper provider = ColorProviderRegistry.BLOCK.get(Blocks.GRASS); - return provider == null ? -1 : provider.getColor(block, world, pos, layer); - }, Blocks.REDSTONE_WIRE); - - // Make white dye glow red. - ColorProviderRegistry.ITEM.register((item, layer) -> - (int) (64 * (Math.sin(System.currentTimeMillis() / 5e2) + 3)) << 16, - Items.WHITE_DYE); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java b/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java deleted file mode 100644 index 732453d93..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.commands; - -import com.mojang.brigadier.Command; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.registry.CommandRegistry; -import net.minecraft.server.command.CommandManager; -import net.minecraft.text.StringTextComponent; - -public class CommandMod implements ModInitializer { - @Override - public void onInitialize() { - CommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register( - CommandManager.literal("fabric_test") - .executes(c -> { - c.getSource().sendFeedback(new StringTextComponent("Command works!"), false); - return Command.SINGLE_SUCCESS; - }) - )); - - CommandRegistry.INSTANCE.register(true, (dispatcher) -> dispatcher.register( - CommandManager.literal("fabric_test_dedicated") - .executes(c -> { - c.getSource().sendFeedback(new StringTextComponent("Command works!"), false); - return Command.SINGLE_SUCCESS; - }) - )); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java deleted file mode 100644 index 67d93b52d..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.containers; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.container.ContainerProviderRegistry; -import net.fabricmc.fabric.api.registry.CommandRegistry; -import net.minecraft.container.Container; -import net.minecraft.container.Slot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.server.command.CommandManager; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; - -public class ContainerMod implements ModInitializer { - - public static final Identifier EXAMPLE_CONTAINER = new Identifier("fabric_container", "example_container"); - public static final Identifier EXAMPLE_CONTAINER_2 = new Identifier("fabric_container", "example_container_2"); - public static final Identifier EXAMPLE_INVENTORY_CONTAINER = new Identifier("fabric_container", "example_inventory_container"); - - @Override - public void onInitialize() { - //Registers a basic server side command that shows that the openContainer works from the server side. - CommandRegistry.INSTANCE.register(false, serverCommandSourceCommandDispatcher -> - serverCommandSourceCommandDispatcher.register(CommandManager - .literal("container") - .executes(context -> { - BlockPos pos = new BlockPos(context.getSource().getEntity()); - - //Opens a container, sending the block pos - ContainerProviderRegistry.INSTANCE.openContainer(EXAMPLE_INVENTORY_CONTAINER, context.getSource().getPlayer(), buf -> buf.writeBlockPos(pos)); - - return 1; - }))); - - //Registers a container factory that opens our example Container, this reads the block pos from the buffer - ContainerProviderRegistry.INSTANCE.registerFactory(EXAMPLE_CONTAINER, (syncId, identifier, player, buf) -> { - BlockPos pos = buf.readBlockPos(); - return new ExampleContainer(syncId, pos, player); - }); - ContainerProviderRegistry.INSTANCE.registerFactory(EXAMPLE_CONTAINER_2, (syncId, identifier, player, buf) -> { - BlockPos pos = buf.readBlockPos(); - return new ExampleContainer(syncId, pos, player); - }); - ContainerProviderRegistry.INSTANCE.registerFactory(EXAMPLE_INVENTORY_CONTAINER, (syncId, identifier, player, buf) -> { - return new ExampleInventoryContainer(syncId, player); - }); - } - - //A basic container that prints to console when opened, this should print on the client + server - public static class ExampleContainer extends Container { - public final PlayerInventory playerInventory; - BlockPos pos; - - public ExampleContainer(int syncId, BlockPos pos, PlayerEntity playerEntity) { - super(null, syncId); - this.pos = pos; - this.playerInventory = playerEntity.inventory; - System.out.println("Opened container, " + pos); - } - - @Override - public boolean canUse(PlayerEntity playerEntity) { - return true; - } - } - - public static class ExampleInventoryContainer extends Container { - public final PlayerInventory playerInventory; - BlockPos pos; - - public ExampleInventoryContainer(int syncId, PlayerEntity playerEntity) { - super(null, syncId); - this.playerInventory = playerEntity.inventory; - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 9; ++j) { - this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (int j = 0; j < 9; ++j) { - this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142)); - } - } - - @Override - public boolean canUse(PlayerEntity playerEntity) { - return true; - } - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java deleted file mode 100644 index 8dccea4f0..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerModClient.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.containers; - -import com.mojang.blaze3d.platform.GlStateManager; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; -import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.text.StringTextComponent; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; - -public class ContainerModClient implements ClientModInitializer { - - @Override - public void onInitializeClient() { - //Registers a gui factory that opens our example gui, this reads the block pos from the buffer - ScreenProviderRegistry.INSTANCE.registerFactory(ContainerMod.EXAMPLE_CONTAINER, (syncId, identifier, player, buf) -> { - BlockPos pos = buf.readBlockPos(); - return new ExampleContainerScreen(syncId, pos, player); - }); - - //Registers a gui factory that opens our example gui, this uses the container created by ContainerProviderRegistry - ScreenProviderRegistry.INSTANCE.registerFactory(ContainerMod.EXAMPLE_CONTAINER_2, ExampleContainerScreen2::new); - - //Registers a gui factory that opens our example inventory gui - ScreenProviderRegistry.INSTANCE.registerFactory(ContainerMod.EXAMPLE_INVENTORY_CONTAINER, ExampleInventoryContainerScreen::new); - } - - //A container gui that shows the block pos that was sent - public static class ExampleContainerScreen extends ContainerScreen { - - BlockPos pos; - - public ExampleContainerScreen(int syncId, BlockPos pos, PlayerEntity playerEntity) { - super(new ContainerMod.ExampleContainer(syncId, pos, playerEntity), playerEntity.inventory, new StringTextComponent("Example GUI")); - this.pos = pos; - } - - @Override - protected void drawBackground(float v, int i, int i1) { - font.draw(pos.toString(), width / 2, height / 2, 0); - } - } - - - //A container gui that shows how you can take in a container provided by a ContainerScreenFactory - public static class ExampleContainerScreen2 extends ContainerScreen { - - BlockPos pos; - - public ExampleContainerScreen2(ContainerMod.ExampleContainer container) { - super(container, container.playerInventory, new StringTextComponent("Example GUI 2")); - this.pos = container.pos; - } - - @Override - protected void drawBackground(float v, int i, int i1) { - font.draw(pos.toString(), width / 2, height / 2, 0); - } - } - - //A container gui that has the player's inventory - public static class ExampleInventoryContainerScreen extends ContainerScreen { - - private static final Identifier BG_TEXTURE = new Identifier("textures/gui/container/horse.png"); - - public ExampleInventoryContainerScreen(ContainerMod.ExampleInventoryContainer container) { - super(container, container.playerInventory, new StringTextComponent("Example Inventory GUI")); - } - - @Override - protected void drawBackground(float v, int i, int i1) { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - minecraft.getTextureManager().bindTexture(BG_TEXTURE); - this.blit(left, top, 0, 0, width, height); - } - } - -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java b/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java deleted file mode 100644 index 9d4a0044b..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.events; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.event.client.player.ClientPickBlockApplyCallback; -import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; - -public class PickBlockEventModClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - ClientPickBlockGatherCallback.EVENT.register((player, result) -> { - if (result instanceof BlockHitResult) { - BlockView view = player.getEntityWorld(); - BlockPos pos = ((BlockHitResult) result).getBlockPos(); - BlockState state = view.getBlockState(pos); - - if (state.getBlock() == Blocks.STONE) { - return new ItemStack(Blocks.OAK_WOOD); - } - } - - return ItemStack.EMPTY; - }); - - ClientPickBlockApplyCallback.EVENT.register((player, result, stack) -> { - if (stack.getItem() == Item.getItemFromBlock(Blocks.OAK_WOOD)) { - return new ItemStack(Blocks.ACACIA_WOOD); - } else { - return stack; - } - }); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java b/fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java deleted file mode 100644 index c7ec708f0..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/events/ServerEventMod.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.events; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.server.ServerStartCallback; -import net.fabricmc.fabric.api.event.server.ServerStopCallback; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class ServerEventMod implements ModInitializer { - private static final Logger LOGGER = LogManager.getLogger(); - - @Override - public void onInitialize() { - ServerStartCallback.EVENT.register(server -> LOGGER.info("Server starting (" + server + ")")); - ServerStopCallback.EVENT.register(server -> LOGGER.info("Server stopping (" + server + ")")); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/fluidrender/FluidRendererModClient.java b/fabric-testmods/java/net/fabricmc/fabric/fluidrender/FluidRendererModClient.java deleted file mode 100644 index 98cba6df8..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/fluidrender/FluidRendererModClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.fluidrender; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.render.FluidRenderHandler; -import net.fabricmc.fabric.api.client.render.FluidRenderHandlerRegistry; -import net.fabricmc.fabric.api.resource.ResourceManagerHelper; -import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; -import net.minecraft.fluid.Fluids; -import net.minecraft.resource.ResourceManager; -import net.minecraft.resource.ResourceType; -import net.minecraft.util.Identifier; - -public class FluidRendererModClient implements ClientModInitializer, SimpleSynchronousResourceReloadListener { - @Override - public void onInitializeClient() { - ResourceManagerHelper.get(ResourceType.ASSETS).registerReloadListener(this); - } - - @Override - public Identifier getFabricId() { - return new Identifier("fabric:fluid_renderer_test"); - } - - @Override - public void apply(ResourceManager rm) { - FluidRenderHandler lavaHandler = FluidRenderHandlerRegistry.INSTANCE.get(Fluids.LAVA); - FluidRenderHandlerRegistry.INSTANCE.register(Fluids.WATER, lavaHandler); - FluidRenderHandlerRegistry.INSTANCE.register(Fluids.FLOWING_WATER, lavaHandler); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java b/fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java deleted file mode 100644 index d03da73ba..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/item/FuelMod.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.item; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.registry.FuelRegistry; -import net.minecraft.block.Blocks; -import net.minecraft.item.Items; - -public class FuelMod implements ModInitializer { - @Override - public void onInitialize() { - FuelRegistry.INSTANCE.add(Items.APPLE, 200); - FuelRegistry.INSTANCE.remove(Blocks.OAK_PLANKS); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java b/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java deleted file mode 100644 index 79682e56e..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.itemgroup; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - - -public class ItemGroupMod implements ModInitializer { - @Override - public void onInitialize() { - //This creates your standard Item Group - ItemGroup group = FabricItemGroupBuilder.build(new Identifier("fabric", "fabric_test_tab"), () -> new ItemStack(Items.IRON_CHESTPLATE)); - Item testItem = new Item(new Item.Settings().itemGroup(group)); - Registry.ITEM.add(new Identifier("fabric_test", "itemgroup"), testItem); - - //Creates a tab with all items (including ones that dont show in search such as the command block) - FabricItemGroupBuilder.create(new Identifier("fabric", "all")).appendItems(itemStacks -> Registry.ITEM.forEach(item -> itemStacks.add(new ItemStack(item)))).build(); - - //Creates a group with all modded items in - FabricItemGroupBuilder.create(new Identifier("fabric", "modded")).appendItems(itemStacks -> Registry.ITEM.forEach(item -> { - if (!Registry.ITEM.getId(item).getNamespace().equals("minecraft")) { - itemStacks.add(new ItemStack(item)); - } - })).icon(() -> new ItemStack(Blocks.TNT)).build(); - - - //These are just padding to ensure more than one page works - FabricItemGroupBuilder.create(new Identifier("fabric", "test1")).icon(() -> new ItemStack(Items.APPLE)).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test2")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test3")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test4")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test5")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test6")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test7")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test8")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test9")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test10")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test11")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test12")).build(); - FabricItemGroupBuilder.create(new Identifier("fabric", "test13")).build(); - - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java b/fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java deleted file mode 100644 index 09d65a8db..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/keybinding/KeyBindingModClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.keybinding; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; -import net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry; -import net.minecraft.client.util.InputUtil; -import net.minecraft.util.Identifier; - -public class KeyBindingModClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - KeyBindingRegistry.INSTANCE.addCategory("fabric.test"); - KeyBindingRegistry.INSTANCE.register( - FabricKeyBinding.Builder.create( - new Identifier("fabric:test"), - InputUtil.Type.KEYSYM, - 37, - "fabric.test" - ).build() - ); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java b/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java deleted file mode 100644 index 256df91d2..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.loot; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.registry.LootEntryTypeRegistry; -import net.minecraft.util.Identifier; -import net.minecraft.util.JsonHelper; -import net.minecraft.world.loot.condition.LootCondition; -import net.minecraft.world.loot.entry.LootEntry; -import net.minecraft.world.loot.entry.TagEntry; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class LootEntryMod implements ModInitializer { - private static final Logger LOGGER = LogManager.getLogger(); - - @Override - public void onInitialize() { - LootEntryTypeRegistry.INSTANCE.register(new TestSerializer()); - } - - private static class TestSerializer extends LootEntry.Serializer { - private static final TagEntry.Serializer SERIALIZER = new TagEntry.Serializer(); - - public TestSerializer() { - super(new Identifier("fabric", "extended_tag"), TagEntry.class); - } - - @Override - public void toJson(JsonObject obj, TagEntry entry, JsonSerializationContext context) { - SERIALIZER.method_451(obj, entry, context); - obj.addProperty("fabric", true); - } - - @Override - public TagEntry fromJson(JsonObject var1, JsonDeserializationContext var2, LootCondition[] var3) { - LOGGER.info("Is this a Fabric loot entry? " + JsonHelper.getBoolean(var1, "fabric", true)); - return SERIALIZER.fromJson(var1, var2, var3); - } - } -} - diff --git a/fabric-testmods/java/net/fabricmc/fabric/loot/LootTableMod.java b/fabric-testmods/java/net/fabricmc/fabric/loot/LootTableMod.java deleted file mode 100644 index 9646c059d..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/loot/LootTableMod.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.loot; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.loot.LootTableLoadingCallback; -import net.fabricmc.fabric.api.loot.FabricLootPoolBuilder; -import net.fabricmc.fabric.api.loot.LootUtilities; -import net.minecraft.item.Items; -import net.minecraft.world.loot.ConstantLootTableRange; -import net.minecraft.world.loot.LootPool; -import net.minecraft.world.loot.condition.SurvivesExplosionLootCondition; -import net.minecraft.world.loot.entry.ItemEntry; -import net.minecraft.world.loot.entry.LootEntry; - -public class LootTableMod implements ModInitializer { - private static final String LOOT_ENTRY_JSON = "{\"type\":\"minecraft:item\",\"name\":\"minecraft:apple\"}"; - - @Override - public void onInitialize() { - LootTableLoadingCallback.EVENT.register((manager, id, supplier) -> { - if ("minecraft:blocks/dirt".equals(id.toString())) { - LootEntry entryFromString = LootUtilities.readEntryFromJson(LOOT_ENTRY_JSON); - - LootPool pool = FabricLootPoolBuilder.builder() - .withEntry(ItemEntry.builder(Items.FEATHER)) - .withEntry(entryFromString) - .withRolls(ConstantLootTableRange.create(1)) - .withCondition(SurvivesExplosionLootCondition.method_871()) - .build(); - - supplier.withPool(pool); - } - }); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java b/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java deleted file mode 100644 index 26cbe127e..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.model; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; -import net.fabricmc.fabric.api.event.client.ClientTickCallback; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList; -import net.minecraft.client.render.model.json.ModelTransformation; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.util.ModelIdentifier; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; - -import java.util.function.Function; - -public class ModelModClient implements ClientModInitializer { - private static BakedModel bakedModel; - - @Override - public void onInitializeClient() { - ModelLoadingRegistry.INSTANCE.registerAppender((manager, out) -> { - System.out.println("--- ModelAppender called! ---"); - out.accept(new ModelIdentifier("fabric:model#custom")); - }); - - ModelLoadingRegistry.INSTANCE.registerVariantProvider(manager -> ((modelId, context) -> { - if (modelId.getVariant().equals("custom") && modelId.getNamespace().equals("fabric")) { - System.out.println("--- ModelVariantProvider called! ---"); - return context.loadModel(new Identifier("fabric:custom")); - } else { - return null; - } - })); - - ModelLoadingRegistry.INSTANCE.registerResourceProvider(manager -> ((id, context) -> { - if (id.toString().equals("fabric:custom")) { - return context.loadModel(new Identifier("fabric:custom2")); - } else if (id.toString().equals("fabric:custom2")) { - System.out.println("--- ModelResourceProvider called! ---"); - return new UnbakedModel() { - @Override - public Collection getModelDependencies() { - return Collections.emptyList(); - } - - @Override - public Collection getTextureDependencies(Function var1, Set var2) { - return Collections.emptyList(); - } - - @Override - public BakedModel bake(ModelLoader var1, Function var2, ModelBakeSettings var3) { - System.out.println("--- Model baked! ---"); - - return bakedModel = new BakedModel() { - @Override - public List getQuads(BlockState var1, Direction var2, Random var3) { - return Collections.emptyList(); - } - - @Override - public boolean useAmbientOcclusion() { - return false; - } - - @Override - public boolean hasDepthInGui() { - return false; - } - - @Override - public boolean isBuiltin() { - return false; - } - - @Override - public Sprite getSprite() { - return MinecraftClient.getInstance().getSpriteAtlas().getSprite("missingno"); - } - - @Override - public ModelTransformation getTransformation() { - return ModelTransformation.NONE; - } - - @Override - public ModelItemPropertyOverrideList getItemPropertyOverrides() { - return ModelItemPropertyOverrideList.EMPTY; - } - }; - } - }; - } else { - return null; - } - })); - - ClientTickCallback.EVENT.register((client) -> { - if (client.getBakedModelManager().getModel(new ModelIdentifier("fabric:model#custom")) - == bakedModel && bakedModel != null) { - System.out.println("--- MODEL LOADED! ---"); - } else { - System.out.println("--- MODEL NOT LOADED! ---"); - } - }); - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/particle/ParticleModClient.java b/fabric-testmods/java/net/fabricmc/fabric/particle/ParticleModClient.java deleted file mode 100644 index 06b0aee86..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/particle/ParticleModClient.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.particle; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.client.particle.v1.FabricSpriteProvider; -import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; -import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; -import net.minecraft.block.Blocks; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.particle.AnimatedParticle; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.particle.ParticleFactory; -import net.minecraft.client.particle.ParticleTextureSheet; -import net.minecraft.client.particle.SpriteBillboardParticle; -import net.minecraft.client.particle.SpriteProvider; -import net.minecraft.particle.DefaultParticleType; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.World; - -public class ParticleModClient implements ClientModInitializer, ModInitializer { - public static final DefaultParticleType SIMPLE_TEST_PARTICLE = FabricParticleTypes.simple(); - public static final DefaultParticleType CUSTOM_TEST_PARTICLE = FabricParticleTypes.simple(); - - @Override - public void onInitialize() { - Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "simple"), SIMPLE_TEST_PARTICLE); - Registry.register(Registry.PARTICLE_TYPE, new Identifier("testmod", "custom"), CUSTOM_TEST_PARTICLE); - } - - @Override - public void onInitializeClient() { - ParticleFactoryRegistry.getInstance().register(SIMPLE_TEST_PARTICLE, SimpleTestParticle::new); - ParticleFactoryRegistry.getInstance().register(CUSTOM_TEST_PARTICLE, CustomTestParticle.Factory::new); - } - - @Environment(EnvType.CLIENT) - static class SimpleTestParticle extends SpriteBillboardParticle { - public SimpleTestParticle(ParticleEffect effect, World world, double x, double y, double z, double velX, double velY, double velZ) { - super(world, x, y, z, velX, velY, velZ); - setSprite(MinecraftClient.getInstance().getItemRenderer().getModels().getSprite(Blocks.BARRIER.asItem())); - } - - @Override - public ParticleTextureSheet getType() { - return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT; - } - } - - @Environment(EnvType.CLIENT) - static class CustomTestParticle extends AnimatedParticle { - protected CustomTestParticle(World world, double x, double y, double z, SpriteProvider sprites) { - super(world, x, y, z, sprites, 1); - setSprite(sprites.getSprite(world.random)); - } - - @Environment(EnvType.CLIENT) - public static class Factory implements ParticleFactory { - private final FabricSpriteProvider sprites; - - public Factory(FabricSpriteProvider sprites) { - this.sprites = sprites; - } - - @Override - public Particle createParticle(DefaultParticleType type, World world, double x, double y, double z, double vX, double vY, double vZ) { - return new CustomTestParticle(world, x, y, z, sprites); - } - } - } -} diff --git a/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java b/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java deleted file mode 100644 index b7ecc8e1f..000000000 --- a/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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.resources; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.resource.ResourceManagerHelper; -import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; -import net.minecraft.resource.ResourceManager; -import net.minecraft.resource.ResourceType; -import net.minecraft.util.Identifier; - -import java.util.Collection; -import java.util.Collections; - -public class ResourceReloadModClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - for (int i = 64; i >= 2; i--) { - final int _i = i; - ResourceManagerHelper.get(ResourceType.ASSETS).registerReloadListener(new SimpleSynchronousResourceReloadListener() { - @Override - public void apply(ResourceManager var1) { - System.out.println("Reloading (should run as #" + _i + ")"); - } - - @Override - public Identifier getFabricId() { - return new Identifier("fabric:rrmc" + _i); - } - - @Override - public Collection getFabricDependencies() { - return Collections.singletonList(new Identifier("fabric:rrmc" + (_i - 1))); - } - }); - } - - ResourceManagerHelper.get(ResourceType.ASSETS).registerReloadListener(new SimpleSynchronousResourceReloadListener() { - @Override - public Identifier getFabricId() { - return new Identifier("fabric:rrmc1"); - } - - @Override - public void apply(ResourceManager var1) { - System.out.println("Reloading (should run as #1)"); - } - }); - - ResourceManagerHelper.get(ResourceType.ASSETS).registerReloadListener(new SimpleSynchronousResourceReloadListener() { - @Override - public Identifier getFabricId() { - return new Identifier("fabric:rrmc_should_not_resolve"); - } - - @Override - public Collection getFabricDependencies() { - return Collections.singletonList(new Identifier("fabric:rrmc_nonexistent")); - } - - @Override - public void apply(ResourceManager var1) { - } - }); - } -} diff --git a/fabric-testmods/resources/assets/testmod/particles/custom.json b/fabric-testmods/resources/assets/testmod/particles/custom.json deleted file mode 100644 index e7e925b5f..000000000 --- a/fabric-testmods/resources/assets/testmod/particles/custom.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "textures": [ - "minecraft:spell_7", - "minecraft:spell_6", - "minecraft:spell_5", - "minecraft:spell_4", - "minecraft:spell_3", - "minecraft:spell_2", - "minecraft:spell_1", - "minecraft:spell_0" - ] -} diff --git a/fabric-testmods/resources/assets/testmod/particles/simple.json b/fabric-testmods/resources/assets/testmod/particles/simple.json deleted file mode 100644 index 0967ef424..000000000 --- a/fabric-testmods/resources/assets/testmod/particles/simple.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json b/fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json deleted file mode 100644 index 6b0ef6c00..000000000 --- a/fabric-testmods/resources/data/minecraft/loot_tables/blocks/stone.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:alternatives", - "children": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 - } - } - ] - } - } - ], - "name": "minecraft:stone" - }, - { - "type": "fabric:extended_tag", - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "name": "minecraft:wool", - "expand": false - } - ] - } - ] - } - ] -} diff --git a/fabric-testmods/resources/mod.json b/fabric-testmods/resources/mod.json deleted file mode 100644 index 44b50c290..000000000 --- a/fabric-testmods/resources/mod.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "id": "fabric_test", - "name": "Fabric API Tests", - "version": "0.1.1", - "side": "universal", - "description": "A series of test mods to check Fabric works.", - "license": "Apache-2.0", - "initializers": [ - "net.fabricmc.fabric.colormapper.ColorProviderMod", - "net.fabricmc.fabric.events.ServerEventMod", - "net.fabricmc.fabric.containers.ContainerMod", - "net.fabricmc.fabric.containers.ContainerModClient", - "net.fabricmc.fabric.loot.LootEntryMod" - ] -}