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