added blocks
This commit is contained in:
parent
abcf173057
commit
021ae584f0
@ -1,7 +1,16 @@
|
|||||||
package de.jottyfan.minecraft.quickiefabric;
|
package de.jottyfan.minecraft.quickiefabric;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
|
||||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -15,6 +24,32 @@ public class QuickieFabric implements ModInitializer {
|
|||||||
RegistryManager.registerItems();
|
RegistryManager.registerItems();
|
||||||
RegistryManager.registerTools();
|
RegistryManager.registerTools();
|
||||||
RegistryManager.registerEvents();
|
RegistryManager.registerEvents();
|
||||||
|
RegistryManager.registerBlocks();
|
||||||
|
Registry.BIOME.forEach(this::handleBiome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add the quickiefabric ores to the biome
|
||||||
|
*
|
||||||
|
* @param biome
|
||||||
|
* the biome
|
||||||
|
*/
|
||||||
|
private void handleBiome(Biome biome) {
|
||||||
|
if (biome.getCategory() == Biome.Category.NETHER) {
|
||||||
|
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NETHER_ORE_REPLACEABLES, QuickieBlocks.ORE_NETHER_SULPHOR, 24, 10, 0, 0, 128);
|
||||||
|
} else if (biome.getCategory() != Biome.Category.THEEND) {
|
||||||
|
} else {
|
||||||
|
List<BlockState> sandlike = new ArrayList<>();
|
||||||
|
sandlike.add(Blocks.SAND.getDefaultState());
|
||||||
|
sandlike.add(Blocks.SANDSTONE.getDefaultState());
|
||||||
|
sandlike.add(Blocks.SANDSTONE_WALL.getDefaultState());
|
||||||
|
sandlike.add(Blocks.CHISELED_SANDSTONE.getDefaultState());
|
||||||
|
List<BlockState> dirtlike = new ArrayList<>();
|
||||||
|
dirtlike.add(Blocks.DIRT.getDefaultState());
|
||||||
|
RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 10, 64, 196, 255);
|
||||||
|
RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 10, 64, 196, 255);
|
||||||
|
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SULPHOR, 16, 4, 4, 196, 255);
|
||||||
|
RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SALPETER, 12, 10, 4, 196, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.OreBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockOreNetherSulphor extends OreBlock {
|
||||||
|
|
||||||
|
public BlockOreNetherSulphor() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(2.1f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
return Arrays.asList(new ItemStack[] { new ItemStack(Items.SULPHOR) });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getExperienceWhenMined(Random random) {
|
||||||
|
return random.nextInt(3);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.OreBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockOreSalpeter extends OreBlock {
|
||||||
|
|
||||||
|
public BlockOreSalpeter() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(3.1f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
return Arrays.asList(new ItemStack[] { new ItemStack(Items.SALPETER) });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getExperienceWhenMined(Random random) {
|
||||||
|
return random.nextInt(3);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.OreBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockOreSandSalpeter extends OreBlock {
|
||||||
|
|
||||||
|
public BlockOreSandSalpeter() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(2.9f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
return Arrays.asList(new ItemStack[] { new ItemStack(Items.SALPETER), new ItemStack(Blocks.SAND) });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getExperienceWhenMined(Random random) {
|
||||||
|
return random.nextInt(3);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.OreBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockOreSulphor extends OreBlock {
|
||||||
|
|
||||||
|
public BlockOreSulphor() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(1.9f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
return Arrays.asList(new ItemStack[] { new ItemStack(Items.SULPHOR) });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getExperienceWhenMined(Random random) {
|
||||||
|
return random.nextInt(3);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.GravelBlock;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockSandSalpeter extends GravelBlock {
|
||||||
|
|
||||||
|
public BlockSandSalpeter() {
|
||||||
|
super(FabricBlockSettings.of(Material.STONE).hardness(3.1f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||||
|
return Arrays.asList(new ItemStack[] { new ItemStack(Items.SALPETER), new ItemStack(Blocks.SAND) });
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.blocks;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class QuickieBlocks {
|
||||||
|
public static final BlockOreNetherSulphor ORE_NETHER_SULPHOR = new BlockOreNetherSulphor();
|
||||||
|
public static final BlockOreSalpeter ORE_SALPETER = new BlockOreSalpeter();
|
||||||
|
public static final BlockOreSandSalpeter ORE_SAND_SALPETER = new BlockOreSandSalpeter();
|
||||||
|
public static final BlockOreSulphor ORE_SULPHOR = new BlockOreSulphor();
|
||||||
|
public static final BlockSandSalpeter SAND_SALPETER = new BlockSandSalpeter();
|
||||||
|
}
|
@ -21,9 +21,10 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
@Mixin(Block.class)
|
@Mixin(Block.class)
|
||||||
public class BlockBreakMixin {
|
public class BlockBreakMixin {
|
||||||
@Inject(method = "injectBlockBreakCallback", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)V"), cancellable = true)
|
// @Inject(method = "injectBlockBreakCallback", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBreak(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/player/PlayerEntity;)V"), cancellable = true)
|
||||||
private void interactOnBreak(final World world, final BlockPos blockPos, final BlockState blockState, final PlayerEntity player, final CallbackInfo info) {
|
@Inject(method = "injectBlockBreakCallback", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;onBroken(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V"), cancellable = true)
|
||||||
ActionResult result = BreakBlockCallback.EVENT.invoker().injectBlockBreakCallback(world, blockPos, blockState, player);
|
private void interactOnBreak(final World world, final BlockPos blockPos, final BlockState blockState, final CallbackInfo info) {
|
||||||
|
ActionResult result = BreakBlockCallback.EVENT.invoker().injectBlockBreakCallback(world, blockPos, blockState);
|
||||||
if (result == ActionResult.FAIL) {
|
if (result == ActionResult.FAIL) {
|
||||||
info.cancel();
|
info.cancel();
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
public interface BreakBlockCallback {
|
public interface BreakBlockCallback {
|
||||||
Event<BreakBlockCallback> EVENT = EventFactory.createArrayBacked(BreakBlockCallback.class,
|
Event<BreakBlockCallback> EVENT = EventFactory.createArrayBacked(BreakBlockCallback.class,
|
||||||
(listeners) -> (world, blockPos, blockState, player) -> {
|
(listeners) -> (world, blockPos, blockState) -> {
|
||||||
for (BreakBlockCallback listener : listeners) {
|
for (BreakBlockCallback listener : listeners) {
|
||||||
ActionResult result = listener.injectBlockBreakCallback(world, blockPos, blockState, player);
|
ActionResult result = listener.injectBlockBreakCallback(world, blockPos, blockState);
|
||||||
if (result != ActionResult.PASS) {
|
if (result != ActionResult.PASS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -25,5 +25,5 @@ public interface BreakBlockCallback {
|
|||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
});
|
});
|
||||||
|
|
||||||
ActionResult injectBlockBreakCallback(World world, BlockPos blockPos, BlockState blockState, PlayerEntity player);
|
ActionResult injectBlockBreakCallback(World world, BlockPos blockPos, BlockState blockState);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,31 @@
|
|||||||
package de.jottyfan.minecraft.quickiefabric.init;
|
package de.jottyfan.minecraft.quickiefabric.init;
|
||||||
|
|
||||||
|
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.blocks.QuickieBlocks;
|
||||||
import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
|
import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
|
||||||
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
import de.jottyfan.minecraft.quickiefabric.items.Items;
|
||||||
import de.jottyfan.minecraft.quickiefabric.tools.Tools;
|
import de.jottyfan.minecraft.quickiefabric.tools.Tools;
|
||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
|
import net.minecraft.world.gen.decorator.Decorator;
|
||||||
|
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||||
|
import net.minecraft.world.gen.feature.Feature;
|
||||||
|
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||||
|
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -29,30 +44,80 @@ public class RegistryManager {
|
|||||||
stacks.add(new ItemStack(Items.LEVELUP));
|
stacks.add(new ItemStack(Items.LEVELUP));
|
||||||
stacks.add(new ItemStack(Items.PENCIL));
|
stacks.add(new ItemStack(Items.PENCIL));
|
||||||
stacks.add(new ItemStack(Tools.SPEEDPOWDERAXE));
|
stacks.add(new ItemStack(Tools.SPEEDPOWDERAXE));
|
||||||
|
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));
|
||||||
}).build();
|
}).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 registerBlocks() {
|
||||||
|
LOGGER.debug("registering quickiefabric blocks");
|
||||||
|
registerBlock(QuickieBlocks.ORE_NETHER_SULPHOR, "orenethersulphor");
|
||||||
|
registerBlock(QuickieBlocks.ORE_SALPETER, "oresalpeter");
|
||||||
|
registerBlock(QuickieBlocks.ORE_SAND_SALPETER, "oresandsalpeter");
|
||||||
|
registerBlock(QuickieBlocks.ORE_SULPHOR, "oresulphor");
|
||||||
|
registerBlock(QuickieBlocks.SAND_SALPETER, "sandsalpeter");
|
||||||
|
}
|
||||||
|
|
||||||
public static final void registerItems() {
|
public static final void registerItems() {
|
||||||
LOGGER.debug("registering quickiefabric items");
|
LOGGER.debug("registering quickiefabric items");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "speedpowder"), Items.SPEEDPOWDER);
|
registerItem(Items.SPEEDPOWDER, "speedpowder");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "levelup"), Items.LEVELUP);
|
registerItem(Items.LEVELUP, "levelup");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "pencil"), Items.PENCIL);
|
registerItem(Items.PENCIL, "pencil");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "salpeter"), Items.SALPETER);
|
registerItem(Items.SALPETER, "salpeter");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "sulphor"), Items.SULPHOR);
|
registerItem(Items.SULPHOR, "sulphor");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void registerTools() {
|
public static final void registerTools() {
|
||||||
LOGGER.debug("registering quickiefabric tools");
|
LOGGER.debug("registering quickiefabric tools");
|
||||||
Registry.register(Registry.ITEM, new Identifier(QUICKIEFABRIC, "speedpowderaxe"), Tools.SPEEDPOWDERAXE);
|
registerItem(Tools.SPEEDPOWDERAXE, "speedpowderaxe");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void registerEvents() {
|
public static final void registerEvents() {
|
||||||
LOGGER.debug("registering quickiefabric events");
|
LOGGER.debug("registering quickiefabric events");
|
||||||
BreakBlockCallback.EVENT.register((world, blockPos, blockState, player) -> {
|
BreakBlockCallback.EVENT.register((world, blockPos, blockState) -> {
|
||||||
// TODO: add code to break the corresponding surroundings also if hand hold the right tool
|
// TODO: add code to break the corresponding surroundings also if hand hold the right tool
|
||||||
// return ActionResult.PASS; // if the breaking replaces another event, but this does not appear for the speedpowder tools
|
// return ActionResult.PASS; // if the breaking replaces another event, but this does not appear for the speedpowder tools
|
||||||
|
|
||||||
LOGGER.info("player %s broke block %s as %s", player.getName(), blockState.getBlock().getName(), blockPos.toString());
|
LOGGER.info("broke block %s at %s", blockState.getBlock().getName(), blockPos.toString());
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
RangeDecoratorConfig rdc = new RangeDecoratorConfig(count, bottomOffset, topOffset, maximum);
|
||||||
|
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE.configure(ofc).createDecoratedFeature(Decorator.COUNT_RANGE.configure(rdc)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateOreForBlocks(Biome biome, List<BlockState> placeOn, List<BlockState> placeIn, List<BlockState> placeUnder, Block block, int nrPerChunk,
|
||||||
|
int minHeight, int maxHeightBase, int maxHeight) {
|
||||||
|
// TODO
|
||||||
|
// BlockWithContextConfig config = new BlockWithContextConfig(block.getDefaultState(), placeOn, placeIn, placeUnder);
|
||||||
|
// RangeDecoratorConfig rdc = new RangeDecoratorConfig(nrPerChunk, minHeight, maxHeightBase, maxHeight);
|
||||||
|
// ConfiguredPlacement<CountRangeConfig> placement = Placement.COUNT_RANGE.configure(rdc);
|
||||||
|
// biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.SIMPLE_BLOCK.configure(config).withPlacement(placement));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/orenethersulphor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/oresalpeter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/oresandsalpeter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/oresulphor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "quickiefabric:block/sandsalpeter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "quickiefabric:block/orenethersulphor"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "quickiefabric:block/oresalpeter"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_column",
|
||||||
|
"textures": {
|
||||||
|
"end" : "minecraft:block/sandstone_top",
|
||||||
|
"side": "quickiefabric:block/oresandsalpeter"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "quickiefabric:block/oresulphor"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "quickiefabric:block/sandsalpeter"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 435 B |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 959 B |
13
src/main/resources/data/quickiefabric/recipes/salpeter1.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/salpeter1.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:dirtsalpeter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:salpeter",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
13
src/main/resources/data/quickiefabric/recipes/salpeter2.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/salpeter2.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:oresalpeter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:salpeter",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
13
src/main/resources/data/quickiefabric/recipes/salpeter3.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/salpeter3.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:oresandsalpeter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:salpeter",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
13
src/main/resources/data/quickiefabric/recipes/salpeter4.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/salpeter4.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:sandsalpeter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:salpeter",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
13
src/main/resources/data/quickiefabric/recipes/sulfur1.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/sulfur1.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:orenethersulphor"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:sulphor",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
13
src/main/resources/data/quickiefabric/recipes/sulfur2.json
Normal file
13
src/main/resources/data/quickiefabric/recipes/sulfur2.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"group": "ores",
|
||||||
|
"ingredient": [
|
||||||
|
{
|
||||||
|
"item": "quickiefabric:oresulphor"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": "quickiefabric:sulphor",
|
||||||
|
"count": 1,
|
||||||
|
"experience": 0.5,
|
||||||
|
"cookingtime": 200
|
||||||
|
}
|
@ -23,7 +23,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"quickiefabric.mixins.json"
|
// "quickiefabric.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user