added rotten flesh stripes

This commit is contained in:
Jottyfan
2025-12-25 17:47:16 +01:00
parent 3f874e62dc
commit 83ddc724bd
11 changed files with 91 additions and 34 deletions

View File

@@ -4,16 +4,11 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import de.jottyfan.minecraft.block.QuicklyBlocks; import de.jottyfan.minecraft.block.QuicklyBlocks;
import de.jottyfan.minecraft.composter.QuicklyComposter;
import de.jottyfan.minecraft.feature.QuicklyFeatures; import de.jottyfan.minecraft.feature.QuicklyFeatures;
import de.jottyfan.minecraft.item.QuicklyItems; import de.jottyfan.minecraft.item.QuicklyItems;
import de.jottyfan.minecraft.loot.QuicklyLootTables;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.storage.loot.LootPool;
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.providers.number.ConstantValue;
/** /**
* *
* @author jotty * @author jotty
@@ -24,30 +19,6 @@ public class Quickly implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger(MOD_ID); public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
private void registerComposterItems() {
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTONSEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTON, 0.75f);
}
private void registerLootTableChanges() {
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
if (source.isBuiltin()) {
// TODO: maybe, better harvest cotton from dry grass instead?
Identifier shortGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/short_grass");
Identifier tallGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/tall_grass");
if (key.identifier().equals(shortGrass)) {
LootPool.Builder poolBuilder = LootPool.lootPool()
.setRolls(ConstantValue.exactly(1f))
.when(LootItemRandomChanceCondition.randomChance(0.1f))
.add(LootItem.lootTableItem(QuicklyItems.COTTONSEED));
tableBuilder.withPool(poolBuilder);
} else if (key.identifier().equals(tallGrass)) {
// for the canola loot table block later
}
}
});
}
@Override @Override
public void onInitialize() { public void onInitialize() {
LOGGER.info("loading {}", MOD_ID); LOGGER.info("loading {}", MOD_ID);
@@ -55,8 +26,7 @@ public class Quickly implements ModInitializer {
QuicklyItems.registerModItems(); QuicklyItems.registerModItems();
QuicklyBlocks.registerModBlocks(); QuicklyBlocks.registerModBlocks();
QuicklyFeatures.registerFeatures(); QuicklyFeatures.registerFeatures();
registerComposterItems(); QuicklyComposter.registerComposterItems();
registerLootTableChanges(); QuicklyLootTables.registerChanges();
} }
} }

View File

@@ -0,0 +1,18 @@
package de.jottyfan.minecraft.composter;
import de.jottyfan.minecraft.item.QuicklyItems;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
/**
*
* @author jotty
*
*/
public class QuicklyComposter {
public static final void registerComposterItems() {
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTONSEED, 0.5f);
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTON, 0.75f);
}
}

View File

@@ -25,6 +25,7 @@ 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 ROTTENFLESHSTRIPES = registerItem("rotten_flesh_stripes");
private static final Item registerItem(String name) { private static final Item registerItem(String name) {
return QuicklyItems.registerItem(name, new Item.Properties()); return QuicklyItems.registerItem(name, new Item.Properties());
@@ -52,6 +53,7 @@ public class QuicklyItems {
item.accept(TURQUOISEINGOT); item.accept(TURQUOISEINGOT);
item.accept(COTTON); item.accept(COTTON);
item.accept(COTTONSEED); item.accept(COTTONSEED);
item.accept(ROTTENFLESHSTRIPES);
}); });
} }
} }

View File

@@ -0,0 +1,36 @@
package de.jottyfan.minecraft.loot;
import de.jottyfan.minecraft.item.QuicklyItems;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.storage.loot.LootPool;
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.providers.number.ConstantValue;
/**
*
* @author jotty
*
*/
public class QuicklyLootTables {
public static final void registerChanges() {
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
if (source.isBuiltin()) {
// TODO: maybe, better harvest cotton from dry grass instead?
Identifier shortGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/short_grass");
Identifier tallGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/tall_grass");
if (key.identifier().equals(shortGrass)) {
LootPool.Builder poolBuilder = LootPool.lootPool()
.setRolls(ConstantValue.exactly(1f))
.when(LootItemRandomChanceCondition.randomChance(0.1f))
.add(LootItem.lootTableItem(QuicklyItems.COTTONSEED));
tableBuilder.withPool(poolBuilder);
} else if (key.identifier().equals(tallGrass)) {
// for the canola loot table block later
}
}
});
}
}

View File

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

View File

@@ -7,6 +7,7 @@
"item.quickly.oredeepslateturquoise": "Türkistiefenerz", "item.quickly.oredeepslateturquoise": "Türkistiefenerz",
"item.quickly.oreturquoise": "Türkiserz", "item.quickly.oreturquoise": "Türkiserz",
"item.quickly.rawturquoise": "rohes Türkis", "item.quickly.rawturquoise": "rohes Türkis",
"item.quickly.rotten_flesh_stripes": "geschnittenes Gammelfleisch",
"item.quickly.stub": "Stummel", "item.quickly.stub": "Stummel",
"item.quickly.turquoiseingot": "Türkisbarren" "item.quickly.turquoiseingot": "Türkisbarren"
} }

View File

@@ -7,6 +7,7 @@
"item.quickly.oredeepslateturquoise": "turquoise deepslate ore", "item.quickly.oredeepslateturquoise": "turquoise deepslate ore",
"item.quickly.oreturquoise": "turquoise ore", "item.quickly.oreturquoise": "turquoise ore",
"item.quickly.rawturquoise": "raw turquoise", "item.quickly.rawturquoise": "raw turquoise",
"item.quickly.rotten_flesh_stripes": "rotton flesh stripes",
"item.quickly.stub": "stub", "item.quickly.stub": "stub",
"item.quickly.turquoiseingot": "turquoise ingot" "item.quickly.turquoiseingot": "turquoise ingot"
} }

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,9 @@
{
"type": "minecraft:smoking",
"ingredient": "quickly:rotten_flesh_stripes",
"result": {
"id":"minecraft:leather"
},
"experience": 0,
"cookingtime": 100
}

View File

@@ -0,0 +1,8 @@
{
"type": "minecraft:stonecutting",
"ingredient": "minecraft:rotten_flesh",
"result": {
"id": "quickly:rotten_flesh_stripes"
},
"count": 2
}