added canola
This commit is contained in:
@@ -15,5 +15,6 @@ public class QuicklyClient implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
BlockRenderLayerMap.putBlock(QuicklyBlocks.COTTONPLANT, ChunkSectionLayer.CUTOUT);
|
||||
BlockRenderLayerMap.putBlock(QuicklyBlocks.CANOLAPLANT, ChunkSectionLayer.CUTOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public class QuicklyBlocks {
|
||||
p -> new BlockOreDeepslateTurquoise(p));
|
||||
public static final Block COTTONPLANT = registerBlock("blockcottonplant", Properties.ofFullCopy(Blocks.WHEAT),
|
||||
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) {
|
||||
return QuicklyBlocks.registerBlock(name, properties, p -> new Block(p));
|
||||
@@ -57,6 +59,7 @@ public class QuicklyBlocks {
|
||||
block.accept(ORETURQUOISE);
|
||||
block.accept(OREDEEPSLATETURQUOISE);
|
||||
block.accept(COTTONPLANT);
|
||||
block.accept(CANOLAPLANT);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public class QuicklyComposter {
|
||||
public static final void registerComposterItems() {
|
||||
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTONSEED, 0.5f);
|
||||
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.COTTON, 0.75f);
|
||||
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.CANOLASEED, 0.5f);
|
||||
CompostingChanceRegistry.INSTANCE.add(QuicklyItems.CANOLA, 0.75f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ 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 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 ARMOR_TURQUOISE_BOOTS = registerItem("turquoise_boots", ArmorType.BOOTS);
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.item.Item;
|
||||
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;
|
||||
@@ -18,19 +19,19 @@ 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");
|
||||
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);
|
||||
tableBuilder.withPool(harvestItemByChance(QuicklyItems.COTTONSEED, 0.05f));
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user