glock stuff

This commit is contained in:
Sunskimmer822 2022-07-18 17:02:38 -07:00
parent 49a6c22003
commit 2274852c9b
5 changed files with 11 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolItem;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.registry.Registry;
@ -116,6 +117,8 @@ public class Shitmod implements ModInitializer {
public static final ToolItem COPPER_HOE = new copperHoe(copperMaterial.INSTANCE, -3, -1f, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(250));
public static final Item GLOCK = new glock(new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(1000));
public static final SoundEvent GLOCK_NOISE = new SoundEvent(new Identifier("shitmod:glock"));
@Override
public void onInitialize() {
@ -202,5 +205,7 @@ public class Shitmod implements ModInitializer {
Registry.register(Registry.ITEM, new Identifier("shitmod", "copper_hoe"), COPPER_HOE);
Registry.register(Registry.ITEM, new Identifier("shitmod", "glock"), GLOCK);
Registry.register(Registry.SOUND_EVENT, new Identifier("shitmod", "glock_noise"), GLOCK_NOISE);
}
}

View File

@ -5,6 +5,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ArrowEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
@ -19,7 +20,9 @@ public class glock extends Item{
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
ArrowEntity arro = new ArrowEntity(world, playerEntity.getX(), playerEntity.getEyeY(), playerEntity.getZ());
arro.setVelocity(playerEntity, playerEntity.getPitch(), playerEntity.getHeadYaw(), 0f, 100, 0);
arro.setOwner(playerEntity);
world.spawnEntity(arro);
world.playSound(playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), Shitmod.GLOCK_NOISE, SoundCategory.PLAYERS, 1f, 1f, true);
playerEntity.getMainHandStack().damage(1,playerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, playerEntity.getStackInHand(hand));
}

View File

@ -41,5 +41,6 @@
"item.shitmod.copper_hoe": "Copper Hoe",
"itemGroup.shitmod.general": "Shitmod Misc",
"itemGroup.shitmod.tools": "Shitmod Tools",
"item.shitmod.glock": "Glock"
"item.shitmod.glock": "Glock",
"subtitles.shitmod.glock": "Glock Fires"
}

View File

@ -1,5 +1,5 @@
{
"glock": {
"glocknoise": {
"subtitle": "subtitles.shitmod.glock",
"shitmod": [
"shitmod:glock"