added quickiepowder shears

This commit is contained in:
Jottyfan
2025-06-20 23:17:35 +02:00
parent b9ae4bcd52
commit 7a9021790f
12 changed files with 142 additions and 5 deletions

View File

@ -9,7 +9,7 @@ yarn_mappings=1.21.6+build.1
loader_version=0.16.14 loader_version=0.16.14
# Mod Properties # Mod Properties
mod_version=1.21.6.0 mod_version=1.21.6.1
maven_group=de.jottyfan.quickiemod maven_group=de.jottyfan.quickiemod
archives_base_name=quickiemod archives_base_name=quickiemod

View File

@ -34,7 +34,7 @@ import net.minecraft.world.tick.OrderedTick;
*/ */
public class BlockMonsterhoarder extends Block { public class BlockMonsterhoarder extends Block {
private static final IntProperty SUCKRADIUS = IntProperty.of("suckradius", 1, 15); private static final IntProperty SUCKRADIUS = IntProperty.of("suckradius", 2, 20);
public BlockMonsterhoarder(Identifier identifier) { public BlockMonsterhoarder(Identifier identifier) {
super(AbstractBlock.Settings.create().hardness(2.5f).luminance(state -> state.get(BlockMonsterhoarder.SUCKRADIUS)) super(AbstractBlock.Settings.create().hardness(2.5f).luminance(state -> state.get(BlockMonsterhoarder.SUCKRADIUS))

View File

@ -39,6 +39,7 @@ public class ModIdentifiers {
public static final Identifier TOOL_QUICKIEPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderpickaxe"); public static final Identifier TOOL_QUICKIEPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderpickaxe");
public static final Identifier TOOL_QUICKIEPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "quickiepowdershovel"); public static final Identifier TOOL_QUICKIEPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "quickiepowdershovel");
public static final Identifier TOOL_QUICKIEPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderwaterhoe"); public static final Identifier TOOL_QUICKIEPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderwaterhoe");
public static final Identifier TOOL_QUICKIEPOWDERSHEARS = Identifier.of(Quickiemod.MOD_ID, "quickiepowdershears");
public static final Identifier BLOCK_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockquickiepowder"); public static final Identifier BLOCK_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockquickiepowder");
public static final Identifier BLOCK_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockspeedpowder"); public static final Identifier BLOCK_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockspeedpowder");

View File

@ -75,6 +75,8 @@ public class ModItems {
new ToolQuickiepowderShovel(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL)); new ToolQuickiepowderShovel(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL));
public static final Item TOOL_QUICKIEPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE, public static final Item TOOL_QUICKIEPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE,
new ToolQuickiepowderWaterHoe(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE)); new ToolQuickiepowderWaterHoe(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE));
public static final Item TOOL_QUICKIEPOWDERSHEARS = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERSHEARS,
new ToolSpeedpowderShears(ModIdentifiers.TOOL_QUICKIEPOWDERSHEARS));
private static final Item registerItem(Identifier identifier, Item item) { private static final Item registerItem(Identifier identifier, Item item) {
return Registry.register(Registries.ITEM, identifier, item); return Registry.register(Registries.ITEM, identifier, item);
@ -112,6 +114,7 @@ public class ModItems {
items.add(TOOL_QUICKIEPOWDERSHOVEL); items.add(TOOL_QUICKIEPOWDERSHOVEL);
items.add(TOOL_QUICKIEPOWDERHOE); items.add(TOOL_QUICKIEPOWDERHOE);
items.add(TOOL_QUICKIEPOWDERWATERHOE); items.add(TOOL_QUICKIEPOWDERWATERHOE);
items.add(TOOL_QUICKIEPOWDERSHEARS);
return items; return items;
} }
} }

View File

@ -0,0 +1,102 @@
package de.jottyfan.quickiemod.item;
import java.util.Random;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.ChickenEntity;
import net.minecraft.entity.passive.CowEntity;
import net.minecraft.entity.passive.HorseEntity;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.ShearsItem;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
/**
*
* @author jotty
*
*/
public class ToolQuickiepowderShears extends ShearsItem {
public ToolQuickiepowderShears(Identifier identifier) {
super(new Item.Settings().component(DataComponentTypes.TOOL, ShearsItem.createToolComponent()).useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)));
}
@Override
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
Vec3d pos = entity.getPos();
Integer amount = 3 + new Random().nextInt(4);
if (entity instanceof SheepEntity) {
SheepEntity sheep = (SheepEntity) entity;
if (sheep.isShearable()) {
sheep.setSheared(true);
sheep.playAmbientSound();
DyeColor color = sheep.getColor();
Item item = Items.WHITE_WOOL;
if (color.equals(DyeColor.BLACK)) {
item = Items.BLACK_WOOL;
} else if (color.equals(DyeColor.GRAY)) {
item = Items.GRAY_WOOL;
} else if (color.equals(DyeColor.LIGHT_GRAY)) {
item = Items.LIGHT_GRAY_WOOL;
} else if (color.equals(DyeColor.BROWN)) {
item = Items.BROWN_WOOL;
} else if (color.equals(DyeColor.BLUE)) {
item = Items.BLUE_WOOL;
} else if (color.equals(DyeColor.LIGHT_BLUE)) {
item = Items.LIGHT_BLUE_WOOL;
} else if (color.equals(DyeColor.GREEN)) {
item = Items.GREEN_WOOL;
} else if (color.equals(DyeColor.LIME)) {
item = Items.LIME_WOOL;
} else if (color.equals(DyeColor.CYAN)) {
item = Items.CYAN_WOOL;
} else if (color.equals(DyeColor.MAGENTA)) {
item = Items.MAGENTA_WOOL;
} else if (color.equals(DyeColor.ORANGE)) {
item = Items.ORANGE_WOOL;
} else if (color.equals(DyeColor.PINK)) {
item = Items.PINK_WOOL;
} else if (color.equals(DyeColor.PURPLE)) {
item = Items.PURPLE_WOOL;
} else if (color.equals(DyeColor.RED)) {
item = Items.RED_WOOL;
} else if (color.equals(DyeColor.YELLOW)) {
item = Items.YELLOW_WOOL;
}
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(item, amount)));
return ActionResult.SUCCESS;
}
} else if (entity instanceof HorseEntity) {
HorseEntity horse = (HorseEntity) entity;
horse.playAmbientSound();
horse.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS;
} else if (entity instanceof CowEntity) {
CowEntity cow = (CowEntity) entity;
cow.playAmbientSound();
cow.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS;
} else if (entity instanceof ChickenEntity) {
ChickenEntity chicken = (ChickenEntity) entity;
chicken.playAmbientSound();
chicken.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount)));
return ActionResult.SUCCESS;
}
return ActionResult.PASS;
}
}

