added rotten flesh stripes
This commit is contained in:
@@ -4,16 +4,11 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import de.jottyfan.minecraft.block.QuicklyBlocks;
|
||||
import de.jottyfan.minecraft.composter.QuicklyComposter;
|
||||
import de.jottyfan.minecraft.feature.QuicklyFeatures;
|
||||
import de.jottyfan.minecraft.item.QuicklyItems;
|
||||
import de.jottyfan.minecraft.loot.QuicklyLootTables;
|
||||
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
|
||||
@@ -24,30 +19,6 @@ public class Quickly implements ModInitializer {
|
||||
|
||||
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
|
||||
public void onInitialize() {
|
||||
LOGGER.info("loading {}", MOD_ID);
|
||||
@@ -55,8 +26,7 @@ public class Quickly implements ModInitializer {
|
||||
QuicklyItems.registerModItems();
|
||||
QuicklyBlocks.registerModBlocks();
|
||||
QuicklyFeatures.registerFeatures();
|
||||
registerComposterItems();
|
||||
registerLootTableChanges();
|
||||
|
||||
QuicklyComposter.registerComposterItems();
|
||||
QuicklyLootTables.registerChanges();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ public class QuicklyItems {
|
||||
public static final Item COTTON = registerItem("cotton");
|
||||
public static final Item COTTONPLANT = registerItem("cottonplant");
|
||||
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) {
|
||||
return QuicklyItems.registerItem(name, new Item.Properties());
|
||||
@@ -52,6 +53,7 @@ public class QuicklyItems {
|
||||
item.accept(TURQUOISEINGOT);
|
||||
item.accept(COTTON);
|
||||
item.accept(COTTONSEED);
|
||||
item.accept(ROTTENFLESHSTRIPES);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "quickly:item/rotten_flesh_stripes"
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
"item.quickly.oredeepslateturquoise": "Türkistiefenerz",
|
||||
"item.quickly.oreturquoise": "Türkiserz",
|
||||
"item.quickly.rawturquoise": "rohes Türkis",
|
||||
"item.quickly.rotten_flesh_stripes": "geschnittenes Gammelfleisch",
|
||||
"item.quickly.stub": "Stummel",
|
||||
"item.quickly.turquoiseingot": "Türkisbarren"
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"item.quickly.oredeepslateturquoise": "turquoise deepslate ore",
|
||||
"item.quickly.oreturquoise": "turquoise ore",
|
||||
"item.quickly.rawturquoise": "raw turquoise",
|
||||
"item.quickly.rotten_flesh_stripes": "rotton flesh stripes",
|
||||
"item.quickly.stub": "stub",
|
||||
"item.quickly.turquoiseingot": "turquoise ingot"
|
||||
}
|
||||
|
||||
@@ -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 |
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"type": "minecraft:smoking",
|
||||
"ingredient": "quickly:rotten_flesh_stripes",
|
||||
"result": {
|
||||
"id":"minecraft:leather"
|
||||
},
|
||||
"experience": 0,
|
||||
"cookingtime": 100
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": "minecraft:rotten_flesh",
|
||||
"result": {
|
||||
"id": "quickly:rotten_flesh_stripes"
|
||||
},
|
||||
"count": 2
|
||||
}
|
||||
Reference in New Issue
Block a user