added support for byg and terrestial on speed powder shovel
This commit is contained in:
parent
f23d45eacf
commit
9cee2b9ec5
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.8.8+build.202
|
loader_version=0.8.8+build.202
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.16.1.4
|
mod_version = 1.16.1.5
|
||||||
maven_group = de.jottyfan.minecraft
|
maven_group = de.jottyfan.minecraft
|
||||||
archives_base_name = quickiefabric
|
archives_base_name = quickiefabric
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ public interface ToolRangeable {
|
|||||||
.newHashSet(new Block[] { Blocks.GRAVEL, Blocks.SAND, Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.CLAY,
|
.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 });
|
Blocks.FARMLAND, Blocks.GRASS_PATH, Blocks.RED_SAND, Blocks.SOUL_SAND });
|
||||||
|
|
||||||
public static final Set<String> SHOVEL_EXTERNAL_EFFECTIVE_ON = Sets.newHashSet("byg:black_sand", "byg:white_sand");
|
public static final Set<String> SHOVEL_EXTERNAL_EFFECTIVE_ON = Sets.newHashSet("byg:black_sand", "byg:white_sand",
|
||||||
|
"byg:peat", "byg:meadow_dirt", "byg:mud_block", "byg:blue_sand", "byg:purple_sand", "terrestria:basalt_sand");
|
||||||
|
|
||||||
public static final List<List<Block>> AXE_EFFECTIVE_ON = 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.ACACIA_LOG, Blocks.STRIPPED_ACACIA_LOG, Blocks.ACACIA_WOOD, Blocks.STRIPPED_ACACIA_WOOD),
|
||||||
|
@ -2,6 +2,9 @@ package de.jottyfan.minecraft.quickiefabric.tools;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||||
@ -19,7 +22,7 @@ import net.minecraft.util.registry.Registry;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
|
public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(ToolSpeedpowderShovel.class);
|
||||||
public HarvestRange range;
|
public HarvestRange range;
|
||||||
|
|
||||||
public ToolSpeedpowderShovel() {
|
public ToolSpeedpowderShovel() {
|
||||||
@ -33,17 +36,22 @@ public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBreakNeigbbors(BlockState blockIn) {
|
public boolean canBreakNeigbbors(BlockState blockState) {
|
||||||
return SHOVEL_EFFECTIVE_ON.contains(blockIn.getBlock()) || checkExternalBlock(blockIn.getBlock());
|
boolean result = SHOVEL_EFFECTIVE_ON.contains(blockState.getBlock()) || checkExternalBlock(blockState.getBlock());
|
||||||
|
if (!result) {
|
||||||
|
LOGGER.info("cannot break block {} with that speedpoweder shovel", Registry.BLOCK.getId(blockState.getBlock()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkExternalBlock(Block block) {
|
private boolean checkExternalBlock(Block block) {
|
||||||
|
boolean result = false;
|
||||||
for (String externalBlockName : SHOVEL_EXTERNAL_EFFECTIVE_ON) {
|
for (String externalBlockName : SHOVEL_EXTERNAL_EFFECTIVE_ON) {
|
||||||
Identifier id = new Identifier(externalBlockName);
|
Identifier id = new Identifier(externalBlockName);
|
||||||
Block registeredBlock = Registry.BLOCK.get(id); // may be null if mods are not available
|
Block registeredBlock = Registry.BLOCK.get(id); // may be null if mods are not available
|
||||||
return registeredBlock != null && registeredBlock.equals(block);
|
result = result || (registeredBlock != null && registeredBlock.equals(block));
|
||||||
}
|
}
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user