Compare commits

..

No commits in common. "30610e36b1b6d3896b6fc3e3800e9c75d30af882" and "8991ea9ee399e0849e3cbfc5dde5cb59de30abcc" have entirely different histories.

4 changed files with 17 additions and 81 deletions

View File

@ -19,14 +19,14 @@ repositories {
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. // See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
dependencies { dependencies {
minecraft libs.minecraft minecraft libs.minecraft
//mappings variantOf(libs.quilt.mappings) { classifier "intermediary-v2" } mappings variantOf(libs.quilt.mappings) { classifier "intermediary-v2" }
// Replace the above line with the block below if you want to use Mojang mappings as your primary mappings, falling back on QM for parameters and Javadocs // Replace the above line with the block below if you want to use Mojang mappings as your primary mappings, falling back on QM for parameters and Javadocs
/*
mappings loom.layered { mappings loom.layered {
mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2" mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2"
officialMojangMappings() officialMojangMappings()
} }
*/
modImplementation libs.quilt.loader modImplementation libs.quilt.loader
// QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps. // QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps.

View File

@ -1,34 +0,0 @@
package com.danitheskunk.skunkstuff;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Material;
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings;
public class BlockBuilder extends QuiltBlockSettings {
public String name;
public CreativeModeTab creativeModeTab = CreativeModeTab.TAB_MISC;
public Block block;
public BlockBuilder() {
super(QuiltBlockSettings.of(Material.WOOD));
strength(2);
opaque(false);
}
public BlockBuilder name(String name) {
this.name = name;
return this;
}
public BlockBuilder creativeModeTab(CreativeModeTab creativeModeTab) {
this.creativeModeTab = creativeModeTab;
return this;
}
public Block build() {
block = new Block(this);
Blocks.addToDeffered(this);
return block;
}
}

View File

@ -1,41 +0,0 @@
package com.danitheskunk.skunkstuff;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import org.quiltmc.qsl.item.setting.api.QuiltItemSettings;
import java.util.ArrayList;
import java.util.List;
public class Blocks {
private static final List<BlockBuilder> deferred = new ArrayList<>();
private static final String namespace = "skunkstuff";
public static BlockBuilder register() {
return new BlockBuilder();
}
public static void addToDeffered(BlockBuilder builder) {
deferred.add(builder);
}
public static void registerAll() {
for(var block : deferred) {
Registry.register(
Registry.BLOCK,
new ResourceLocation(namespace, block.name),
block.block
);
Registry.register(
Registry.ITEM,
new ResourceLocation(namespace, block.name),
new BlockItem(
block.block,
new QuiltItemSettings().group(block.creativeModeTab)
)
);
}
}
}

View File

@ -1,8 +1,15 @@
package com.danitheskunk.skunkstuff; package com.danitheskunk.skunkstuff;
import net.minecraft.world.level.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.quiltmc.loader.api.ModContainer; import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer; import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings;
import org.quiltmc.qsl.item.setting.api.QuiltItemSettings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -10,10 +17,14 @@ public class SkunkStuff implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("SkunkStuff"); public static final Logger LOGGER = LoggerFactory.getLogger("SkunkStuff");
public static final Block GOBAN_BLOCK = public static final Block GOBAN_BLOCK =
Blocks.register().name("goban").build(); new Block(QuiltBlockSettings.of(Material.WOOD).strength(2).opaque(false));
@Override @Override
public void onInitialize(ModContainer mod) { public void onInitialize(ModContainer mod) {
Blocks.registerAll(); Registry.register(Registry.BLOCK, new Identifier("skunkstuff", "goban"), GOBAN_BLOCK);
Registry.register(Registry.ITEM, new Identifier("skunkstuff",
"goban"), new BlockItem(GOBAN_BLOCK,
new QuiltItemSettings().group(ItemGroup.MISC)));
LOGGER.info("Hello Quilt world from {}!", mod.metadata().name());
} }
} }