added canola

This commit is contained in:
Jottyfan
2025-12-26 17:36:50 +01:00
parent a4dd705db3
commit 3f7eaf48e3
32 changed files with 121 additions and 8 deletions

View File

@@ -15,5 +15,6 @@ public class QuicklyClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
BlockRenderLayerMap.putBlock(QuicklyBlocks.COTTONPLANT, ChunkSectionLayer.CUTOUT); BlockRenderLayerMap.putBlock(QuicklyBlocks.COTTONPLANT, ChunkSectionLayer.CUTOUT);
BlockRenderLayerMap.putBlock(QuicklyBlocks.CANOLAPLANT, ChunkSectionLayer.CUTOUT);
} }
} }

View File

@@ -31,6 +31,8 @@ public class QuicklyBlocks {
p -> new BlockOreDeepslateTurquoise(p)); p -> new BlockOreDeepslateTurquoise(p));
public static final Block COTTONPLANT = registerBlock("blockcottonplant", Properties.ofFullCopy(Blocks.WHEAT), public static final Block COTTONPLANT = registerBlock("blockcottonplant", Properties.ofFullCopy(Blocks.WHEAT),
p -> new BlockPlant(p, "cottonseed", "cotton")); p -> new BlockPlant(p, "cottonseed", "cotton"));
public static final Block CANOLAPLANT = registerBlock("blockcanolaplant", Properties.ofFullCopy(Blocks.WHEAT),
p -> new BlockPlant(p, "canolaseed", "canola"));
private static final Block registerBlock(String name, Properties properties) { private static final Block registerBlock(String name, Properties properties) {
return QuicklyBlocks.registerBlock(name, properties, p -> new Block(p)); return QuicklyBlocks.registerBlock(name, properties, p -> new Block(p));
@@ -57,6 +59,7 @@ public class QuicklyBlocks {
block.accept(ORETURQUOISE); block.accept(ORETURQUOISE);
block.accept(OREDEEPSLATETURQUOISE); block.accept(OREDEEPSLATETURQUOISE);
block.accept(COTTONPLANT); block.accept(COTTONPLANT);
block.accept(CANOLAPLANT);
}); });
} }
} }

View File

@@ -13,6 +13,8 @@ public class QuicklyComposter {
public static final void registerComposterItems() { public static final void registerComposterItems() {
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTONSEED, 0.5f); CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTONSEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTON, 0.75f); CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTON, 0.75f);
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.CANOLASEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.CANOLA, 0.75f);
} }
} }

View File

