added quickiepowder pickaxe, axe and shovel

This commit is contained in:
Jottyfan 2023-11-25 23:13:14 +01:00
parent 69f5b0a504
commit a0252d4608
34 changed files with 422 additions and 6 deletions

View File

@ -9,7 +9,7 @@ yarn_mappings=1.20.3-pre2+build.5
loader_version=0.14.24
# Mod Properties
mod_version = 1.20.3.1
mod_version = 1.20.3.2
maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric

View File

@ -0,0 +1,42 @@
package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import com.mojang.serialization.MapCodec;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContextParameterSet.Builder;
import net.minecraft.world.explosion.Explosion;
/**
*
* @author jotty
*
*/
public class BlockQuickiepowder extends FallingBlock {
public BlockQuickiepowder() {
super(FabricBlockSettings.create().luminance(state -> 12));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
return Arrays.asList(new ItemStack[] { new ItemStack(QuickieItems.QUICKIEPOWDER, 9) });
}
@Override
public boolean shouldDropItemsOnExplosion(Explosion explosion) {
return true;
}
@Override
protected MapCodec<? extends FallingBlock> getCodec() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -34,5 +34,6 @@ public class QuickieBlocks {
public static final BlockStackerNorth BLOCKSTACKERNORTH = new BlockStackerNorth();
public static final BlockStackerSouth BLOCKSTACKERSOUTH = new BlockStackerSouth();
public static final BlockSpreader BLOCKSPREADER = new BlockSpreader();
public static final BlockSpeedpowder BLOCKSPEEDPOWDER = new BlockSpeedpowder();;
public static final BlockSpeedpowder BLOCKSPEEDPOWDER = new BlockSpeedpowder();
public static final BlockQuickiepowder BLOCKQUICKIEPOWDER = new BlockQuickiepowder();
}

View File

@ -72,6 +72,15 @@ public class EventBlockBreak {
} else if (QuickieTools.SPEEDPOWDERHOE.equals(tool)) {
return breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (QuickieTools.QUICKIEPOWDERAXE.equals(tool)) {
return breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
player, true);
} else if (QuickieTools.QUICKIEPOWDERPICKAXE.equals(tool)) {
return breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else if (QuickieTools.QUICKIEPOWDERSHOVEL.equals(tool)) {
return breakBlockRecursive(new ArrayList<>(), world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
player, false);
} else {
return 0;
}

View File

@ -107,6 +107,9 @@ public class RegistryManager {
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERSHOVEL));
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERHOE));
stacks.add(new ItemStack(QuickieTools.SPEEDPOWDERWATERHOE));
stacks.add(new ItemStack(QuickieTools.QUICKIEPOWDERAXE));
stacks.add(new ItemStack(QuickieTools.QUICKIEPOWDERPICKAXE));
stacks.add(new ItemStack(QuickieTools.QUICKIEPOWDERSHOVEL));
stacks.add(new ItemStack(QuickieBlocks.DIRT_SALPETER));
stacks.add(new ItemStack(QuickieBlocks.ORE_NETHER_SULPHOR));
stacks.add(new ItemStack(QuickieBlocks.ORE_SALPETER));
@ -122,6 +125,7 @@ public class RegistryManager {
stacks.add(new ItemStack(QuickieBlocks.BLOCKSULPHOR));
stacks.add(new ItemStack(QuickieBlocks.BLOCKSALPETER));
stacks.add(new ItemStack(QuickieBlocks.BLOCKSPEEDPOWDER));
stacks.add(new ItemStack(QuickieBlocks.BLOCKQUICKIEPOWDER));
stacks.add(new ItemStack(QuickieBlocks.DRILL_DOWN));
stacks.add(new ItemStack(QuickieBlocks.DRILL_EAST));
stacks.add(new ItemStack(QuickieBlocks.DRILL_SOUTH));
@ -202,6 +206,7 @@ public class RegistryManager {
registerBlock(QuickieBlocks.BLOCKSULPHOR, "blocksulphor");
registerBlock(QuickieBlocks.BLOCKSALPETER, "blocksalpeter");
registerBlock(QuickieBlocks.BLOCKSPEEDPOWDER, "blockspeedpowder");
registerBlock(QuickieBlocks.BLOCKQUICKIEPOWDER, "blockquickiepowder");
registerBlock(QuickieBlocks.DRILL_DOWN, "drill");
registerBlock(QuickieBlocks.DRILL_EAST, "drilleast");
registerBlock(QuickieBlocks.DRILL_SOUTH, "drillsouth");
@ -263,6 +268,9 @@ public class RegistryManager {
registerItem(QuickieTools.SPEEDPOWDERSHOVEL, "speedpowdershovel");
registerItem(QuickieTools.SPEEDPOWDERHOE, "speedpowderhoe");
registerItem(QuickieTools.SPEEDPOWDERWATERHOE, "speedpowderwaterhoe");
registerItem(QuickieTools.QUICKIEPOWDERAXE, "quickiepowderaxe");
registerItem(QuickieTools.QUICKIEPOWDERPICKAXE, "quickiepowderpickaxe");
registerItem(QuickieTools.QUICKIEPOWDERSHOVEL, "quickiepowdershovel");
}
public static final void registerContainer() {

View File

@ -11,4 +11,7 @@ public class QuickieTools {
public static final ToolSpeedpowderShovel SPEEDPOWDERSHOVEL = new ToolSpeedpowderShovel();
public static final ToolSpeedpowderHoe SPEEDPOWDERHOE = new ToolSpeedpowderHoe();
public static final ToolSpeedpowderWaterHoe SPEEDPOWDERWATERHOE = new ToolSpeedpowderWaterHoe();
public static final ToolQuickiepowderAxe QUICKIEPOWDERAXE = new ToolQuickiepowderAxe();
public static final ToolQuickiepowderPickaxe QUICKIEPOWDERPICKAXE = new ToolQuickiepowderPickaxe();
public static final ToolQuickiepowderShovel QUICKIEPOWDERSHOVEL = new ToolQuickiepowderShovel();
}

View File

@ -0,0 +1,23 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderAxe extends ToolRangeableAxe {
public ToolQuickiepowderAxe() {
super(ToolMaterials.DIAMOND, 5, 2.0f, new FabricItemSettings());
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(64, 128, 64); // trees bigger than that are too heavy for one small axe...
}
}

View File

@ -0,0 +1,71 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.List;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
import net.minecraft.nbt.NbtCompound;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderPickaxe extends PickaxeItem implements ToolRangeable {
public static final int[] DEFAULT_HARVEST_RANGE = new int[] { 6, 6, 6 };
public ToolQuickiepowderPickaxe() {
super(ToolMaterials.DIAMOND, 5, 2.0f, new FabricItemSettings());
}
@Override
public HarvestRange getRange(ItemStack stack) {
NbtCompound tag = stack.getNbt();
int[] range = tag.getIntArray("range");
if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE;
tag.putIntArray("range", range);
}
return new HarvestRange(range);
}
@Override
public boolean canBreakNeighbors(BlockState blockIn) {
return super.isSuitableFor(blockIn);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
public void setPlusRange(ItemStack stack, Integer plusRange) {
NbtCompound tag = stack.getNbt();
int[] range = tag.getIntArray("range");
if (range.length < 3) {
range = DEFAULT_HARVEST_RANGE;
}
HarvestRange harvestRange = new HarvestRange(range);
harvestRange.addXYZ(plusRange);
tag.putIntArray("range", harvestRange.getRangeAsArray());
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@ -0,0 +1,96 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.List;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterials;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderShovel extends ShovelItem implements ToolRangeable {
public static final Integer DEFAULT_HARVEST_RANGE = 6;
public HarvestRange range;
public ToolQuickiepowderShovel() {
super(ToolMaterials.DIAMOND, 5, 2.0f, new FabricItemSettings());
this.range = new HarvestRange(DEFAULT_HARVEST_RANGE);
}
private void createPathOnGrass(World world, BlockPos pos, Direction side) {
BlockState blockState = world.getBlockState(pos);
if (blockState.isAir()) {
// try to find one underneath
pos = pos.down();
blockState = world.getBlockState(pos);
} else if (!world.getBlockState(pos.up()).isAir()) {
pos = pos.up();
blockState = world.getBlockState(pos);
}
if (side != Direction.DOWN) {
BlockState blockState2 = (BlockState) PATH_STATES.get(blockState.getBlock());
if (blockState2 != null && world.getBlockState(pos.up()).isAir()) {
if (!world.isClient) {
world.setBlockState(pos, blockState2, 11);
}
}
}
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
BlockPos[] positions = new BlockPos[] { pos.north().north().west().west(), pos.north().north().west(),
pos.north().north(), pos.north().north().east(), pos.north().north().east().east(), pos.north().west().west(),
pos.north().west(), pos.north(), pos.north().east(), pos.north().east().east(), pos.west().west(), pos.west(),
pos, pos.east(), pos.east().east(), pos.south().west().west(), pos.south().west(), pos.south(),
pos.south().east(), pos.south().east().east(), pos.south().south().west().west(), pos.south().south().west(),
pos.south().south(), pos.south().south().east(), pos.south().south().east().east() };
for (BlockPos p : positions) {
createPathOnGrass(world, p, context.getSide());
}
return super.useOnBlock(context);
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get range from stack
return range;
}
@Override
public boolean canBreakNeighbors(BlockState blockState) {
return super.isSuitableFor(blockState);
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@ -27,7 +27,7 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(64, 128, 64); // trees bigger than that are too heavy for one small axe...
return new HarvestRange(16, 32, 16);
}
@Override

View File

@ -1,6 +1,7 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
/**
@ -13,4 +14,10 @@ public class ToolSpeedpowderAxe extends ToolRangeableAxe {
public ToolSpeedpowderAxe() {
super(ToolMaterials.DIAMOND, 4, 2.0f, new FabricItemSettings());
}
@Override
public HarvestRange getRange(ItemStack stack) {
// TODO: get the range from the stack
return new HarvestRange(32, 64, 32);
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiefabric:block/blockquickiepowder"
}
}
}

View File

@ -7,6 +7,9 @@
"item.quickiefabric.speedpowderwaterhoe": "bewässerte Fluchtpulverfeldhacke",
"item.quickiefabric.speedpowder": "Fluchtpulver",
"item.quickiefabric.quickiepowder": "Eilpulver",
"item.quickiefabric.quickiepowderaxe": "Eilpulveraxt",
"item.quickiefabric.quickiepowderpickaxe": "Eilpulverspitzhacke",
"item.quickiefabric.quickiepowdershovel": "Eilpulverschaufel",
"item.quickiefabric.sulphor": "Schwefel",
"item.quickiefabric.salpeter": "Salpeter",
"item.quickiefabric.construction0": "leerer Bauplan",
@ -60,6 +63,7 @@
"block.quickiefabric.blocksulphor": "Schwefelblock",
"block.quickiefabric.blocksalpeter": "Salpeterblock",
"block.quickiefabric.blockspeedpowder": "Fluchtpulverblock",
"block.quickiefabric.blockquickiepowder": "Eilpulverblock",
"block.quickiefabric.drill": "Bohrer",
"block.quickiefabric.drilleast": "Ost-Bohrer",
"block.quickiefabric.drillsouth": "Süd-Bohrer",

View File

@ -7,6 +7,9 @@
"item.quickiefabric.speedpowderwaterhoe": "watered speedpowder hoe",
"item.quickiefabric.speedpowder": "speedpowder",
"item.quickiefabric.quickiepowder": "hurrypowder",
"item.quickiefabric.quickiepowderaxe": "hurrypowder axe",
"item.quickiefabric.quickiepowderpickaxe": "hurrypowder pickaxe",
"item.quickiefabric.quickiepowdershovel": "hurrypowder shovel",
"item.quickiefabric.sulphor": "sulfur",
"item.quickiefabric.salpeter": "salpeter",
"item.quickiefabric.construction0": "empty building plan",
@ -60,6 +63,7 @@
"block.quickiefabric.blocksulphor": "block of sulfur",
"block.quickiefabric.blocksalpeter": "block of salpeter",
"block.quickiefabric.blockspeedpowder": "block of speedpowder",
"block.quickiefabric.blockquickiepowder": "block of hurrypowder",
"block.quickiefabric.drill": "drill",
"block.quickiefabric.drilleast": "east drill",
"block.quickiefabric.drillsouth": "south drill",

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiefabric:block/blockquickiepowder"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/blockquickiepowder",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/wooden_axe",
"textures": {
"layer0": "quickiefabric:item/quickiepowderaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/wooden_pickaxe",
"textures": {
"layer0": "quickiefabric:item/quickiepowderpickaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/wooden_shovel",
"textures": {
"layer0": "quickiefabric:item/quickiepowdershovel"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"quickiefabric:speedpowderaxe"
"quickiefabric:speedpowderaxe",
"quickiefabric:quickiepowderaxe"
]
}

View File

@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"quickiefabric:speedpowderpickaxe"
"quickiefabric:speedpowderpickaxe",
"quickiefabric:quickiepowderpickaxe"
]
}

View File

@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"quickiefabric:speedpowdershovel"
"quickiefabric:speedpowdershovel",
"quickiefabric:quickiepowdershovel"
]
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"sss",
"sss",
"sss"
],
"key": {
"s": {
"item": "quickiefabric:quickiepowder"
}
},
"result": {
"item": "quickiefabric:blockquickiepowder",
"count": 1
}
}

View File

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:slime_block"
},
{
"item": "quickiefabric:blockspeedpowder"
}
],
"result": {
"item": "quickiefabric:blockquickiepowder",
"count": 2
}
}

View File

@ -0,0 +1,12 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "quickiefabric:blockquickiepowder"
}
],
"result": {
"item": "quickiefabric:quickiepowder",
"count": 9
}
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ss",
"s|",
" |"
],
"key": {
"s": {
"item": "quickiefabric:quickiepowder"
},
"|": {
"item": "minecraft:stick"
}
},
"result": {
"item": "quickiefabric:quickiepowderaxe",
"count": 1
}
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"sss",
" | ",
" | "
],
"key": {
"s": {
"item": "quickiefabric:quickiepowder"
},
"|": {
"item": "minecraft:stick"
}
},
"result": {
"item": "quickiefabric:quickiepowderpickaxe",
"count": 1
}
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"s",
"|",
"|"
],
"key": {
"s": {
"item": "quickiefabric:quickiepowder"
},
"|": {
"item": "minecraft:stick"
}
},
"result": {
"item": "quickiefabric:quickiepowdershovel",
"count": 1
}
}