Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

import com.github.ethanicuss.astraladditions.registry.ModEntities;
import com.github.ethanicuss.astraladditions.entities.scrap_projectile.ScrapProjectileEntity;
import com.github.ethanicuss.astraladditions.registry.ModItems;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BowItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.RangedWeaponItem;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.tag.ItemTags;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;

import java.util.function.Predicate;

public class ShotgunItem extends BowItem {

public ShotgunItem(Settings settings) {
Expand All @@ -26,13 +31,26 @@ public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int
if (!(user instanceof PlayerEntity playerEntity)) {
return;
}
boolean bl2;
boolean bl = playerEntity.getAbilities().creativeMode;
ItemStack itemStack = playerEntity.getArrowType(stack);//change
boolean bl3 = bl2 = bl && itemStack.isOf(Items.ARROW);
boolean bl2 = false;
boolean isCreative = playerEntity.getAbilities().creativeMode;

Predicate<ItemStack> predicate = (ammoStack) -> ammoStack.isOf(ModItems.SPUD_MAG);

PlayerEntity p = (PlayerEntity) user;

ItemStack itemStack = stack;//set to stack just to init

for(int i = 0; i < p.getInventory().size(); ++i) {
ItemStack itemStack2 = p.getInventory().getStack(i);
if (predicate.test(itemStack2)) {
bl2 = true;
itemStack = itemStack2;
}
}

float f = getPullProgress(this.getMaxUseTime(stack) - remainingUseTicks);

if (!world.isClient && !itemStack.isEmpty()) {
if (!world.isClient && (isCreative || bl2)) {
int k;
int j;
for (var i = 0; i < 15; i++) {
Expand All @@ -41,12 +59,10 @@ public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int
proj.setVelocity(playerEntity, playerEntity.getPitch(), playerEntity.getYaw(), 1.0f, 1.5f + f-1, 12f);
world.spawnEntity(proj);
}
stack.damage(1, playerEntity, p -> p.sendToolBreakStatus(playerEntity.getActiveHand()));
}
if (!itemStack.isEmpty() || bl) {
stack.damage(1, playerEntity, p2 -> p2.sendToolBreakStatus(playerEntity.getActiveHand()));
world.playSound(null, playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.PLAYERS, 0.8f, 0.5f / (world.getRandom().nextFloat() * 0.4f + 1.2f) + 0.3f);
}
if (!bl2 && !bl) {
if (bl2 && !isCreative) {
itemStack.decrement(1);
if (itemStack.isEmpty()) {
playerEntity.getInventory().removeOne(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public class ModItems {
//public static final Item SHIMMER_BOTTLE = new ShimmerBottleItem(new FabricItemSettings().group(ItemGroup.BREWING).maxCount(1));
public static final Item SHIMMER_BOTTLE = new ShimmerBottleItem(StatusEffects.NIGHT_VISION, 3600, 0, new TranslatableText("Multiplies XP gain by 1.5 (3:00)").formatted(Formatting.BLUE), new FabricItemSettings().group(ItemGroup.BREWING).maxCount(1).rarity(Rarity.UNCOMMON));
public static final Item CHROMATIC_VACUUM = new ChromaticVacuumItem(new FabricItemSettings().group(ItemGroup.TOOLS).maxCount(1).maxDamage(512));
public static final Item SHOTGUN = new ShotgunItem(new FabricItemSettings().group(ItemGroup.TOOLS).maxCount(1).maxDamage(512));
public static final Item MACHINEGUN = new MachinegunItem(new FabricItemSettings().group(ItemGroup.TOOLS).maxCount(1).maxDamage(1024));
public static final Item SPUDSHOTGUN = new ShotgunItem(new FabricItemSettings().group(ItemGroup.COMBAT).maxCount(1).maxDamage(512));
public static final Item SPUD_MAG = new Item(new FabricItemSettings().group(ItemGroup.COMBAT));
public static final Item MACHINEGUN = new MachinegunItem(new FabricItemSettings().group(ItemGroup.COMBAT).maxCount(1).maxDamage(1024));
public static final Item BETA_IRON_SWORD = new BetaSwordItem(new FabricItemSettings().group(ItemGroup.COMBAT).maxCount(1).rarity(Rarity.COMMON).maxDamage(250), 4);
public static final Item BETA_DIAMOND_SWORD = new BetaSwordItem(new FabricItemSettings().group(ItemGroup.COMBAT).maxCount(1).rarity(Rarity.COMMON).maxDamage(1561), 5);
public static final Item BETA_DESH_SWORD = new BetaSwordItem(new FabricItemSettings().group(ItemGroup.COMBAT).maxCount(1).rarity(Rarity.UNCOMMON).maxDamage(1024), 5);
Expand Down Expand Up @@ -110,7 +111,8 @@ public static void registerItems() {
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "shimmer_bottle"), SHIMMER_BOTTLE);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "chromatic_vacuum"), CHROMATIC_VACUUM);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "machinegun"), MACHINEGUN);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "shotgun"), SHOTGUN);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "spudshotgun"), SPUDSHOTGUN);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "spud_mag"), SPUD_MAG);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "astral_hoe"), ASTRAL_HOE);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "soulsteal_dagger"), SOULSTEAL_DAGGER);
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "diamond_boomer"), DIAMOND_BOOMER);
Expand Down
22 changes: 12 additions & 10 deletions src/main/resources/assets/astraladditions/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,25 @@
"item.astraladditions.beta_ostrum_weapon": "Beta Ostrum Sword",
"item.astraladditions.beta_calorite_weapon": "Beta Calorite Sword",
"item.astraladditions.beta_ender_weapon": "Beta Ender Sword",
"item.astraladditions.spudshotgun": "Spud Shotgun",
"item.astraladditions.spud_mag": "Spud Magazine",