View File

@ -36,7 +36,7 @@ public class ToolSpeedpowderShears extends ShearsItem {
@Override @Override
public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) {
Vec3d pos = entity.getPos(); Vec3d pos = entity.getPos();
Integer amount = 3 + new Random().nextInt(4); Integer amount = 1 + new Random().nextInt(4);
if (entity instanceof SheepEntity) { if (entity instanceof SheepEntity) {
SheepEntity sheep = (SheepEntity) entity; SheepEntity sheep = (SheepEntity) entity;
if (sheep.isShearable()) { if (sheep.isShearable()) {
@ -81,16 +81,19 @@ public class ToolSpeedpowderShears extends ShearsItem {
} else if (entity instanceof HorseEntity) { } else if (entity instanceof HorseEntity) {
HorseEntity horse = (HorseEntity) entity; HorseEntity horse = (HorseEntity) entity;
horse.playAmbientSound(); horse.playAmbientSound();
horse.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} else if (entity instanceof CowEntity) { } else if (entity instanceof CowEntity) {
CowEntity cow = (CowEntity) entity; CowEntity cow = (CowEntity) entity;
cow.playAmbientSound(); cow.playAmbientSound();
cow.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount)));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} else if (entity instanceof ChickenEntity) { } else if (entity instanceof ChickenEntity) {
ChickenEntity cow = (ChickenEntity) entity; ChickenEntity chicken = (ChickenEntity) entity;
cow.playAmbientSound(); chicken.playAmbientSound();
chicken.setBaby(true);
user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount))); user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount)));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }

View File

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

View File

@ -13,6 +13,7 @@
"item.quickiemod.quickiepowdershovel": "Eilpulverschaufel", "item.quickiemod.quickiepowdershovel": "Eilpulverschaufel",
"item.quickiemod.quickiepowderhoe": "Eilpulverfeldhacke", "item.quickiemod.quickiepowderhoe": "Eilpulverfeldhacke",
"item.quickiemod.quickiepowderwaterhoe": "bewässerte Eilpulverfeldhacke", "item.quickiemod.quickiepowderwaterhoe": "bewässerte Eilpulverfeldhacke",
"item.quickiemod.quickiepowdershears": "Eilpulverschere",
"item.quickiemod.sulphor": "Schwefel", "item.quickiemod.sulphor": "Schwefel",
"item.quickiemod.salpeter": "Salpeter", "item.quickiemod.salpeter": "Salpeter",
"item.quickiemod.construction0": "leerer Bauplan", "item.quickiemod.construction0": "leerer Bauplan",

View File

@ -13,6 +13,7 @@
"item.quickiemod.quickiepowdershovel": "hurrypowder shovel", "item.quickiemod.quickiepowdershovel": "hurrypowder shovel",
"item.quickiemod.quickiepowderhoe": "hurrypowder hoe", "item.quickiemod.quickiepowderhoe": "hurrypowder hoe",
"item.quickiemod.quickiepowderwaterhoe": "watered hurrypowder hoe", "item.quickiemod.quickiepowderwaterhoe": "watered hurrypowder hoe",
"item.quickiemod.quickiepowdershears": "hurrypowder shears",
"item.quickiemod.sulphor": "sulfur", "item.quickiemod.sulphor": "sulfur",
"item.quickiemod.salpeter": "salpeter", "item.quickiemod.salpeter": "salpeter",
"item.quickiemod.construction0": "empty building plan", "item.quickiemod.construction0": "empty building plan",

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "quickiemod:item/quickiepowdershears"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shaped",
"category": "tools",
"pattern": [
" #",
"# "
],
"key": {
"#": "quickiemod:quickieingot"
},
"result": {
"id": "quickiemod:quickiepowdershears"
}
}