started with itemhoarder
This commit is contained in:
parent
842f04baca
commit
6f73265cc9
@ -17,6 +17,7 @@ public class QuickieFabric implements ModInitializer {
|
||||
RegistryManager.registerTools();
|
||||
RegistryManager.registerEvents();
|
||||
RegistryManager.registerBlocks();
|
||||
RegistryManager.registerBlockEntities();
|
||||
Registry.BIOME.forEach(RegistryManager::handleBiome);
|
||||
}
|
||||
}
|
||||
|
@ -13,4 +13,5 @@ public class QuickieBlocks {
|
||||
public static final BlockOreSulphor ORE_SULPHOR = new BlockOreSulphor();
|
||||
public static final BlockSandSalpeter SAND_SALPETER = new BlockSandSalpeter();
|
||||
public static final BlockLavahoarder LAVAHOARDER = new BlockLavahoarder();
|
||||
public static final BlockItemhoarder ITEMHOARDER = new BlockItemhoarder();
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
|
||||
import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
|
||||
import de.jottyfan.minecraft.quickiefabric.event.EventBlockBreak;
|
||||
@ -15,6 +17,7 @@ import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@ -41,33 +44,40 @@ public class RegistryManager {
|
||||
|
||||
private static final String QUICKIEFABRIC = "quickiefabric";
|
||||
|
||||
public static final ItemGroup QUICKIEFABRIC_GROUP = FabricItemGroupBuilder.create(new Identifier(QUICKIEFABRIC, "all")).icon(() -> new ItemStack(QuickieItems.SPEEDPOWDER)).appendItems(stacks -> {
|
||||
stacks.add(new ItemStack(QuickieItems.SALPETER));
|
||||
stacks.add(new ItemStack(QuickieItems.SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieItems.SPEEDPOWDER));
|
||||
stacks.add(new ItemStack(QuickieItems.LEVELUP));
|
||||
stacks.add(new ItemStack(QuickieItems.PENCIL));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERPICKAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERSHOVEL));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DIRT_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_NETHER_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.LAVAHOARDER));
|
||||
}).build();
|
||||
public static final ItemGroup QUICKIEFABRIC_GROUP = FabricItemGroupBuilder.create(new Identifier(QUICKIEFABRIC, "all")).icon(() -> new ItemStack(QuickieItems.SPEEDPOWDER))
|
||||
.appendItems(stacks -> {
|
||||
stacks.add(new ItemStack(QuickieItems.SALPETER));
|
||||
stacks.add(new ItemStack(QuickieItems.SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieItems.SPEEDPOWDER));
|
||||
stacks.add(new ItemStack(QuickieItems.LEVELUP));
|
||||
stacks.add(new ItemStack(QuickieItems.PENCIL));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERPICKAXE));
|
||||
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERSHOVEL));
|
||||
stacks.add(new ItemStack(QuickieBlocks.DIRT_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_NETHER_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ORE_SULPHOR));
|
||||
stacks.add(new ItemStack(QuickieBlocks.SAND_SALPETER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.LAVAHOARDER));
|
||||
stacks.add(new ItemStack(QuickieBlocks.ITEMHOARDER));
|
||||
}).build();
|
||||
|
||||
private static final void registerBlock(Block block, String name) {
|
||||
Registry.register(Registry.BLOCK, new Identifier(QUICKIEFABRIC, name), block);
|
||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, name), new BlockItem(block, new Item.Settings().group(RegistryManager.QUICKIEFABRIC_GROUP)));
|
||||
}
|
||||
|
||||
|
||||
private static final void registerItem(Item item, String name) {
|
||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, name), item);
|
||||
}
|
||||
|
||||
|
||||
public static final void registerBlockEntities() {
|
||||
QuickieFabricBlockEntity.ITEMHOARDER = Registry.register(Registry.BLOCK_ENTITY_TYPE, QUICKIEFABRIC + ":itemhoarderblockentity",
|
||||
BlockEntityType.Builder.create(ItemHoarderBlockEntity::new, QuickieBlocks.ITEMHOARDER).build(null));
|
||||
}
|
||||
|
||||
public static final void registerBlocks() {
|
||||
LOGGER.debug("registering quickiefabric blocks");
|
||||
registerBlock(QuickieBlocks.DIRT_SALPETER, "dirtsalpeter");
|
||||
@ -77,6 +87,7 @@ public class RegistryManager {
|
||||
registerBlock(QuickieBlocks.ORE_SULPHOR, "oresulphor");
|
||||
registerBlock(QuickieBlocks.SAND_SALPETER, "sandsalpeter");
|
||||
registerBlock(QuickieBlocks.LAVAHOARDER, "lavahoarder");
|
||||
registerBlock(QuickieBlocks.ITEMHOARDER, "itemhoarder");
|
||||
}
|
||||
|
||||
public static final void registerItems() {
|
||||
@ -106,14 +117,22 @@ public class RegistryManager {
|
||||
/**
|
||||
* generate ores
|
||||
*
|
||||
* @param biome the biome to generate the veins in
|
||||
* @param target the block to be replaced
|
||||
* @param block the block that is the replacement
|
||||
* @param veinsize the size of the vein
|
||||
* @param count the number of veins in a chunk
|
||||
* @param bottomOffset the lower limit
|
||||
* @param topOffset the upper limit
|
||||
* @param maximum the maximum number of blocks in a vein
|
||||
* @param biome
|
||||
* the biome to generate the veins in
|
||||
* @param target
|
||||
* the block to be replaced
|
||||
* @param block
|
||||
* the block that is the replacement
|
||||
* @param veinsize
|
||||
* the size of the vein
|
||||
* @param count
|
||||
* the number of veins in a chunk
|
||||
* @param bottomOffset
|
||||
* the lower limit
|
||||
* @param topOffset
|
||||
* the upper limit
|
||||
* @param maximum
|
||||
* the maximum number of blocks in a vein
|
||||
*/
|
||||
public static void generateOreForTarget(Biome biome, Target target, Block block, int veinsize, int count, int bottomOffset, int topOffset, int maximum) {
|
||||
OreFeatureConfig ofc = new OreFeatureConfig(target, block.getDefaultState(), veinsize);
|
||||
@ -124,18 +143,23 @@ public class RegistryManager {
|
||||
/**
|
||||
* generate ore instead of block
|
||||
*
|
||||
* @param biome the biome
|
||||
* @param placeOn the list of blockStates underneath
|
||||
* @param placeIn the list of blockStates to be replaced
|
||||
* @param placeUnder the list of blockStates above
|
||||
* @param block the block to set
|
||||
* @param chance the chance for the replacement
|
||||
* @param biome
|
||||
* the biome
|
||||
* @param placeOn
|
||||
* the list of blockStates underneath
|
||||
* @param placeIn
|
||||
* the list of blockStates to be replaced
|
||||
* @param placeUnder
|
||||
* the list of blockStates above
|
||||
* @param block
|
||||
* the block to set
|
||||
* @param chance
|
||||
* the chance for the replacement
|
||||
*/
|
||||
public static void generateOreInBlocks(Biome biome, List<BlockState> placeOn, List<BlockState> placeIn, List<BlockState> placeUnder, Block block, float chance) {
|
||||
SimpleBlockFeatureConfig sbfc = new SimpleBlockFeatureConfig(block.getDefaultState(), placeOn, placeIn, placeUnder);
|
||||
biome.addFeature(GenerationStep.Feature.LOCAL_MODIFICATIONS, Feature.SIMPLE_BLOCK.configure(sbfc).withChance(chance).feature);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add the quickiefabric ores to the biome
|
||||
|
Loading…
x
Reference in New Issue
Block a user