"item.astraladditions.shimmer_fishing_rod": "Shimmer Fishing Rod",
"item.astraladditions.shimmering_thread": "Shimmering Thread",
"item.astraladditions.shimmer_trout": "Shimmer Trout",
"item.astraladditions.shish": "Shish",
"item.astraladditions.bottomless_water_bucket": "Bottomless Water Bucket",

"item.minecraft.potion.effect.shimmer": "Bottle of Shimmer",
"item.minecraft.splash_potion.effect.shimmer": "Splash Bottle of Shimmer",
"item.minecraft.lingering_potion.effect.shimmer": "Lingering Bottle of Shimmer",
"item.minecraft.tipped_arrow.effect.shimmer": "Arrow of Shimmer",

"item.minecraft.potion.effect.sputum": "Bottle of Sputum",
"item.minecraft.splash_potion.effect.sputum": "Splash Bottle of Sputum",
"item.minecraft.lingering_potion.effect.sputum": "Lingering Bottle of Sputum",
"item.minecraft.tipped_arrow.effect.sputum": "Arrow of Sputum",

"block.astraladditions.enderrack": "Enderrack",
"block.astraladditions.twisted_nylium": "Twisted Nylium",
"block.astraladditions.ender_sprouts": "Ender Sprouts",
Expand Down Expand Up @@ -130,16 +142,6 @@
"effect.astraladditions.parry": "Parry",
"effect.astraladditions.frost": "Frost",

"item.minecraft.potion.effect.shimmer": "Bottle of Shimmer",
"item.minecraft.splash_potion.effect.shimmer": "Splash Bottle of Shimmer",
"item.minecraft.lingering_potion.effect.shimmer": "Lingering Bottle of Shimmer",
"item.minecraft.tipped_arrow.effect.shimmer": "Arrow of Shimmer",

"item.minecraft.potion.effect.sputum": "Bottle of Sputum",
"item.minecraft.splash_potion.effect.sputum": "Splash Bottle of Sputum",
"item.minecraft.lingering_potion.effect.sputum": "Lingering Bottle of Sputum",
"item.minecraft.tipped_arrow.effect.sputum": "Arrow of Sputum",

"tooltip.astraladditions.cogfly": "W.I.P for 2.2",
"tooltip.astraladditions.beta_sword_smell": "It smells like thick fog",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "astraladditions:item/spud_mag"
}
}
Loading
Loading