finetuning
This commit is contained in:
parent
581ba151e3
commit
28c1ae42f4
@ -129,7 +129,7 @@ public class RegistryManager {
|
||||
* @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) {
|
||||
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);
|
||||
}
|
||||
@ -154,9 +154,9 @@ public class RegistryManager {
|
||||
List<BlockState> dirtlike = new ArrayList<>();
|
||||
dirtlike.add(Blocks.DIRT.getDefaultState());
|
||||
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.generateOreInBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1.0f);
|
||||
RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1.0f);
|
||||
RegistryManager.generateOreInBlocks(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);
|
||||
}
|
||||
|
@ -1,31 +1,12 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.DefaultedRegistry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -34,70 +15,10 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(ToolRangeableAxe.class);
|
||||
|
||||
protected ToolRangeableAxe(ToolMaterial material, float attachDamage, float attackSpeedIn, Settings settings) {
|
||||
super(material, attachDamage, attackSpeedIn, settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* generate a block list of the resource locations in set
|
||||
*
|
||||
* @param set
|
||||
* the set to be used as source for the block list
|
||||
* @return a block list, at least an empty one
|
||||
*/
|
||||
private List<Block> generateBlockList(Set<Identifier> set) {
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
Set<Identifier> rls = new HashSet<>(set); // copy to omit changes on the set
|
||||
DefaultedRegistry<Block> allBlocks = Registry.BLOCK;
|
||||
Set<Entry<RegistryKey<Block>, Block>> entries = allBlocks.getEntries();
|
||||
for (Entry<RegistryKey<Block>, Block> entry : entries) {
|
||||
Iterator<Identifier> i = rls.iterator();
|
||||
while (i.hasNext()) {
|
||||
Identifier rl = i.next();
|
||||
if (rl.equals(entry.getKey().getValue())) {
|
||||
blocks.add(entry.getValue());
|
||||
i.remove(); // speed up algorithm
|
||||
}
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method only exists because of try to find a way in fabric to break the neighbor blocks also
|
||||
*
|
||||
*/
|
||||
// @Override
|
||||
// public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
|
||||
// LOGGER.info("start finishUsing");
|
||||
//
|
||||
// BlockPos blockpos = user.getBlockPos();
|
||||
// LOGGER.info("at position %s", blockpos.toString());
|
||||
// BlockState blockStateAbove = world.getBlockState(blockpos.up());
|
||||
// BlockState blockStateCurrent = world.getBlockState(blockpos);
|
||||
// LOGGER.info("compare name of %s and %s: %s =?= %s", blockpos.toString(), blockpos.up().toString(), blockStateCurrent.getBlock().getName(), blockStateAbove.getBlock().getName());
|
||||
// if (blockStateAbove.getBlock().getName().equals(blockStateCurrent.getBlock().getName())) {
|
||||
// LOGGER.info("found equal block above");
|
||||
//
|
||||
// // found same block above
|
||||
// ItemStack droppedStack = new ItemStack(blockStateAbove.getBlock().asItem());
|
||||
//
|
||||
// // TODO: merge all item stacks of all blocks into one to reduce lag
|
||||
// double x = blockpos.up().getX();
|
||||
// double y = blockpos.up().getY();
|
||||
// double z = blockpos.up().getZ();
|
||||
// ItemEntity itemEntity = new ItemEntity(world, x, y, z, droppedStack);
|
||||
//
|
||||
// world.spawnEntity(itemEntity);
|
||||
// world.removeBlock(blockpos.up(), false);
|
||||
// } else {
|
||||
// LOGGER.info("blocks are not equal");
|
||||
// }
|
||||
// return super.finishUsing(stack, world, user);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public HarvestRange getRange() {
|
||||
return null; // no limit
|
||||
@ -120,12 +41,6 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
||||
return blockList;
|
||||
}
|
||||
}
|
||||
// for (Set<Identifier> identifiers : BIOMESOPLENTY_AXE) {
|
||||
// Identifier blockIdentifier = block.getBlock().getRegistryName();
|
||||
// if (identifiers.contains(blockIdentifier)) {
|
||||
// return generateBlockList(identifiers);
|
||||
// }
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
BIN
src/main/resources/assets/quickiefabric/icon.png
Normal file
BIN
src/main/resources/assets/quickiefabric/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "modid",
|
||||
"id": "quickiefabric",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "quickiefabric",
|
||||
@ -14,7 +14,7 @@
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/modid/icon.png",
|
||||
"icon": "assets/quickiefabric/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
@ -23,7 +23,7 @@
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
"quickiefabric.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
|
Loading…
x
Reference in New Issue
Block a user