2 Commits

Author SHA1 Message Date
06db4df2cb version 1.21.4 2024-12-04 00:55:58 +01:00
0c744ef52b fixed bug on using rangeable tools 2024-12-01 00:05:36 +01:00
62 changed files with 373 additions and 38 deletions

View File

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.8-SNAPSHOT' id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

View File

@ -4,14 +4,14 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.21.3 minecraft_version=1.21.4
yarn_mappings=1.21.3+build.2 yarn_mappings=1.21.4+build.1
loader_version=0.16.9 loader_version=0.16.9
# Mod Properties # Mod Properties
mod_version=1.21.3.1 mod_version=1.21.4.0
maven_group=de.jottyfan.quickiemod maven_group=de.jottyfan.quickiemod
archives_base_name=quickiemod archives_base_name=quickiemod
# Dependencies # Dependencies
fabric_version=0.108.0+1.21.3 fabric_version=0.110.5+1.21.4

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -3,6 +3,7 @@ package de.jottyfan.quickiemod.event;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.jottyfan.quickiemod.Quickiemod;
import de.jottyfan.quickiemod.item.HarvestRange; import de.jottyfan.quickiemod.item.HarvestRange;
import de.jottyfan.quickiemod.item.ModItems; import de.jottyfan.quickiemod.item.ModItems;
import de.jottyfan.quickiemod.item.ToolRangeable; import de.jottyfan.quickiemod.item.ToolRangeable;
@ -63,34 +64,40 @@ public class EventBlockBreak {
BlockPos pos, PlayerEntity player) { BlockPos pos, PlayerEntity player) {
List<Block> validBlocks = tool.getBlockList(currentBlock); List<Block> validBlocks = tool.getBlockList(currentBlock);
HarvestRange range = tool.getRange(itemStack); HarvestRange range = tool.getRange(itemStack);
if (tool instanceof Item) {
Item toolItem = (Item) tool; // a rangeable tool should always be an item
List<String> visitedBlocks = new ArrayList<>(); List<String> visitedBlocks = new ArrayList<>();
if (tool instanceof ToolSpeedpowderAxe) { if (tool instanceof ToolSpeedpowderAxe) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
player, true); player, true);
} else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(tool.getName())) { } else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(tool.getName())) { } else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(tool.getName())) { } else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(tool.getName())) { } else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
player, true); player, true);
} else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(tool.getName())) { } else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(tool.getName())) { } else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(tool.getName())) { } else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(toolItem.getName())) {
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false); player, false);
} else { } else {
return 0; return 0;
} }
} else {
Quickiemod.LOGGER.warn("using a tool that is not an item - no rangeable operations are possible.");
return 0;
}
} }
/** /**

View File

@ -5,7 +5,6 @@ import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
/** /**
* *
@ -14,13 +13,6 @@ import net.minecraft.text.Text;
*/ */
public interface ToolRangeable { public interface ToolRangeable {
/**
* dummy to have a getName method that comes with the item
*
* @return the name
*/
public Text getName();
/** /**
* @param stack the item stack that keeps the range * @param stack the item stack that keeps the range
* @return range of blocks to be harvested * @return range of blocks to be harvested

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/blockquickiepowder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blocksalpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockspeedpowder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackerdown"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackereast"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackernorth"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackersouth"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackerup"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blockstackerwest"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/blocksulphor"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/canola"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/canolabottle"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/canolabottlestack"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/canolaseed"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/canolaseed"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/carrotstack"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/cotton"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/cottonseed"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/cottonseed"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/dirtsalpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/drill"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/drilleast"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/drillnorth"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/drillsouth"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/drillwest"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/emptylavahoarder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/itemhoarder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/kelpstack"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/lavahoarder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/monsterhoarder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/oredeepslatesulphor"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/orenethersulphor"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/oresalpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/oresandsalpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/oresulphor"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/oxidizedcopperpowder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickieingot"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowderaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowderhoe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowderpickaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowdershovel"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/quickiepowderwaterhoe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/rotten_flesh_stripes"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/salpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:block/sandsalpeter"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedingot"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowder"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowderaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowderhoe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowderpickaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowdershears"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowdershovel"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/speedpowderwaterhoe"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/stub"
}
}

View File

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "quickiemod:item/sulphor"
}
}

View File

@ -29,7 +29,7 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.16.9", "fabricloader": ">=0.16.9",
"minecraft": "~1.21.3", "minecraft": "~1.21.4",
"java": ">=21", "java": ">=21",
"fabric-api": "*" "fabric-api": "*"
}, },