speedpowdertools work

This commit is contained in:
Jörg Henke 2020-07-30 23:03:00 +02:00
parent 77bf438714
commit 9eb4cf117c
6 changed files with 30 additions and 46 deletions

View File

@ -5,6 +5,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
*
*/
public class QuickieBlocks {
public static final BlockDirtSalpeter DIRT_SALPETER = new BlockDirtSalpeter();
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();

View File

@ -106,9 +106,8 @@ public class EventBlockBreak {
if (tool.canBreakNeigbbors(blockState)) {
Block currentBlock = blockState.getBlock();
if (validBlocks.contains(currentBlock)) {
Block.dropStacks(blockState, world, pos);
Block.dropStacks(blockState, world, pos); // includes xorbs
world.setBlockState(pos, Blocks.AIR.getDefaultState());
currentBlock.onStacksDropped(blockState, world, pos, stack);
if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) {
HarvestRange nextRadius = range == null ? null : range.addXYZ(-1);
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north(), tool, nextRadius, blockBreakDirection, player);

View File

@ -29,6 +29,7 @@ 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;
import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig;
/**
*
@ -47,6 +48,9 @@ public class RegistryManager {
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));
@ -65,6 +69,7 @@ public class RegistryManager {
public static final void registerBlocks() {
LOGGER.debug("registering quickiefabric blocks");
registerBlock(QuickieBlocks.DIRT_SALPETER, "dirtsalpeter");
registerBlock(QuickieBlocks.ORE_NETHER_SULPHOR, "orenethersulphor");
registerBlock(QuickieBlocks.ORE_SALPETER, "oresalpeter");
registerBlock(QuickieBlocks.ORE_SAND_SALPETER, "oresandsalpeter");
@ -114,13 +119,19 @@ public class RegistryManager {
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));
/**
* 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
*/
public static void generateOreForBlocks(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);
}
@ -133,7 +144,7 @@ public class RegistryManager {
public static final 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 if (biome.getCategory() == Biome.Category.THEEND) {
} else {
List<BlockState> sandlike = new ArrayList<>();
sandlike.add(Blocks.SAND.getDefaultState());
@ -142,8 +153,10 @@ public class RegistryManager {
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);
dirtlike.add(Blocks.GRASS.getDefaultState());
RegistryManager.generateOreForBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1.0f);
RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1.0f);
RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 1.0f);
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);
}

View File

@ -7,4 +7,6 @@ package de.jottyfan.minecraft.quickiefabric.tools;
*/
public class QuickieTools {
public static final ToolSpeedpowderAxe SPEEDPOWDERAXE = new ToolSpeedpowderAxe();
public static final ToolSpeedpowderPickaxe SPEEDPOWDERPICKAXE = new ToolSpeedpowderPickaxe();
public static final ToolSpeedpowderShovel SPEEDPOWDERSHOVEL = new ToolSpeedpowderShovel();
}

View File

@ -1,8 +1,6 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -12,7 +10,6 @@ import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier;
/**
*
@ -23,7 +20,7 @@ public interface ToolRangeable {
public static final Set<Block> SHOVEL_EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.GRAVEL, Blocks.SAND,
Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.CLAY, Blocks.FARMLAND, Blocks.GRASS_PATH, Blocks.RED_SAND, Blocks.SOUL_SAND });
public static final List<List<Block>> AXE_BLOCKLISTS = Lists.newArrayList(
public static final List<List<Block>> AXE_EFFECTIVE_ON = Lists.newArrayList(
Arrays.asList(Blocks.ACACIA_LOG, Blocks.STRIPPED_ACACIA_LOG, Blocks.ACACIA_WOOD, Blocks.STRIPPED_ACACIA_WOOD),
Arrays.asList(Blocks.BIRCH_LOG, Blocks.STRIPPED_BIRCH_LOG, Blocks.BIRCH_WOOD, Blocks.STRIPPED_BIRCH_WOOD),
Arrays.asList(Blocks.DARK_OAK_LOG, Blocks.STRIPPED_DARK_OAK_LOG, Blocks.DARK_OAK_WOOD,
@ -41,35 +38,7 @@ public interface ToolRangeable {
Blocks.MUSHROOM_STEM),
Arrays.asList(Blocks.POTTED_RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK, Blocks.RED_MUSHROOM, Blocks.MUSHROOM_STEM));
public static final Set<Block> PICKAXE_BLOCKLISTS = Sets.newHashSet(new Block[] {Blocks.GLOWSTONE});
public static final Set<Identifier> BIOMESOPLENTY_SHOVEL = Sets
.newHashSet(new Identifier[] { new Identifier("biomesoplenty", "flesh"),
new Identifier("biomesoplenty", "dirt"), new Identifier("biomesoplenty", "grass"),
new Identifier("biomesoplenty", "mud"), new Identifier("biomesoplenty", "white_sand") });
public static final Set<Identifier> BIOMESOPLENTY_PICKAXE = Sets
.newHashSet(new Identifier[] { new Identifier("biomesoplenty", "dried_sand") });
public static final List<Set<Identifier>> BIOMESOPLENTY_AXE = Lists.newArrayList(generateBOPAxeSet());
static List<Set<Identifier>> generateBOPAxeSet() {
List<Set<Identifier>> list = new ArrayList<>();
String[] bOPLogs = new String[] { "cherry", "dead", "ethereal", "fir", "hellbark", "jacaranda", "magic", "mahogany",
"palm", "redwood", "umbran", "willow" };
for (String s : bOPLogs) {
Set<Identifier> set = new HashSet<>();
set.add(new Identifier("biomesoplenty", s + "_log"));
set.add(new Identifier("biomesoplenty", s + "_wood"));
set.add(new Identifier("biomesoplenty", "stripped_" + s + "_log"));
set.add(new Identifier("biomesoplenty", "stripped_" + s + "_wood"));
list.add(set);
list.add(Sets.newHashSet(new Identifier("biomesoplenty", s + "_stairs")));
list.add(Sets.newHashSet(new Identifier("biomesoplenty", s + "_planks")));
list.add(Sets.newHashSet(new Identifier("biomesoplenty", s + "_slab")));
}
return list;
}
public static final Set<Block> PICKAXE_EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.GLOWSTONE});
/**
* @return range of blocks to be harvested

View File

@ -115,7 +115,7 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
@Override
public List<Block> getBlockList(Block block) {
for (List<Block> blockList : AXE_BLOCKLISTS) {
for (List<Block> blockList : AXE_EFFECTIVE_ON) {
if (blockList.contains(block)) {
return blockList;
}