@@ -26,6 +26,10 @@ public class QuicklyItems {
public static final Item COTTON = registerItem("cotton"); public static final Item COTTON = registerItem("cotton");
public static final Item COTTONPLANT = registerItem("cottonplant"); public static final Item COTTONPLANT = registerItem("cottonplant");
public static final Item COTTONSEED = registerItem("cottonseed", properties -> new Plant(properties, "blockcottonplant")); public static final Item COTTONSEED = registerItem("cottonseed", properties -> new Plant(properties, "blockcottonplant"));
public static final Item CANOLA = registerItem("canola");
public static final Item CANOLAPLANT = registerItem("canolaplant");
public static final Item CANOLASEED = registerItem("canolaseed", properties -> new Plant(properties, "blockcanolaplant"));
public static final Item ROTTENFLESHSTRIPES = registerItem("rotten_flesh_stripes"); public static final Item ROTTENFLESHSTRIPES = registerItem("rotten_flesh_stripes");
public static final Item ARMOR_TURQUOISE_BOOTS = registerItem("turquoise_boots", ArmorType.BOOTS); public static final Item ARMOR_TURQUOISE_BOOTS = registerItem("turquoise_boots", ArmorType.BOOTS);

View File

@@ -3,6 +3,7 @@ package de.jottyfan.minecraft.loot;
import de.jottyfan.minecraft.item.QuicklyItems; import de.jottyfan.minecraft.item.QuicklyItems;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents; import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.minecraft.resources.Identifier; import net.minecraft.resources.Identifier;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition;
@@ -18,19 +19,19 @@ public class QuicklyLootTables {
public static final void registerChanges() { public static final void registerChanges() {
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> { LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
if (source.isBuiltin()) { if (source.isBuiltin()) {
// TODO: maybe, better harvest cotton from dry grass instead?
Identifier shortGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/short_grass"); Identifier shortGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/short_grass");
Identifier tallGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/tall_grass"); Identifier tallGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/tall_grass");
if (key.identifier().equals(shortGrass)) { if (key.identifier().equals(shortGrass)) {
LootPool.Builder poolBuilder = LootPool.lootPool() tableBuilder.withPool(harvestItemByChance(QuicklyItems.COTTONSEED, 0.05f));
.setRolls(ConstantValue.exactly(1f))
.when(LootItemRandomChanceCondition.randomChance(0.1f))
.add(LootItem.lootTableItem(QuicklyItems.COTTONSEED));
tableBuilder.withPool(poolBuilder);
} else if (key.identifier().equals(tallGrass)) { } else if (key.identifier().equals(tallGrass)) {
// for the canola loot table block later tableBuilder.withPool(harvestItemByChance(QuicklyItems.CANOLASEED, 0.03f));
} }
} }
}); });
} }
private static final LootPool.Builder harvestItemByChance(Item item, float chance) {
return LootPool.lootPool().setRolls(ConstantValue.exactly(1f))
.when(LootItemRandomChanceCondition.randomChance(chance)).add(LootItem.lootTableItem(item));
}
} }

View File

@@ -0,0 +1,12 @@
{
"variants": {
"age=0": { "model": "quickly:block/canolaplant0" },
"age=1": { "model": "quickly:block/canolaplant1" },
"age=2": { "model": "quickly:block/canolaplant2" },
"age=3": { "model": "quickly:block/canolaplant3" },
"age=4": { "model": "quickly:block/canolaplant4" },
"age=5": { "model": "quickly:block/canolaplant5" },
"age=6": { "model": "quickly:block/canolaplant6" },
"age=7": { "model": "quickly:block/canolaplant7" }
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickly:item/canola"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickly:item/canolaseed"
}
}

View File

@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickly:item/canolaseed"
}
}

View File

@@ -1,6 +1,9 @@
{ {
"item.quickly.blockcanolaplant": "Rapspflanze",
"item.quickly.blockcottonplant": "Baumwollpflanze", "item.quickly.blockcottonplant": "Baumwollpflanze",
"item.quickly.blockturquoise": "Türkisblock", "item.quickly.blockturquoise": "Türkisblock",
"item.quickly.canola": "Raps",
"item.quickly.canolaseed": "Rapssaat",
"item.quickly.cotton": "Baumwolle", "item.quickly.cotton": "Baumwolle",
"item.quickly.cottonseed": "Baumwollsaat", "item.quickly.cottonseed": "Baumwollsaat",
"item.quickly.kelpbundle": "Seegrassbündel", "item.quickly.kelpbundle": "Seegrassbündel",

View File

@@ -1,6 +1,9 @@
{ {
"item.quickly.blockcanolaplant": "canola plant",
"item.quickly.blockcottonplant": "cotton plant", "item.quickly.blockcottonplant": "cotton plant",
"item.quickly.blockturquoise": "block of turquoise", "item.quickly.blockturquoise": "block of turquoise",
"item.quickly.canola": "canola",
"item.quickly.canolaseed": "canola seed",
"item.quickly.cotton": "cotton", "item.quickly.cotton": "cotton",
"item.quickly.cottonseed": "cotton seed", "item.quickly.cottonseed": "cotton seed",
"item.quickly.kelpbundle": "kelp bundle", "item.quickly.kelpbundle": "kelp bundle",

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant2"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant3"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant4"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant5"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant6"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent":"block/cross",
"textures":{
"cross":"quickly:block/canolaplant7"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickly:item/canola"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickly:item/canolaseed"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickly:item/canolaseed"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB