updated byg logs
This commit is contained in:
parent
2ec6179053
commit
c82577587d
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.9.3+build.207
|
loader_version=0.9.3+build.207
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.16.3.1
|
mod_version = 1.16.3.2
|
||||||
maven_group = de.jottyfan.minecraft
|
maven_group = de.jottyfan.minecraft
|
||||||
archives_base_name = quickiefabric
|
archives_base_name = quickiefabric
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ public class EventBlockBreak {
|
|||||||
range = range.addXYZ(level);
|
range = range.addXYZ(level);
|
||||||
}
|
}
|
||||||
if (QuickieTools.SPEEDPOWDERAXE.equals(tool)) {
|
if (QuickieTools.SPEEDPOWDERAXE.equals(tool)) {
|
||||||
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, player);
|
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, player, true);
|
||||||
} else if (QuickieTools.SPEEDPOWDERPICKAXE.equals(tool)) {
|
} else if (QuickieTools.SPEEDPOWDERPICKAXE.equals(tool)) {
|
||||||
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, player);
|
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, player, false);
|
||||||
} else if (QuickieTools.SPEEDPOWDERSHOVEL.equals(tool)) {
|
} else if (QuickieTools.SPEEDPOWDERSHOVEL.equals(tool)) {
|
||||||
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, player);
|
breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, player, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class EventBlockBreak {
|
|||||||
* the player
|
* the player
|
||||||
*/
|
*/
|
||||||
private void breakBlockRecursive(List<String> visitedBlocks, World world, List<Block> validBlocks, BlockPos pos, ToolRangeable tool, HarvestRange range, BlockBreakDirection blockBreakDirection,
|
private void breakBlockRecursive(List<String> visitedBlocks, World world, List<Block> validBlocks, BlockPos pos, ToolRangeable tool, HarvestRange range, BlockBreakDirection blockBreakDirection,
|
||||||
PlayerEntity player) {
|
PlayerEntity player, boolean breakLeaves) {
|
||||||
if (visitedBlocks.contains(pos.toString())) {
|
if (visitedBlocks.contains(pos.toString())) {
|
||||||
return; // reduce loops
|
return; // reduce loops
|
||||||
} else if (validBlocks == null) {
|
} else if (validBlocks == null) {
|
||||||
@ -103,26 +103,41 @@ public class EventBlockBreak {
|
|||||||
visitedBlocks.add(pos.toString());
|
visitedBlocks.add(pos.toString());
|
||||||
}
|
}
|
||||||
BlockState blockState = world.getBlockState(pos);
|
BlockState blockState = world.getBlockState(pos);
|
||||||
if (tool.canBreakNeigbbors(blockState)) {
|
if (tool.canBreakNeighbors(blockState)) {
|
||||||
Block currentBlock = blockState.getBlock();
|
Block currentBlock = blockState.getBlock();
|
||||||
if (validBlocks.contains(currentBlock)) {
|
if (validBlocks.contains(currentBlock)) {
|
||||||
Block.dropStacks(blockState, world, pos); // includes xorbs
|
Block.dropStacks(blockState, world, pos); // includes xorbs
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) {
|
if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) {
|
||||||
HarvestRange nextRadius = range == null ? null : range.addXYZ(-1);
|
HarvestRange nextRadius = range == null ? null : range.addXYZ(-1);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().east(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().west(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().east(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().west(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.east(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.west(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
|
||||||
if (BlockBreakDirection.ALL.equals(blockBreakDirection)) {
|
if (BlockBreakDirection.ALL.equals(blockBreakDirection)) {
|
||||||
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down(), tool, nextRadius, blockBreakDirection, player);
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().east(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
|
breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().west(), tool, nextRadius, blockBreakDirection, player, breakLeaves);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.Byg;
|
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.Byg;
|
||||||
|
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.IdentifierGroups;
|
||||||
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.IdentifierGroup;
|
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.IdentifierGroup;
|
||||||
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.Terrestria;
|
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.Terrestria;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -49,24 +50,14 @@ public interface ToolRangeable {
|
|||||||
Arrays.asList(Blocks.POTTED_RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK, Blocks.RED_MUSHROOM, Blocks.MUSHROOM_STEM));
|
Arrays.asList(Blocks.POTTED_RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK, Blocks.RED_MUSHROOM, Blocks.MUSHROOM_STEM));
|
||||||
|
|
||||||
public static final Set<IdentifierGroup> AXE_EFFECTIVE_ON_EXTERNAL = mergeGroupSets(
|
public static final Set<IdentifierGroup> AXE_EFFECTIVE_ON_EXTERNAL = mergeGroupSets(
|
||||||
Terrestria.createFromGroups(new IdentifierGroup("redwood", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
Terrestria.createFromSet(
|
||||||
new IdentifierGroup("hemlock", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
new IdentifierGroups("cypress", "hemlock", "japanese_maple", "rainbow_eucalyptus", "redwood", "rubber",
|
||||||
new IdentifierGroup("rubber", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
"sakura", "willow", "yucca_palm").getGroups("log", "quarter_log", "log_bare", "log_top", "wood")),
|
||||||
new IdentifierGroup("cypress", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
Byg.createFromSet(new IdentifierGroups("aspen", "baobab", "blue_enchanted", "cherry", "cika", "cypress", "ebony",
|
||||||
new IdentifierGroup("willow", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
"fir", "green_enchanted", "holly", "jacaranda", "mahogany", "mangrove", "pine", "rainbow_eucalyptus",
|
||||||
new IdentifierGroup("japanese_maple", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
"redwood", "skyris", "willow", "witch_hazel", "zelkova").getGroups("log", "wood")),
|
||||||
new IdentifierGroup("rainbow_eucalyptus", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
Byg.createFromSet(
|
||||||
new IdentifierGroup("sakura", "log", "quarter_log", "log_bare", "log_top", "wood"),
|
new IdentifierGroups("blue_glowshroom", "purple_glowshroom", "red_glowshroom", "yellow_glowshroom").getGroups("block", "stem")));
|
||||||
new IdentifierGroup("yucca_palm", "log", "quarter_log", "log_bare", "log_top", "wood")),
|
|
||||||
Byg.createFromGroups(new IdentifierGroup("aspen", "log", "wood"), new IdentifierGroup("baobab", "log", "wood"),
|
|
||||||
new IdentifierGroup("blue_enchanted", "log", "wood"), new IdentifierGroup("cherry", "log", "wood"),
|
|
||||||
new IdentifierGroup("cika", "log", "wood"), new IdentifierGroup("cypress", "log", "wood"),
|
|
||||||
new IdentifierGroup("ebony", "log", "wood"), new IdentifierGroup("fir", "log", "wood"),
|
|
||||||
new IdentifierGroup("green_enchanted", "log", "wood"), new IdentifierGroup("holly", "log", "wood"),
|
|
||||||
new IdentifierGroup("jacaranda", "log", "wood"), new IdentifierGroup("mahogany", "log", "wood"),
|
|
||||||
new IdentifierGroup("mangrove", "log", "wood"), new IdentifierGroup("willow", "log", "wood"),
|
|
||||||
new IdentifierGroup("witch_hazel", "log", "wood"), new IdentifierGroup("zelkova", "log", "wood"),
|
|
||||||
new IdentifierGroup("pine", "log", "wood")));
|
|
||||||
|
|
||||||
public static final Set<Block> PICKAXE_EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.GLOWSTONE });
|
public static final Set<Block> PICKAXE_EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.GLOWSTONE });
|
||||||
|
|
||||||
@ -112,7 +103,7 @@ public interface ToolRangeable {
|
|||||||
* @param blockState the block state of the current block
|
* @param blockState the block state of the current block
|
||||||
* @return true or false
|
* @return true or false
|
||||||
*/
|
*/
|
||||||
public boolean canBreakNeigbbors(BlockState blockState);
|
public boolean canBreakNeighbors(BlockState blockState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get list of blocks that belong together
|
* get list of blocks that belong together
|
||||||
|
@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
|
|||||||
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.IdentifierGroup;
|
import de.jottyfan.minecraft.quickiefabric.tools.externalmods.IdentifierGroup;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.LeavesBlock;
|
||||||
import net.minecraft.item.AxeItem;
|
import net.minecraft.item.AxeItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
@ -26,7 +27,7 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HarvestRange getRange() {
|
public HarvestRange getRange() {
|
||||||
return null; // no limit
|
return new HarvestRange(64, 128, 64); // trees bigger than that are too heavy for one small axe...
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,7 +36,7 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBreakNeigbbors(BlockState blockIn) {
|
public boolean canBreakNeighbors(BlockState blockIn) {
|
||||||
return getBlockList(blockIn.getBlock()) != null;
|
return getBlockList(blockIn.getBlock()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,9 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block instanceof LeavesBlock) {
|
||||||
|
return Lists.newArrayList(block);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBreakNeigbbors(BlockState blockIn) {
|
public boolean canBreakNeighbors(BlockState blockIn) {
|
||||||
return super.isEffectiveOn(blockIn) || PICKAXE_EFFECTIVE_ON.contains(blockIn.getBlock());
|
return super.isEffectiveOn(blockIn) || PICKAXE_EFFECTIVE_ON.contains(blockIn.getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBreakNeigbbors(BlockState blockState) {
|
public boolean canBreakNeighbors(BlockState blockState) {
|
||||||
boolean result = SHOVEL_EFFECTIVE_ON.contains(blockState.getBlock()) || checkExternalBlock(blockState.getBlock());
|
boolean result = SHOVEL_EFFECTIVE_ON.contains(blockState.getBlock()) || checkExternalBlock(blockState.getBlock());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
if (!blockState.isAir()) {
|
if (!blockState.isAir()) {
|
||||||
|
@ -39,7 +39,7 @@ public class Byg extends Identifier {
|
|||||||
* create from groups
|
* create from groups
|
||||||
*
|
*
|
||||||
* @param groups the groups
|
* @param groups the groups
|
||||||
* @return the list of indentifier groups
|
* @return the set of indentifier groups
|
||||||
*/
|
*/
|
||||||
public static final Set<IdentifierGroup> createFromGroups(IdentifierGroup... groups) {
|
public static final Set<IdentifierGroup> createFromGroups(IdentifierGroup... groups) {
|
||||||
Set<IdentifierGroup> set = new HashSet<>();
|
Set<IdentifierGroup> set = new HashSet<>();
|
||||||
@ -49,4 +49,18 @@ public class Byg extends Identifier {
|
|||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create from set
|
||||||
|
*
|
||||||
|
* @param set the set
|
||||||
|
* @return the set of idenfifier groups
|
||||||
|
*/
|
||||||
|
public static final Set<IdentifierGroup> createFromSet(Set<IdentifierGroup> set){
|
||||||
|
for (IdentifierGroup group : set)
|
||||||
|
{
|
||||||
|
group.setModId("byg");
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package de.jottyfan.minecraft.quickiefabric.tools.externalmods;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IdentifierGroups {
|
||||||
|
|
||||||
|
private final Set<IdentifierGroup> groups;
|
||||||
|
private final String[] prefixes;
|
||||||
|
|
||||||
|
public IdentifierGroups(String... prefixes) {
|
||||||
|
this.prefixes = prefixes;
|
||||||
|
groups = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillGroups(String... suffixes) {
|
||||||
|
for (String prefix : prefixes) {
|
||||||
|
groups.add(new IdentifierGroup(prefix, suffixes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<IdentifierGroup> getGroups(String... suffixes){
|
||||||
|
fillGroups(suffixes);
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
}
|
@ -49,4 +49,20 @@ public class Terrestria extends Identifier {
|
|||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create from set
|
||||||
|
*
|
||||||
|
* @param set the set
|
||||||
|
* @return the set of idenfifier groups
|
||||||
|
*/
|
||||||
|
public static final Set<IdentifierGroup> createFromSet(Set<IdentifierGroup> set){
|
||||||
|
for (IdentifierGroup group : set)
|
||||||
|
{
|
||||||
|
group.setModId("terrestria");
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user