From c2260657bee052a518ac5cba0ef8acf8e499614b Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 01:59:13 -0700 Subject: [PATCH 1/9] snortable --- .../ballistics/BallisticsDataGenerator.java | 2 +- .../assets/ballistics/items/snortable.json | 12 ++ .../assets/ballistics/lang/en_us.json | 10 +- .../java/llevc/ballistics/Ballistics.java | 2 + src/main/java/llevc/ballistics/ModItems.java | 26 ++++ .../llevc/ballistics/effects/Explode.java | 27 ++++ .../ballistics/recipes/SnortableRecipe.java | 141 ++++++++++++++++++ .../recipes/SnortableRecipeSerializer.java | 40 +++++ .../data/ballistics/recipe/snortable.json | 4 + 9 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 src/client/resources/assets/ballistics/items/snortable.json create mode 100644 src/main/java/llevc/ballistics/effects/Explode.java create mode 100644 src/main/java/llevc/ballistics/recipes/SnortableRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java create mode 100644 src/main/resources/data/ballistics/recipe/snortable.json diff --git a/src/client/java/llevc/ballistics/BallisticsDataGenerator.java b/src/client/java/llevc/ballistics/BallisticsDataGenerator.java index d68ae11..523a672 100644 --- a/src/client/java/llevc/ballistics/BallisticsDataGenerator.java +++ b/src/client/java/llevc/ballistics/BallisticsDataGenerator.java @@ -6,6 +6,6 @@ public class BallisticsDataGenerator implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { - + FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); } } diff --git a/src/client/resources/assets/ballistics/items/snortable.json b/src/client/resources/assets/ballistics/items/snortable.json new file mode 100644 index 0000000..70400a4 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/snortable.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "minecraft:item/sugar", + "tints": [ + { + "type": "minecraft:dye", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/lang/en_us.json b/src/client/resources/assets/ballistics/lang/en_us.json index bdedd86..b276123 100644 --- a/src/client/resources/assets/ballistics/lang/en_us.json +++ b/src/client/resources/assets/ballistics/lang/en_us.json @@ -16,6 +16,12 @@ "item.minecraft.lingering_potion.effect.mixed": "Mixed Lingering Potion", "item.minecraft.tipped_arrow.effect.mixed": "Mixed Arrow", "item.ballistics.flask.effect.mixed": "Mixed Flask", + "effect.ballistics.explode": "Explode", + "item.minecraft.potion.effect.explode": "Exploding Potion", + "item.minecraft.splash_potion.effect.explode": "Exploding Splash Potion", + "item.minecraft.lingering_potion.effect.explode": "Exploding Lingering Potion", + "item.minecraft.tipped_arrow.effect.explode": "Exploding Arrow", + "item.ballistics.flask.effect.explode": "Exploding Flask", "item.ballistics.flask": "Flask", "item.ballistics.flask.effect.awkward": "Awkward Flask", @@ -43,5 +49,7 @@ "item.ballistics.flask.effect.water_breathing": "Flask of Water Breathing", "item.ballistics.flask.effect.weakness": "Flask of Weakness", "item.ballistics.flask.effect.weaving": "Flask of Weaving", - "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging" + "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging", + + "item.ballistics.snortable": "Snortable " } \ No newline at end of file diff --git a/src/main/java/llevc/ballistics/Ballistics.java b/src/main/java/llevc/ballistics/Ballistics.java index 482afa3..c017bb5 100644 --- a/src/main/java/llevc/ballistics/Ballistics.java +++ b/src/main/java/llevc/ballistics/Ballistics.java @@ -3,6 +3,7 @@ import llevc.ballistics.recipes.DrinkMixerRecipeSerializer; import llevc.ballistics.recipes.FlaskRecipeSerializer; import llevc.ballistics.recipes.MixedDrinkRecipeSerializer; +import llevc.ballistics.recipes.SnortableRecipeSerializer; import net.fabricmc.api.ModInitializer; import net.minecraft.core.Registry; @@ -29,6 +30,7 @@ public void onInitialize() { Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, FlaskRecipeSerializer.ID, FlaskRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, DrinkMixerRecipeSerializer.ID, DrinkMixerRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, MixedDrinkRecipeSerializer.ID, MixedDrinkRecipeSerializer.INSTANCE); + Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, SnortableRecipeSerializer.ID, SnortableRecipeSerializer.INSTANCE); LOGGER.info("if you read this you're prolly gonna be touched within the next 16 hours"); } diff --git a/src/main/java/llevc/ballistics/ModItems.java b/src/main/java/llevc/ballistics/ModItems.java index c501539..75a2f4a 100644 --- a/src/main/java/llevc/ballistics/ModItems.java +++ b/src/main/java/llevc/ballistics/ModItems.java @@ -1,5 +1,6 @@ package llevc.ballistics; +import llevc.ballistics.effects.Explode; import llevc.ballistics.items.FlintlockItem; import llevc.ballistics.items.PerfectParryItem; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; @@ -15,13 +16,22 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.ItemTags; +import net.minecraft.util.CommonColors; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.component.BlocksAttacks; +import net.minecraft.world.item.component.Consumable; import net.minecraft.world.item.component.Consumables; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ConsumeEffect; import net.minecraft.world.level.block.entity.BannerPatternLayers; import java.util.List; @@ -124,6 +134,22 @@ public static void initialize() { ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "mixed"), new Potion("mixed") ); + public static final Holder ExplodePotionEffect = + Registry.registerForHolder(BuiltInRegistries.MOB_EFFECT, ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "explode"), new Explode(MobEffectCategory.HARMFUL, CommonColors.SOFT_RED)); + public static final Potion ExplosionPotion = Registry.register( + BuiltInRegistries.POTION, + ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "explode"), + new Potion("explode",new MobEffectInstance(ExplodePotionEffect)) + ); + + //the baked shi + public static final Item snortable = register( + "snortable", + Item::new, + new Item.Properties().stacksTo(16) + .component(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(0.8f).animation(ItemUseAnimation.SPYGLASS).build()) + .component(DataComponents.TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT.withHidden(DataComponents.DYED_COLOR,true)) + ); public static final ResourceKey BallisticsItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics")); public static final CreativeModeTab BallisticsItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(Items.FIREWORK_ROCKET)).title(Component.translatable("itemGroup.ballistics")).build(); diff --git a/src/main/java/llevc/ballistics/effects/Explode.java b/src/main/java/llevc/ballistics/effects/Explode.java new file mode 100644 index 0000000..73e0d35 --- /dev/null +++ b/src/main/java/llevc/ballistics/effects/Explode.java @@ -0,0 +1,27 @@ +package llevc.ballistics.effects; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.InstantenousMobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +public class Explode extends InstantenousMobEffect { + public Explode(MobEffectCategory mobEffectCategory, int i) { + super(mobEffectCategory, i); + } + + @Override + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + return true; + } + + @Override + public void applyInstantenousEffect(ServerLevel serverLevel, @Nullable Entity entity, @Nullable Entity entity2, LivingEntity livingEntity, int i, double d) { + serverLevel.explode(livingEntity, livingEntity.damageSources().explosion(entity,entity2), null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), 6.0F, false, Level.ExplosionInteraction.TNT); + livingEntity.hurtServer(serverLevel,livingEntity.damageSources().explosion(entity,entity2),40); + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java new file mode 100644 index 0000000..6da53cc --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java @@ -0,0 +1,141 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.Ballistics; +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.Consumables; +import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ConsumeEffect; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +public class SnortableRecipe extends CustomRecipe { + public SnortableRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + Block block = Objects.requireNonNullElse(Block.byItem(itemStack.getItem()), Blocks.AIR); + if (block != Blocks.AIR || itemStack.is(Items.BRICK)) { + if (block != Blocks.AIR && !potion) { + potion = true; + } else if (block != Blocks.AIR && potion) { + return false; + } + if (itemStack.is(Items.BRICK) && !flask) { + flask = true; + } else if (itemStack.is(Items.BRICK) && flask) { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + Block block = Blocks.AIR; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + Block block1 = Objects.requireNonNullElse(Block.byItem(itemStack.getItem()), Blocks.AIR); + if (block1 != Blocks.AIR) { + if (block == Blocks.AIR) { + block = block1; + } else { + overflow = true; + } + } else if (itemStack.is(Items.BRICK)) { + + if (itemStack.is(Items.BRICK) && !flask) { + flask = true; + } else if (itemStack.is(Items.BRICK) && flask) { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!overflow && flask && block != Blocks.AIR) { + ItemStack yes = new ItemStack(ModItems.snortable); + List effectInstanceList = new ArrayList<>(); + + if (block.getFriction() > 0.75) { // slippppery + effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); + } + if (block.getSpeedFactor() < 1) { // is it sticky? + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); + } + if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); + } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy + effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); + } + if (block instanceof InfestedBlock) { // is infested? + effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); + } else if (block instanceof SlimeBlock) { // slimme + effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); + } else if (block instanceof TntBlock) { + effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); + } else if (block instanceof WebBlock) { // cobweb + effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); + } + if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break + effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); + effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); + } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break + effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); + } + + PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); + yes.set(DataComponents.POTION_CONTENTS,huh); + yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); + yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); + yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + result = yes; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return SnortableRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java new file mode 100644 index 0000000..af1ead3 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class SnortableRecipeSerializer implements RecipeSerializer { + public static final SnortableRecipeSerializer INSTANCE = new SnortableRecipeSerializer(SnortableRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_snortable"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public SnortableRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/resources/data/ballistics/recipe/snortable.json b/src/main/resources/data/ballistics/recipe/snortable.json new file mode 100644 index 0000000..e23b06f --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/snortable.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_snortable", + "category": "misc" +} \ No newline at end of file From 3cfb92e49e30efee03cad4c55d35e3c2e70ce742 Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 13:47:37 -0700 Subject: [PATCH 2/9] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..895cd94 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +this entire fork is a joke and a test for how much weird stuff i could add +mostly drugs lmao From 3328bcc2b7a3be55345689f534add4aa4063ba10 Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 13:47:50 -0700 Subject: [PATCH 3/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 895cd94..44f994c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ this entire fork is a joke and a test for how much weird stuff i could add + mostly drugs lmao From 36eb7f83d21f85efa6dc711c29b44a350867b96e Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sun, 5 Apr 2026 03:33:41 -0700 Subject: [PATCH 4/9] holy smokes --- .../assets/ballistics/items/cartridge.json | 12 ++ .../assets/ballistics/items/cig.json | 45 +++++ .../assets/ballistics/items/pick.json | 31 ++++ .../assets/ballistics/items/vape.json | 12 ++ .../assets/ballistics/lang/en_us.json | 8 +- .../ballistics/models/item/cartridge.json | 6 + .../ballistics/models/item/smoke/cig.json | 35 ++++ .../models/item/smoke/cig_overlay.json | 8 + .../ballistics/models/item/smoke/pick.json | 8 + .../models/item/smoke/pick_overlay.json | 8 + .../ballistics/models/item/smoke/vape.json | 9 + .../ballistics/textures/item/cartridge.png | Bin 0 -> 130 bytes .../ballistics/textures/item/smoke/cig.png | Bin 0 -> 129 bytes .../textures/item/smoke/cig_overlay.png | Bin 0 -> 103 bytes .../ballistics/textures/item/smoke/pick.png | Bin 0 -> 124 bytes .../textures/item/smoke/pick_overlay.png | Bin 0 -> 118 bytes .../ballistics/textures/item/smoke/vape.png | Bin 0 -> 208 bytes .../textures/item/smoke/vape_overlay.png | Bin 0 -> 120 bytes .../java/llevc/ballistics/Ballistics.java | 8 +- src/main/java/llevc/ballistics/ModItems.java | 137 ++++++++++++++- .../llevc/ballistics/items/SmokeItem.java | 163 ++++++++++++++++++ .../ballistics/recipes/CartridgeRecipe.java | 102 +++++++++++ .../recipes/CartridgeRecipeSerializer.java | 40 +++++ .../ballistics/recipes/GeekedRecipe.java | 103 +++++++++++ .../recipes/GeekedRecipeSerializer.java | 40 +++++ .../llevc/ballistics/recipes/PickRecipe.java | 103 +++++++++++ .../recipes/PickRecipeSerializer.java | 40 +++++ .../ballistics/recipes/SnortableRecipe.java | 36 +--- .../data/ballistics/recipe/cartridge.json | 18 ++ .../ballistics/recipe/cartridge_fill.json | 4 + .../resources/data/ballistics/recipe/cig.json | 20 +++ .../data/ballistics/recipe/geeked_fill.json | 4 + .../data/ballistics/recipe/pick.json | 4 + .../data/ballistics/recipe/pick1.json | 10 ++ .../data/ballistics/recipe/vape.json | 19 ++ .../tags/item/enchantable/durability.json | 5 +- 36 files changed, 993 insertions(+), 45 deletions(-) create mode 100644 src/client/resources/assets/ballistics/items/cartridge.json create mode 100644 src/client/resources/assets/ballistics/items/cig.json create mode 100644 src/client/resources/assets/ballistics/items/pick.json create mode 100644 src/client/resources/assets/ballistics/items/vape.json create mode 100644 src/client/resources/assets/ballistics/models/item/cartridge.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/cig.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/pick.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/vape.json create mode 100644 src/client/resources/assets/ballistics/textures/item/cartridge.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/cig.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/cig_overlay.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/pick.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/pick_overlay.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/vape.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/vape_overlay.png create mode 100644 src/main/java/llevc/ballistics/items/SmokeItem.java create mode 100644 src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java create mode 100644 src/main/java/llevc/ballistics/recipes/GeekedRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java create mode 100644 src/main/java/llevc/ballistics/recipes/PickRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java create mode 100644 src/main/resources/data/ballistics/recipe/cartridge.json create mode 100644 src/main/resources/data/ballistics/recipe/cartridge_fill.json create mode 100644 src/main/resources/data/ballistics/recipe/cig.json create mode 100644 src/main/resources/data/ballistics/recipe/geeked_fill.json create mode 100644 src/main/resources/data/ballistics/recipe/pick.json create mode 100644 src/main/resources/data/ballistics/recipe/pick1.json create mode 100644 src/main/resources/data/ballistics/recipe/vape.json diff --git a/src/client/resources/assets/ballistics/items/cartridge.json b/src/client/resources/assets/ballistics/items/cartridge.json new file mode 100644 index 0000000..a9d3139 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/cartridge.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ballistics:item/cartridge", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/cig.json b/src/client/resources/assets/ballistics/items/cig.json new file mode 100644 index 0000000..ae0ea6c --- /dev/null +++ b/src/client/resources/assets/ballistics/items/cig.json @@ -0,0 +1,45 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:using_item", + "on_true": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig_overlay" + } + ] + }, + "on_false": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "head", + "model": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig_overlay" + } + ] + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + } + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/pick.json b/src/client/resources/assets/ballistics/items/pick.json new file mode 100644 index 0000000..84b2b27 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/pick.json @@ -0,0 +1,31 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:has_component", + "component": "minecraft:potion_contents", + "ignore_default": true, + "on_true": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick_overlay", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } + ] + }, + "on_false": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick" + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/vape.json b/src/client/resources/assets/ballistics/items/vape.json new file mode 100644 index 0000000..2c898bb --- /dev/null +++ b/src/client/resources/assets/ballistics/items/vape.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/vape", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/lang/en_us.json b/src/client/resources/assets/ballistics/lang/en_us.json index b276123..e063f49 100644 --- a/src/client/resources/assets/ballistics/lang/en_us.json +++ b/src/client/resources/assets/ballistics/lang/en_us.json @@ -4,6 +4,7 @@ "item.ballistics.rh_glove": "Rocket Handling Glove", "itemGroup.ballistics": "Ballistics", "itemGroup.ballistics_flasks": "Ballistics Flasks", + "itemGroup.ballistics_geeked": "Ballistics Baked", "item.ballistics.prick": "Prick", "item.ballistics.drink_mixer": "Drink Mixer", "item.ballistics.flintlock_barrel": "Flintlock Barrel", @@ -51,5 +52,10 @@ "item.ballistics.flask.effect.weaving": "Flask of Weaving", "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging", - "item.ballistics.snortable": "Snortable " + "item.ballistics.snortable": "Snortable ", + "item.ballistics.custom_cig": "Custom Cig", + "item.ballistics.cig": "Cig", + "item.ballistics.vape": "Vape", + "item.ballistics.pick": "Pick", + "item.ballistics.cartridge": "Cartridge" } \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/cartridge.json b/src/client/resources/assets/ballistics/models/item/cartridge.json new file mode 100644 index 0000000..abb63a7 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/cartridge.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ballistics:item/cartridge" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/cig.json b/src/client/resources/assets/ballistics/models/item/smoke/cig.json new file mode 100644 index 0000000..898f812 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/cig.json @@ -0,0 +1,35 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ballistics:item/smoke/cig" + }, + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 0], + "translation": [-1, -0.5, 0], + "scale": [0.55, 0.55, 0.55] + }, + "thirdperson_lefthand": { + "rotation": [0, 90, 0], + "translation": [-1, -0.5, 0], + "scale": [0.55, 0.55, 0.55] + }, + "firstperson_righthand": { + "rotation": [0, -90, 0], + "translation": [1.13, 3.2, 1.13], + "scale": [0.68, 0.68, 0.68] + }, + "firstperson_lefthand": { + "rotation": [0, 90, 0], + "translation": [1.13, 3.2, 1.13], + "scale": [0.68, 0.68, 0.68] + }, + "head": { + "rotation": [-111.92, -22.6, -146.7], + "translation": [3.25, -5.25, -8.5], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json b/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json new file mode 100644 index 0000000..f687d94 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/cig_overlay" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/pick.json b/src/client/resources/assets/ballistics/models/item/smoke/pick.json new file mode 100644 index 0000000..826f493 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/pick.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/pick" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json b/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json new file mode 100644 index 0000000..3cde251 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/pick_overlay" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/vape.json b/src/client/resources/assets/ballistics/models/item/smoke/vape.json new file mode 100644 index 0000000..3b6308e --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/vape.json @@ -0,0 +1,9 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/vape_overlay", + "layer1": "ballistics:item/smoke/vape" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/textures/item/cartridge.png b/src/client/resources/assets/ballistics/textures/item/cartridge.png new file mode 100644 index 0000000000000000000000000000000000000000..edc27a82abb689a76accd208c3d74b8b5ed33352 GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Y&=~YLo9le z6C_x-unP$Z{nxzo=RXiIF)=NXX1ZMS|KH#L>i+Xo&I)vy9Byc6VE8#}BClffXAK28 a28M?1nuU`CFPQ+%VeoYIb6Mw<&;$TALn;ga literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/cig.png b/src/client/resources/assets/ballistics/textures/item/smoke/cig.png new file mode 100644 index 0000000000000000000000000000000000000000..74eebe2a12351565732398ad99a2029d4ca705ae GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|tUX;ELo9le z6C@%J_=Z2R-z6ceIqUBllZ{eNQ=VzQ-1h(F`pR>2EdQ^M-|si`nPu^_9*MIj+9s^6 b%wS?DcyF)5y!YUDpfL=du6{1-oD!M{HvW7zCspxWLT7P|I;8OGxY+P%(q2tDnm{r-UW|JwYEI literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/pick.png b/src/client/resources/assets/ballistics/textures/item/smoke/pick.png new file mode 100644 index 0000000000000000000000000000000000000000..1552d6419ffa3b900ec80d85611e55ed3b605e5c GIT binary patch literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|%sgEjLo9le z6C@%ZoO*QW|9}1Uf9!Xd7z-|rynUdh@!@OjPr3imdKI;Vst0K!2hQUCw| literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/vape.png b/src/client/resources/assets/ballistics/textures/item/smoke/vape.png new file mode 100644 index 0000000000000000000000000000000000000000..29090b060d53a79258c8fbf6914e7cd114b05d72 GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|x;$MRLo9la zPTI(KSb@hy|KygTe~DWM4fs GenericItem register(String name, Funct public static void initialize() { Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsItemGroupKey,BallisticsItemGroup); Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsFlaskItemGroupKey,BallisticsFlaskItemGroup); + Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsBakedItemGroupKey,BallisticsBakedItemGroup); ItemGroupEvents.modifyEntriesEvent(BallisticsItemGroupKey).register(itemGroup -> { itemGroup.accept(rhGlove); @@ -60,6 +64,11 @@ public static void initialize() { itemGroup.accept(EmptyFlask); itemGroup.accept(DragonsFlask); itemGroup.accept(PotionContents.createItemStack(ModItems.Flask, Potions.WATER)); + itemGroup.accept(snortable); + itemGroup.accept(pick); + itemGroup.accept(cig); + itemGroup.accept(vape); + itemGroup.accept(cartridge); }); ItemGroupEvents.modifyEntriesEvent(BallisticsFlaskItemGroupKey).register(itemGroup -> { itemGroup.accept(DrinkMixer); @@ -73,6 +82,60 @@ public static void initialize() { } } }); + ItemGroupEvents.modifyEntriesEvent(BallisticsBakedItemGroupKey).register(itemGroup -> { + itemGroup.accept(pick); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(pick,Holder.direct(hey))); + } + } + itemGroup.accept(cig); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + ItemStack yo = PotionContents.createItemStack(cig,Holder.direct(hey)); + yo.set(DataComponents.ITEM_NAME,Component.translatable("item.ballistics.custom_cig")); + itemGroup.accept(yo); + } + } + itemGroup.accept(vape); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(vape,Holder.direct(hey))); + } + } + itemGroup.accept(cartridge); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(cartridge,Holder.direct(hey))); + } + } + itemGroup.accept(snortable); + for (int i = 0; i < BuiltInRegistries.BLOCK.size(); i++) { + Optional> wchat = BuiltInRegistries.BLOCK.get(i); + if (wchat.isPresent()) { + Block hey = wchat.get().value(); + itemGroup.accept(createSnortable(hey)); + } + } + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + ItemStack yo = PotionContents.createItemStack(snortable,Holder.direct(hey)); + yo.set(DataComponents.DYED_COLOR,new DyedItemColor(yo.getOrDefault(DataComponents.POTION_CONTENTS,PotionContents.EMPTY).getColorOr(CommonColors.WHITE))); + yo.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(hey.name())); + itemGroup.accept(yo); + } + } + }); } public static final Item EmptyFlask = register( @@ -149,10 +212,76 @@ public static void initialize() { new Item.Properties().stacksTo(16) .component(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(0.8f).animation(ItemUseAnimation.SPYGLASS).build()) .component(DataComponents.TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT.withHidden(DataComponents.DYED_COLOR,true)) + .component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) + .component(DataComponents.DYED_COLOR,new DyedItemColor(CommonColors.WHITE)) + ); + public static final PotionContents cigContents = new PotionContents(Optional.empty(),Optional.empty(),List.of( + new MobEffectInstance(MobEffects.REGENERATION,45*20), + new MobEffectInstance(MobEffects.NAUSEA,45*20) + ),Optional.empty()); + public static final Item cig = register( + "cig", + SmokeItem::new, + new Item.Properties().durability(32).component(DataComponents.POTION_CONTENTS, cigContents).equippable(EquipmentSlot.HEAD) + ); + public static final Item vape = register( + "vape", + SmokeItem::new, + new Item.Properties().durability(64).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).repairable(ItemTags.REPAIRS_IRON_ARMOR) + ); + public static final Item pick = register( + "pick", + SmokeItem::new, + new Item.Properties().durability(8).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).equippable(EquipmentSlot.HEAD) ); + public static final Item cartridge = register( + "cartridge", + Item::new, + new Item.Properties().component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) + ); + public static ItemStack createSnortable(Block block) { + ItemStack yes = new ItemStack(ModItems.snortable); + List effectInstanceList = new ArrayList<>(); + + if (block.getFriction() > 0.75) { // slippppery + effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); + } + if (block.getSpeedFactor() < 1) { // is it sticky? + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); + } + if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); + } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy + effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); + } + if (block instanceof InfestedBlock) { // is infested? + effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); + } else if (block instanceof SlimeBlock) { // slimme + effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); + } else if (block instanceof TntBlock) { + effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); + } else if (block instanceof WebBlock) { // cobweb + effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); + } + if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break + effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); + effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); + } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break + effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); + } + + PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); + yes.set(DataComponents.POTION_CONTENTS,huh); + yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); + yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); + yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + return yes; + } public static final ResourceKey BallisticsItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics")); public static final CreativeModeTab BallisticsItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(Items.FIREWORK_ROCKET)).title(Component.translatable("itemGroup.ballistics")).build(); public static final ResourceKey BallisticsFlaskItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics_flasks")); public static final CreativeModeTab BallisticsFlaskItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(EmptyFlask)).title(Component.translatable("itemGroup.ballistics_flasks")).build(); + public static final ResourceKey BallisticsBakedItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics_geeked")); + public static final CreativeModeTab BallisticsBakedItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(vape)).title(Component.translatable("itemGroup.ballistics_geeked")).build(); } diff --git a/src/main/java/llevc/ballistics/items/SmokeItem.java b/src/main/java/llevc/ballistics/items/SmokeItem.java new file mode 100644 index 0000000..c47a038 --- /dev/null +++ b/src/main/java/llevc/ballistics/items/SmokeItem.java @@ -0,0 +1,163 @@ +package llevc.ballistics.items; + +import llevc.ballistics.Ballistics; +import llevc.ballistics.ModItems; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ParticleUtils; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.enchantment.effects.SpawnParticlesEffect; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Iterator; +import java.util.List; + +public class SmokeItem extends Item { + + public SmokeItem(Properties properties) { + super(properties); + } + + public boolean smokeParticles() { + if (this.equals(ModItems.pick)) { + return false; + } + return true; + } + + public float applyRate() { + return 40; + } + + @Override + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + if (!level.isClientSide()) { + player.startUsingItem(interactionHand); + } + return InteractionResult.CONSUME; + } + + @Override + public void onUseTick(Level level, LivingEntity livingEntity, ItemStack itemStack, int i) { + if (level.isClientSide()) { + return; + } + Ballistics.LOGGER.info(String.valueOf(i)); + if (Math.round(i/applyRate()) == i/applyRate() || i <= 1) { + for (MobEffectInstance nah : itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects()) { + MobEffectInstance yah = nah.withScaledDuration(1 / 5f); + livingEntity.forceAddEffect(yah,livingEntity); + } + itemStack.hurtAndBreak(1,livingEntity,livingEntity.getUsedItemHand()); + if (i <= 1) { + livingEntity.stopUsingItem(); + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack,getUseDuration(itemStack, livingEntity)*2); + } + } + } + } + + public void spawnSmokeParticles(Level level, LivingEntity livingEntity) { + if (smokeParticles()) { + for (int j = 0; j < 5; j++) { + ParticleUtils.spawnParticleBelow(level, new BlockPos((int) livingEntity.getEyePosition().x, (int) livingEntity.getEyePosition().y, (int) livingEntity.getEyePosition().z), RandomSource.create(), ParticleTypes.POOF); + } + } + } + + public void sendSmokeParticles(ServerLevel serverLevel, LivingEntity livingEntity) { + if (smokeParticles()) { + for (int j = 0; j < 5; j++) { + RandomSource randomSource = RandomSource.create(); + serverLevel.sendParticles(ParticleTypes.POOF,livingEntity.getEyePosition().x+randomSource.nextDouble()-0.5, livingEntity.getEyePosition().y, livingEntity.getEyePosition().z+randomSource.nextDouble()-0.5,0,0,0,0,0); + //ParticleUtils.spawnParticleBelow(level, new BlockPos((int) livingEntity.getEyePosition().x, (int) livingEntity.getEyePosition().y, (int) livingEntity.getEyePosition().z), RandomSource.create(), ParticleTypes.POOF); + } + } + } + + @Override + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { + if (level.isClientSide()) { + //spawnSmokeParticles(level,livingEntity); + return false; + } + if (level instanceof ServerLevel serverLevel) { + sendSmokeParticles(serverLevel,livingEntity); + } + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack,(getUseDuration(itemStack, livingEntity)-i)*2); + } + return false; + } + + @Override + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.TOOT_HORN; + } + + @Override + public int getUseDuration(ItemStack itemStack, LivingEntity livingEntity) { + if (itemStack.is(ModItems.pick)) { + return 20*2; + } else if (itemStack.is(ModItems.vape)) { + return 20*12; + } + return 20*6; + } + + public int ticksUsed = 0; + @Override + public void inventoryTick(ItemStack itemStack, ServerLevel serverLevel, Entity entity, @Nullable EquipmentSlot equipmentSlot) { + if (equipmentSlot == EquipmentSlot.HEAD) { + if (entity instanceof LivingEntity livingEntity) { + boolean cooldown = false; + int woah = getUseDuration(itemStack, livingEntity) - ticksUsed; + + if (entity instanceof Player player) { + cooldown = player.getCooldowns().isOnCooldown(itemStack); + } + + if (livingEntity.isCrouching() && !cooldown) { + Ballistics.LOGGER.info(String.valueOf(getUseDuration(itemStack, livingEntity))); + if (Math.round(woah / applyRate()) == woah / applyRate() || woah <= 1) { + for (MobEffectInstance nah : itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects()) { + MobEffectInstance yah = nah.withScaledDuration(1 / 5f); + livingEntity.forceAddEffect(yah, livingEntity); + } + if (!(itemStack.is(ModItems.pick) && itemStack.getOrDefault(DataComponents.POTION_CONTENTS,PotionContents.EMPTY) == PotionContents.EMPTY)) { + itemStack.hurtAndBreak(1, livingEntity, equipmentSlot); + } + if (woah <= 1) { + livingEntity.stopUsingItem(); + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack, getUseDuration(itemStack, livingEntity) * 2); + } + } + } + ticksUsed++; + } else if ((!livingEntity.isCrouching() || cooldown) && ticksUsed > 0) { + ticksUsed = 0; + releaseUsing(itemStack,serverLevel,livingEntity,woah); + } + } + } + } +} diff --git a/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java b/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java new file mode 100644 index 0000000..3c6b23a --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java @@ -0,0 +1,102 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class CartridgeRecipe extends CustomRecipe { + public CartridgeRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.cartridge)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.cartridge)) { + + if (!flask) { + flask = true; + } else { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && flask && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = PotionContents.createItemStack(ModItems.cartridge, death.potion().orElse(Potions.WATER)); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return CartridgeRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java new file mode 100644 index 0000000..aac1309 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class CartridgeRecipeSerializer implements RecipeSerializer { + public static final CartridgeRecipeSerializer INSTANCE = new CartridgeRecipeSerializer(CartridgeRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_cartridge_fill"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public CartridgeRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java b/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java new file mode 100644 index 0000000..d9ecbb9 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java @@ -0,0 +1,103 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class GeekedRecipe extends CustomRecipe { + public GeekedRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(ModItems.cartridge)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.vape)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + ItemStack geek = ItemStack.EMPTY; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(ModItems.cartridge)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.vape)) { + + if (geek.isEmpty()) { + geek = itemStack; + } else { + overflow = true; + } + + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && !geek.isEmpty() && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = geek.copy(); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return GeekedRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java new file mode 100644 index 0000000..e729305 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class GeekedRecipeSerializer implements RecipeSerializer { + public static final GeekedRecipeSerializer INSTANCE = new GeekedRecipeSerializer(GeekedRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_geeked"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public GeekedRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/PickRecipe.java b/src/main/java/llevc/ballistics/recipes/PickRecipe.java new file mode 100644 index 0000000..696e068 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/PickRecipe.java @@ -0,0 +1,103 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class PickRecipe extends CustomRecipe { + public PickRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.pick)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.pick)) { + + if (!flask) { + flask = true; + } else { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && flask && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = PotionContents.createItemStack(ModItems.pick, death.potion().orElse(Potions.WATER)); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return PickRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java new file mode 100644 index 0000000..66e9141 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class PickRecipeSerializer implements RecipeSerializer { + public static final PickRecipeSerializer INSTANCE = new PickRecipeSerializer(PickRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_pick"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public PickRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java index 6da53cc..6e3e856 100644 --- a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java @@ -93,41 +93,7 @@ public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provi } if (!overflow && flask && block != Blocks.AIR) { - ItemStack yes = new ItemStack(ModItems.snortable); - List effectInstanceList = new ArrayList<>(); - - if (block.getFriction() > 0.75) { // slippppery - effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); - } - if (block.getSpeedFactor() < 1) { // is it sticky? - effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); - } - if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one - effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); - } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy - effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); - } - if (block instanceof InfestedBlock) { // is infested? - effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); - } else if (block instanceof SlimeBlock) { // slimme - effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); - } else if (block instanceof TntBlock) { - effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); - } else if (block instanceof WebBlock) { // cobweb - effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); - } - if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break - effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); - effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); - } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break - effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); - } - - PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); - yes.set(DataComponents.POTION_CONTENTS,huh); - yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); - yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); - yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + ItemStack yes = ModItems.createSnortable(block); result = yes; } diff --git a/src/main/resources/data/ballistics/recipe/cartridge.json b/src/main/resources/data/ballistics/recipe/cartridge.json new file mode 100644 index 0000000..fa24e81 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cartridge.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "cac", + "aba", + "cac" + ], + "key": { + "a": "minecraft:iron_ingot", + "b": "minecraft:glass_bottle", + "c": "minecraft:paper" + }, + "result": { + "id": "ballistics:cartridge", + "count": 16 + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/cartridge_fill.json b/src/main/resources/data/ballistics/recipe/cartridge_fill.json new file mode 100644 index 0000000..5271035 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cartridge_fill.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_cartridge_fill", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/cig.json b/src/main/resources/data/ballistics/recipe/cig.json new file mode 100644 index 0000000..7019da6 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cig.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "dbe", + "bab", + "cbd" + ], + "key": { + "a": "minecraft:slime_ball", + "b": "minecraft:paper", + "c": "minecraft:honey_bottle", + "d": "minecraft:iron_nugget", + "e": "minecraft:string" + }, + "result": { + "id": "ballistics:cig", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/geeked_fill.json b/src/main/resources/data/ballistics/recipe/geeked_fill.json new file mode 100644 index 0000000..c7d5ddb --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/geeked_fill.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_geeked", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/pick.json b/src/main/resources/data/ballistics/recipe/pick.json new file mode 100644 index 0000000..73be7cf --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/pick.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_pick", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/pick1.json b/src/main/resources/data/ballistics/recipe/pick1.json new file mode 100644 index 0000000..49e9c3c --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/pick1.json @@ -0,0 +1,10 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "equipment", + "ingredients": [ + "minecraft:stick" + ], + "result": { + "id": "ballistics:pick" + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/vape.json b/src/main/resources/data/ballistics/recipe/vape.json new file mode 100644 index 0000000..c01d759 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/vape.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "dae", + "aba", + "cad" + ], + "key": { + "a": "minecraft:iron_ingot", + "b": "minecraft:slime_block", + "c": "minecraft:honey_bottle", + "d": "minecraft:paper", + "e": "minecraft:string" + }, + "result": { + "id": "ballistics:vape" + } +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/item/enchantable/durability.json b/src/main/resources/data/minecraft/tags/item/enchantable/durability.json index 9611348..cbec1bd 100644 --- a/src/main/resources/data/minecraft/tags/item/enchantable/durability.json +++ b/src/main/resources/data/minecraft/tags/item/enchantable/durability.json @@ -2,6 +2,9 @@ "replace": false, "values": [ "ballistics:rh_glove", - "ballistics:flintlock" + "ballistics:flintlock", + "ballistics:pick", + "ballistics:cig", + "ballistics:vape" ] } \ No newline at end of file From ac275f20d35c287d02ae9b6ed732ca6b8ba92abb Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 01:59:13 -0700 Subject: [PATCH 5/9] snortable --- .../ballistics/BallisticsDataGenerator.java | 2 +- .../assets/ballistics/items/snortable.json | 12 ++ .../assets/ballistics/lang/en_us.json | 10 +- .../java/llevc/ballistics/Ballistics.java | 4 +- src/main/java/llevc/ballistics/ModItems.java | 26 ++++ .../llevc/ballistics/effects/Explode.java | 27 ++++ .../ballistics/recipes/SnortableRecipe.java | 141 ++++++++++++++++++ .../recipes/SnortableRecipeSerializer.java | 40 +++++ .../data/ballistics/recipe/snortable.json | 4 + 9 files changed, 261 insertions(+), 5 deletions(-) create mode 100644 src/client/resources/assets/ballistics/items/snortable.json create mode 100644 src/main/java/llevc/ballistics/effects/Explode.java create mode 100644 src/main/java/llevc/ballistics/recipes/SnortableRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java create mode 100644 src/main/resources/data/ballistics/recipe/snortable.json diff --git a/src/client/java/llevc/ballistics/BallisticsDataGenerator.java b/src/client/java/llevc/ballistics/BallisticsDataGenerator.java index d68ae11..523a672 100644 --- a/src/client/java/llevc/ballistics/BallisticsDataGenerator.java +++ b/src/client/java/llevc/ballistics/BallisticsDataGenerator.java @@ -6,6 +6,6 @@ public class BallisticsDataGenerator implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { - + FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); } } diff --git a/src/client/resources/assets/ballistics/items/snortable.json b/src/client/resources/assets/ballistics/items/snortable.json new file mode 100644 index 0000000..70400a4 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/snortable.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "minecraft:item/sugar", + "tints": [ + { + "type": "minecraft:dye", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/lang/en_us.json b/src/client/resources/assets/ballistics/lang/en_us.json index bdedd86..b276123 100644 --- a/src/client/resources/assets/ballistics/lang/en_us.json +++ b/src/client/resources/assets/ballistics/lang/en_us.json @@ -16,6 +16,12 @@ "item.minecraft.lingering_potion.effect.mixed": "Mixed Lingering Potion", "item.minecraft.tipped_arrow.effect.mixed": "Mixed Arrow", "item.ballistics.flask.effect.mixed": "Mixed Flask", + "effect.ballistics.explode": "Explode", + "item.minecraft.potion.effect.explode": "Exploding Potion", + "item.minecraft.splash_potion.effect.explode": "Exploding Splash Potion", + "item.minecraft.lingering_potion.effect.explode": "Exploding Lingering Potion", + "item.minecraft.tipped_arrow.effect.explode": "Exploding Arrow", + "item.ballistics.flask.effect.explode": "Exploding Flask", "item.ballistics.flask": "Flask", "item.ballistics.flask.effect.awkward": "Awkward Flask", @@ -43,5 +49,7 @@ "item.ballistics.flask.effect.water_breathing": "Flask of Water Breathing", "item.ballistics.flask.effect.weakness": "Flask of Weakness", "item.ballistics.flask.effect.weaving": "Flask of Weaving", - "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging" + "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging", + + "item.ballistics.snortable": "Snortable " } \ No newline at end of file diff --git a/src/main/java/llevc/ballistics/Ballistics.java b/src/main/java/llevc/ballistics/Ballistics.java index b50038f..c4d0091 100644 --- a/src/main/java/llevc/ballistics/Ballistics.java +++ b/src/main/java/llevc/ballistics/Ballistics.java @@ -2,7 +2,6 @@ import llevc.ballistics.recipes.DrinkMixerRecipeSerializer; import llevc.ballistics.recipes.FlaskRecipeSerializer; -import llevc.ballistics.recipes.FlintlockLoadRecipeSerializer; import llevc.ballistics.recipes.MixedDrinkRecipeSerializer; import net.fabricmc.api.ModInitializer; @@ -22,7 +21,7 @@ public class Ballistics implements ModInitializer { @Override public void onInitialize() { // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. + // However, some things~ (like resources) may still be uninitialized. // Proceed with mild caution. ModItems.initialize(); @@ -30,7 +29,6 @@ public void onInitialize() { Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, FlaskRecipeSerializer.ID, FlaskRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, DrinkMixerRecipeSerializer.ID, DrinkMixerRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, MixedDrinkRecipeSerializer.ID, MixedDrinkRecipeSerializer.INSTANCE); - Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, FlintlockLoadRecipeSerializer.ID, FlintlockLoadRecipeSerializer.INSTANCE); LOGGER.info("if you read this you're prolly gonna be touched within the next 16 hours"); } diff --git a/src/main/java/llevc/ballistics/ModItems.java b/src/main/java/llevc/ballistics/ModItems.java index c501539..75a2f4a 100644 --- a/src/main/java/llevc/ballistics/ModItems.java +++ b/src/main/java/llevc/ballistics/ModItems.java @@ -1,5 +1,6 @@ package llevc.ballistics; +import llevc.ballistics.effects.Explode; import llevc.ballistics.items.FlintlockItem; import llevc.ballistics.items.PerfectParryItem; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; @@ -15,13 +16,22 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; import net.minecraft.tags.ItemTags; +import net.minecraft.util.CommonColors; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.component.BlocksAttacks; +import net.minecraft.world.item.component.Consumable; import net.minecraft.world.item.component.Consumables; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ConsumeEffect; import net.minecraft.world.level.block.entity.BannerPatternLayers; import java.util.List; @@ -124,6 +134,22 @@ public static void initialize() { ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "mixed"), new Potion("mixed") ); + public static final Holder ExplodePotionEffect = + Registry.registerForHolder(BuiltInRegistries.MOB_EFFECT, ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "explode"), new Explode(MobEffectCategory.HARMFUL, CommonColors.SOFT_RED)); + public static final Potion ExplosionPotion = Registry.register( + BuiltInRegistries.POTION, + ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "explode"), + new Potion("explode",new MobEffectInstance(ExplodePotionEffect)) + ); + + //the baked shi + public static final Item snortable = register( + "snortable", + Item::new, + new Item.Properties().stacksTo(16) + .component(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(0.8f).animation(ItemUseAnimation.SPYGLASS).build()) + .component(DataComponents.TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT.withHidden(DataComponents.DYED_COLOR,true)) + ); public static final ResourceKey BallisticsItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics")); public static final CreativeModeTab BallisticsItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(Items.FIREWORK_ROCKET)).title(Component.translatable("itemGroup.ballistics")).build(); diff --git a/src/main/java/llevc/ballistics/effects/Explode.java b/src/main/java/llevc/ballistics/effects/Explode.java new file mode 100644 index 0000000..73e0d35 --- /dev/null +++ b/src/main/java/llevc/ballistics/effects/Explode.java @@ -0,0 +1,27 @@ +package llevc.ballistics.effects; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.InstantenousMobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +public class Explode extends InstantenousMobEffect { + public Explode(MobEffectCategory mobEffectCategory, int i) { + super(mobEffectCategory, i); + } + + @Override + public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) { + return true; + } + + @Override + public void applyInstantenousEffect(ServerLevel serverLevel, @Nullable Entity entity, @Nullable Entity entity2, LivingEntity livingEntity, int i, double d) { + serverLevel.explode(livingEntity, livingEntity.damageSources().explosion(entity,entity2), null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), 6.0F, false, Level.ExplosionInteraction.TNT); + livingEntity.hurtServer(serverLevel,livingEntity.damageSources().explosion(entity,entity2),40); + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java new file mode 100644 index 0000000..6da53cc --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java @@ -0,0 +1,141 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.Ballistics; +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.component.Consumable; +import net.minecraft.world.item.component.Consumables; +import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect; +import net.minecraft.world.item.consume_effects.ConsumeEffect; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +public class SnortableRecipe extends CustomRecipe { + public SnortableRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + Block block = Objects.requireNonNullElse(Block.byItem(itemStack.getItem()), Blocks.AIR); + if (block != Blocks.AIR || itemStack.is(Items.BRICK)) { + if (block != Blocks.AIR && !potion) { + potion = true; + } else if (block != Blocks.AIR && potion) { + return false; + } + if (itemStack.is(Items.BRICK) && !flask) { + flask = true; + } else if (itemStack.is(Items.BRICK) && flask) { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + Block block = Blocks.AIR; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + Block block1 = Objects.requireNonNullElse(Block.byItem(itemStack.getItem()), Blocks.AIR); + if (block1 != Blocks.AIR) { + if (block == Blocks.AIR) { + block = block1; + } else { + overflow = true; + } + } else if (itemStack.is(Items.BRICK)) { + + if (itemStack.is(Items.BRICK) && !flask) { + flask = true; + } else if (itemStack.is(Items.BRICK) && flask) { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!overflow && flask && block != Blocks.AIR) { + ItemStack yes = new ItemStack(ModItems.snortable); + List effectInstanceList = new ArrayList<>(); + + if (block.getFriction() > 0.75) { // slippppery + effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); + } + if (block.getSpeedFactor() < 1) { // is it sticky? + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); + } + if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); + } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy + effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); + } + if (block instanceof InfestedBlock) { // is infested? + effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); + } else if (block instanceof SlimeBlock) { // slimme + effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); + } else if (block instanceof TntBlock) { + effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); + } else if (block instanceof WebBlock) { // cobweb + effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); + } + if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break + effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); + effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); + } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break + effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); + } + + PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); + yes.set(DataComponents.POTION_CONTENTS,huh); + yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); + yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); + yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + result = yes; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return SnortableRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java new file mode 100644 index 0000000..af1ead3 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class SnortableRecipeSerializer implements RecipeSerializer { + public static final SnortableRecipeSerializer INSTANCE = new SnortableRecipeSerializer(SnortableRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_snortable"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public SnortableRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/resources/data/ballistics/recipe/snortable.json b/src/main/resources/data/ballistics/recipe/snortable.json new file mode 100644 index 0000000..e23b06f --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/snortable.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_snortable", + "category": "misc" +} \ No newline at end of file From f77fabf2d5d6ec66b842c026ac9d33f46f48d71d Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 13:47:37 -0700 Subject: [PATCH 6/9] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..895cd94 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +this entire fork is a joke and a test for how much weird stuff i could add +mostly drugs lmao From fce0284c5253f86b5788726c4fde0b6e3f5d64f9 Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sat, 4 Apr 2026 13:47:50 -0700 Subject: [PATCH 7/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 895cd94..44f994c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ this entire fork is a joke and a test for how much weird stuff i could add + mostly drugs lmao From f9779b12b0b11b065e4f87db27c3b259f1959ed8 Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sun, 5 Apr 2026 03:33:41 -0700 Subject: [PATCH 8/9] holy smokes # Conflicts: # src/main/java/llevc/ballistics/Ballistics.java --- .../assets/ballistics/items/cartridge.json | 12 ++ .../assets/ballistics/items/cig.json | 45 +++++ .../assets/ballistics/items/pick.json | 31 ++++ .../assets/ballistics/items/vape.json | 12 ++ .../assets/ballistics/lang/en_us.json | 8 +- .../ballistics/models/item/cartridge.json | 6 + .../ballistics/models/item/smoke/cig.json | 35 ++++ .../models/item/smoke/cig_overlay.json | 8 + .../ballistics/models/item/smoke/pick.json | 8 + .../models/item/smoke/pick_overlay.json | 8 + .../ballistics/models/item/smoke/vape.json | 9 + .../ballistics/textures/item/cartridge.png | Bin 0 -> 130 bytes .../ballistics/textures/item/smoke/cig.png | Bin 0 -> 129 bytes .../textures/item/smoke/cig_overlay.png | Bin 0 -> 103 bytes .../ballistics/textures/item/smoke/pick.png | Bin 0 -> 124 bytes .../textures/item/smoke/pick_overlay.png | Bin 0 -> 118 bytes .../ballistics/textures/item/smoke/vape.png | Bin 0 -> 208 bytes .../textures/item/smoke/vape_overlay.png | Bin 0 -> 120 bytes .../java/llevc/ballistics/Ballistics.java | 10 +- src/main/java/llevc/ballistics/ModItems.java | 137 ++++++++++++++- .../llevc/ballistics/items/SmokeItem.java | 163 ++++++++++++++++++ .../ballistics/recipes/CartridgeRecipe.java | 102 +++++++++++ .../recipes/CartridgeRecipeSerializer.java | 40 +++++ .../ballistics/recipes/GeekedRecipe.java | 103 +++++++++++ .../recipes/GeekedRecipeSerializer.java | 40 +++++ .../llevc/ballistics/recipes/PickRecipe.java | 103 +++++++++++ .../recipes/PickRecipeSerializer.java | 40 +++++ .../ballistics/recipes/SnortableRecipe.java | 36 +--- .../data/ballistics/recipe/cartridge.json | 18 ++ .../ballistics/recipe/cartridge_fill.json | 4 + .../resources/data/ballistics/recipe/cig.json | 20 +++ .../data/ballistics/recipe/geeked_fill.json | 4 + .../data/ballistics/recipe/pick.json | 4 + .../data/ballistics/recipe/pick1.json | 10 ++ .../data/ballistics/recipe/vape.json | 19 ++ .../tags/item/enchantable/durability.json | 5 +- 36 files changed, 995 insertions(+), 45 deletions(-) create mode 100644 src/client/resources/assets/ballistics/items/cartridge.json create mode 100644 src/client/resources/assets/ballistics/items/cig.json create mode 100644 src/client/resources/assets/ballistics/items/pick.json create mode 100644 src/client/resources/assets/ballistics/items/vape.json create mode 100644 src/client/resources/assets/ballistics/models/item/cartridge.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/cig.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/pick.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json create mode 100644 src/client/resources/assets/ballistics/models/item/smoke/vape.json create mode 100644 src/client/resources/assets/ballistics/textures/item/cartridge.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/cig.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/cig_overlay.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/pick.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/pick_overlay.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/vape.png create mode 100644 src/client/resources/assets/ballistics/textures/item/smoke/vape_overlay.png create mode 100644 src/main/java/llevc/ballistics/items/SmokeItem.java create mode 100644 src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java create mode 100644 src/main/java/llevc/ballistics/recipes/GeekedRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java create mode 100644 src/main/java/llevc/ballistics/recipes/PickRecipe.java create mode 100644 src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java create mode 100644 src/main/resources/data/ballistics/recipe/cartridge.json create mode 100644 src/main/resources/data/ballistics/recipe/cartridge_fill.json create mode 100644 src/main/resources/data/ballistics/recipe/cig.json create mode 100644 src/main/resources/data/ballistics/recipe/geeked_fill.json create mode 100644 src/main/resources/data/ballistics/recipe/pick.json create mode 100644 src/main/resources/data/ballistics/recipe/pick1.json create mode 100644 src/main/resources/data/ballistics/recipe/vape.json diff --git a/src/client/resources/assets/ballistics/items/cartridge.json b/src/client/resources/assets/ballistics/items/cartridge.json new file mode 100644 index 0000000..a9d3139 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/cartridge.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ballistics:item/cartridge", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/cig.json b/src/client/resources/assets/ballistics/items/cig.json new file mode 100644 index 0000000..ae0ea6c --- /dev/null +++ b/src/client/resources/assets/ballistics/items/cig.json @@ -0,0 +1,45 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:using_item", + "on_true": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig_overlay" + } + ] + }, + "on_false": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "head", + "model": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig_overlay" + } + ] + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/cig" + } + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/pick.json b/src/client/resources/assets/ballistics/items/pick.json new file mode 100644 index 0000000..84b2b27 --- /dev/null +++ b/src/client/resources/assets/ballistics/items/pick.json @@ -0,0 +1,31 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:has_component", + "component": "minecraft:potion_contents", + "ignore_default": true, + "on_true": { + "type": "minecraft:composite", + "models": [ + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick" + }, + { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick_overlay", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } + ] + }, + "on_false": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/pick" + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/items/vape.json b/src/client/resources/assets/ballistics/items/vape.json new file mode 100644 index 0000000..2c898bb --- /dev/null +++ b/src/client/resources/assets/ballistics/items/vape.json @@ -0,0 +1,12 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ballistics:item/smoke/vape", + "tints": [ + { + "type": "minecraft:potion", + "default": 16777215 + } + ] + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/lang/en_us.json b/src/client/resources/assets/ballistics/lang/en_us.json index b276123..e063f49 100644 --- a/src/client/resources/assets/ballistics/lang/en_us.json +++ b/src/client/resources/assets/ballistics/lang/en_us.json @@ -4,6 +4,7 @@ "item.ballistics.rh_glove": "Rocket Handling Glove", "itemGroup.ballistics": "Ballistics", "itemGroup.ballistics_flasks": "Ballistics Flasks", + "itemGroup.ballistics_geeked": "Ballistics Baked", "item.ballistics.prick": "Prick", "item.ballistics.drink_mixer": "Drink Mixer", "item.ballistics.flintlock_barrel": "Flintlock Barrel", @@ -51,5 +52,10 @@ "item.ballistics.flask.effect.weaving": "Flask of Weaving", "item.ballistics.flask.effect.wind_charged": "Flask of Wind Charging", - "item.ballistics.snortable": "Snortable " + "item.ballistics.snortable": "Snortable ", + "item.ballistics.custom_cig": "Custom Cig", + "item.ballistics.cig": "Cig", + "item.ballistics.vape": "Vape", + "item.ballistics.pick": "Pick", + "item.ballistics.cartridge": "Cartridge" } \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/cartridge.json b/src/client/resources/assets/ballistics/models/item/cartridge.json new file mode 100644 index 0000000..abb63a7 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/cartridge.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ballistics:item/cartridge" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/cig.json b/src/client/resources/assets/ballistics/models/item/smoke/cig.json new file mode 100644 index 0000000..898f812 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/cig.json @@ -0,0 +1,35 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ballistics:item/smoke/cig" + }, + "display": { + "thirdperson_righthand": { + "rotation": [0, -90, 0], + "translation": [-1, -0.5, 0], + "scale": [0.55, 0.55, 0.55] + }, + "thirdperson_lefthand": { + "rotation": [0, 90, 0], + "translation": [-1, -0.5, 0], + "scale": [0.55, 0.55, 0.55] + }, + "firstperson_righthand": { + "rotation": [0, -90, 0], + "translation": [1.13, 3.2, 1.13], + "scale": [0.68, 0.68, 0.68] + }, + "firstperson_lefthand": { + "rotation": [0, 90, 0], + "translation": [1.13, 3.2, 1.13], + "scale": [0.68, 0.68, 0.68] + }, + "head": { + "rotation": [-111.92, -22.6, -146.7], + "translation": [3.25, -5.25, -8.5], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json b/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json new file mode 100644 index 0000000..f687d94 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/cig_overlay.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/cig_overlay" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/pick.json b/src/client/resources/assets/ballistics/models/item/smoke/pick.json new file mode 100644 index 0000000..826f493 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/pick.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/pick" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json b/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json new file mode 100644 index 0000000..3cde251 --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/pick_overlay.json @@ -0,0 +1,8 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/pick_overlay" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/models/item/smoke/vape.json b/src/client/resources/assets/ballistics/models/item/smoke/vape.json new file mode 100644 index 0000000..3b6308e --- /dev/null +++ b/src/client/resources/assets/ballistics/models/item/smoke/vape.json @@ -0,0 +1,9 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "parent": "ballistics:item/smoke/cig", + "textures": { + "layer0": "ballistics:item/smoke/vape_overlay", + "layer1": "ballistics:item/smoke/vape" + } +} \ No newline at end of file diff --git a/src/client/resources/assets/ballistics/textures/item/cartridge.png b/src/client/resources/assets/ballistics/textures/item/cartridge.png new file mode 100644 index 0000000000000000000000000000000000000000..edc27a82abb689a76accd208c3d74b8b5ed33352 GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Y&=~YLo9le z6C_x-unP$Z{nxzo=RXiIF)=NXX1ZMS|KH#L>i+Xo&I)vy9Byc6VE8#}BClffXAK28 a28M?1nuU`CFPQ+%VeoYIb6Mw<&;$TALn;ga literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/cig.png b/src/client/resources/assets/ballistics/textures/item/smoke/cig.png new file mode 100644 index 0000000000000000000000000000000000000000..74eebe2a12351565732398ad99a2029d4ca705ae GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|tUX;ELo9le z6C@%J_=Z2R-z6ceIqUBllZ{eNQ=VzQ-1h(F`pR>2EdQ^M-|si`nPu^_9*MIj+9s^6 b%wS?DcyF)5y!YUDpfL=du6{1-oD!M{HvW7zCspxWLT7P|I;8OGxY+P%(q2tDnm{r-UW|JwYEI literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/pick.png b/src/client/resources/assets/ballistics/textures/item/smoke/pick.png new file mode 100644 index 0000000000000000000000000000000000000000..1552d6419ffa3b900ec80d85611e55ed3b605e5c GIT binary patch literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|%sgEjLo9le z6C@%ZoO*QW|9}1Uf9!Xd7z-|rynUdh@!@OjPr3imdKI;Vst0K!2hQUCw| literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/ballistics/textures/item/smoke/vape.png b/src/client/resources/assets/ballistics/textures/item/smoke/vape.png new file mode 100644 index 0000000000000000000000000000000000000000..29090b060d53a79258c8fbf6914e7cd114b05d72 GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|x;$MRLo9la zPTI(KSb@hy|KygTe~DWM4fs GenericItem register(String name, Funct public static void initialize() { Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsItemGroupKey,BallisticsItemGroup); Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsFlaskItemGroupKey,BallisticsFlaskItemGroup); + Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,BallisticsBakedItemGroupKey,BallisticsBakedItemGroup); ItemGroupEvents.modifyEntriesEvent(BallisticsItemGroupKey).register(itemGroup -> { itemGroup.accept(rhGlove); @@ -60,6 +64,11 @@ public static void initialize() { itemGroup.accept(EmptyFlask); itemGroup.accept(DragonsFlask); itemGroup.accept(PotionContents.createItemStack(ModItems.Flask, Potions.WATER)); + itemGroup.accept(snortable); + itemGroup.accept(pick); + itemGroup.accept(cig); + itemGroup.accept(vape); + itemGroup.accept(cartridge); }); ItemGroupEvents.modifyEntriesEvent(BallisticsFlaskItemGroupKey).register(itemGroup -> { itemGroup.accept(DrinkMixer); @@ -73,6 +82,60 @@ public static void initialize() { } } }); + ItemGroupEvents.modifyEntriesEvent(BallisticsBakedItemGroupKey).register(itemGroup -> { + itemGroup.accept(pick); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(pick,Holder.direct(hey))); + } + } + itemGroup.accept(cig); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + ItemStack yo = PotionContents.createItemStack(cig,Holder.direct(hey)); + yo.set(DataComponents.ITEM_NAME,Component.translatable("item.ballistics.custom_cig")); + itemGroup.accept(yo); + } + } + itemGroup.accept(vape); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(vape,Holder.direct(hey))); + } + } + itemGroup.accept(cartridge); + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + itemGroup.accept(PotionContents.createItemStack(cartridge,Holder.direct(hey))); + } + } + itemGroup.accept(snortable); + for (int i = 0; i < BuiltInRegistries.BLOCK.size(); i++) { + Optional> wchat = BuiltInRegistries.BLOCK.get(i); + if (wchat.isPresent()) { + Block hey = wchat.get().value(); + itemGroup.accept(createSnortable(hey)); + } + } + for (int i = 0; i < BuiltInRegistries.POTION.size(); i++) { + Optional> wchat = BuiltInRegistries.POTION.get(i); + if (wchat.isPresent()) { + Potion hey = wchat.get().value(); + ItemStack yo = PotionContents.createItemStack(snortable,Holder.direct(hey)); + yo.set(DataComponents.DYED_COLOR,new DyedItemColor(yo.getOrDefault(DataComponents.POTION_CONTENTS,PotionContents.EMPTY).getColorOr(CommonColors.WHITE))); + yo.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(hey.name())); + itemGroup.accept(yo); + } + } + }); } public static final Item EmptyFlask = register( @@ -149,10 +212,76 @@ public static void initialize() { new Item.Properties().stacksTo(16) .component(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(0.8f).animation(ItemUseAnimation.SPYGLASS).build()) .component(DataComponents.TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT.withHidden(DataComponents.DYED_COLOR,true)) + .component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) + .component(DataComponents.DYED_COLOR,new DyedItemColor(CommonColors.WHITE)) + ); + public static final PotionContents cigContents = new PotionContents(Optional.empty(),Optional.empty(),List.of( + new MobEffectInstance(MobEffects.REGENERATION,45*20), + new MobEffectInstance(MobEffects.NAUSEA,45*20) + ),Optional.empty()); + public static final Item cig = register( + "cig", + SmokeItem::new, + new Item.Properties().durability(32).component(DataComponents.POTION_CONTENTS, cigContents).equippable(EquipmentSlot.HEAD) + ); + public static final Item vape = register( + "vape", + SmokeItem::new, + new Item.Properties().durability(64).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).repairable(ItemTags.REPAIRS_IRON_ARMOR) + ); + public static final Item pick = register( + "pick", + SmokeItem::new, + new Item.Properties().durability(8).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).equippable(EquipmentSlot.HEAD) ); + public static final Item cartridge = register( + "cartridge", + Item::new, + new Item.Properties().component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY) + ); + public static ItemStack createSnortable(Block block) { + ItemStack yes = new ItemStack(ModItems.snortable); + List effectInstanceList = new ArrayList<>(); + + if (block.getFriction() > 0.75) { // slippppery + effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); + } + if (block.getSpeedFactor() < 1) { // is it sticky? + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); + } + if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one + effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); + } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy + effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); + } + if (block instanceof InfestedBlock) { // is infested? + effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); + } else if (block instanceof SlimeBlock) { // slimme + effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); + } else if (block instanceof TntBlock) { + effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); + } else if (block instanceof WebBlock) { // cobweb + effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); + } + if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break + effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); + effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); + } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break + effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); + } + + PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); + yes.set(DataComponents.POTION_CONTENTS,huh); + yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); + yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); + yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + return yes; + } public static final ResourceKey BallisticsItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics")); public static final CreativeModeTab BallisticsItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(Items.FIREWORK_ROCKET)).title(Component.translatable("itemGroup.ballistics")).build(); public static final ResourceKey BallisticsFlaskItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics_flasks")); public static final CreativeModeTab BallisticsFlaskItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(EmptyFlask)).title(Component.translatable("itemGroup.ballistics_flasks")).build(); + public static final ResourceKey BallisticsBakedItemGroupKey = ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), ResourceLocation.fromNamespaceAndPath(Ballistics.MOD_ID, "ballistics_geeked")); + public static final CreativeModeTab BallisticsBakedItemGroup = FabricItemGroup.builder().icon(() -> new ItemStack(vape)).title(Component.translatable("itemGroup.ballistics_geeked")).build(); } diff --git a/src/main/java/llevc/ballistics/items/SmokeItem.java b/src/main/java/llevc/ballistics/items/SmokeItem.java new file mode 100644 index 0000000..c47a038 --- /dev/null +++ b/src/main/java/llevc/ballistics/items/SmokeItem.java @@ -0,0 +1,163 @@ +package llevc.ballistics.items; + +import llevc.ballistics.Ballistics; +import llevc.ballistics.ModItems; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ParticleUtils; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.enchantment.effects.SpawnParticlesEffect; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Iterator; +import java.util.List; + +public class SmokeItem extends Item { + + public SmokeItem(Properties properties) { + super(properties); + } + + public boolean smokeParticles() { + if (this.equals(ModItems.pick)) { + return false; + } + return true; + } + + public float applyRate() { + return 40; + } + + @Override + public InteractionResult use(Level level, Player player, InteractionHand interactionHand) { + if (!level.isClientSide()) { + player.startUsingItem(interactionHand); + } + return InteractionResult.CONSUME; + } + + @Override + public void onUseTick(Level level, LivingEntity livingEntity, ItemStack itemStack, int i) { + if (level.isClientSide()) { + return; + } + Ballistics.LOGGER.info(String.valueOf(i)); + if (Math.round(i/applyRate()) == i/applyRate() || i <= 1) { + for (MobEffectInstance nah : itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects()) { + MobEffectInstance yah = nah.withScaledDuration(1 / 5f); + livingEntity.forceAddEffect(yah,livingEntity); + } + itemStack.hurtAndBreak(1,livingEntity,livingEntity.getUsedItemHand()); + if (i <= 1) { + livingEntity.stopUsingItem(); + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack,getUseDuration(itemStack, livingEntity)*2); + } + } + } + } + + public void spawnSmokeParticles(Level level, LivingEntity livingEntity) { + if (smokeParticles()) { + for (int j = 0; j < 5; j++) { + ParticleUtils.spawnParticleBelow(level, new BlockPos((int) livingEntity.getEyePosition().x, (int) livingEntity.getEyePosition().y, (int) livingEntity.getEyePosition().z), RandomSource.create(), ParticleTypes.POOF); + } + } + } + + public void sendSmokeParticles(ServerLevel serverLevel, LivingEntity livingEntity) { + if (smokeParticles()) { + for (int j = 0; j < 5; j++) { + RandomSource randomSource = RandomSource.create(); + serverLevel.sendParticles(ParticleTypes.POOF,livingEntity.getEyePosition().x+randomSource.nextDouble()-0.5, livingEntity.getEyePosition().y, livingEntity.getEyePosition().z+randomSource.nextDouble()-0.5,0,0,0,0,0); + //ParticleUtils.spawnParticleBelow(level, new BlockPos((int) livingEntity.getEyePosition().x, (int) livingEntity.getEyePosition().y, (int) livingEntity.getEyePosition().z), RandomSource.create(), ParticleTypes.POOF); + } + } + } + + @Override + public boolean releaseUsing(ItemStack itemStack, Level level, LivingEntity livingEntity, int i) { + if (level.isClientSide()) { + //spawnSmokeParticles(level,livingEntity); + return false; + } + if (level instanceof ServerLevel serverLevel) { + sendSmokeParticles(serverLevel,livingEntity); + } + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack,(getUseDuration(itemStack, livingEntity)-i)*2); + } + return false; + } + + @Override + public ItemUseAnimation getUseAnimation(ItemStack itemStack) { + return ItemUseAnimation.TOOT_HORN; + } + + @Override + public int getUseDuration(ItemStack itemStack, LivingEntity livingEntity) { + if (itemStack.is(ModItems.pick)) { + return 20*2; + } else if (itemStack.is(ModItems.vape)) { + return 20*12; + } + return 20*6; + } + + public int ticksUsed = 0; + @Override + public void inventoryTick(ItemStack itemStack, ServerLevel serverLevel, Entity entity, @Nullable EquipmentSlot equipmentSlot) { + if (equipmentSlot == EquipmentSlot.HEAD) { + if (entity instanceof LivingEntity livingEntity) { + boolean cooldown = false; + int woah = getUseDuration(itemStack, livingEntity) - ticksUsed; + + if (entity instanceof Player player) { + cooldown = player.getCooldowns().isOnCooldown(itemStack); + } + + if (livingEntity.isCrouching() && !cooldown) { + Ballistics.LOGGER.info(String.valueOf(getUseDuration(itemStack, livingEntity))); + if (Math.round(woah / applyRate()) == woah / applyRate() || woah <= 1) { + for (MobEffectInstance nah : itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects()) { + MobEffectInstance yah = nah.withScaledDuration(1 / 5f); + livingEntity.forceAddEffect(yah, livingEntity); + } + if (!(itemStack.is(ModItems.pick) && itemStack.getOrDefault(DataComponents.POTION_CONTENTS,PotionContents.EMPTY) == PotionContents.EMPTY)) { + itemStack.hurtAndBreak(1, livingEntity, equipmentSlot); + } + if (woah <= 1) { + livingEntity.stopUsingItem(); + if (livingEntity instanceof Player player) { + player.getCooldowns().addCooldown(itemStack, getUseDuration(itemStack, livingEntity) * 2); + } + } + } + ticksUsed++; + } else if ((!livingEntity.isCrouching() || cooldown) && ticksUsed > 0) { + ticksUsed = 0; + releaseUsing(itemStack,serverLevel,livingEntity,woah); + } + } + } + } +} diff --git a/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java b/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java new file mode 100644 index 0000000..3c6b23a --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/CartridgeRecipe.java @@ -0,0 +1,102 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class CartridgeRecipe extends CustomRecipe { + public CartridgeRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.cartridge)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.cartridge)) { + + if (!flask) { + flask = true; + } else { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && flask && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = PotionContents.createItemStack(ModItems.cartridge, death.potion().orElse(Potions.WATER)); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return CartridgeRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java new file mode 100644 index 0000000..aac1309 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/CartridgeRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class CartridgeRecipeSerializer implements RecipeSerializer { + public static final CartridgeRecipeSerializer INSTANCE = new CartridgeRecipeSerializer(CartridgeRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_cartridge_fill"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public CartridgeRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java b/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java new file mode 100644 index 0000000..d9ecbb9 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/GeekedRecipe.java @@ -0,0 +1,103 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class GeekedRecipe extends CustomRecipe { + public GeekedRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(ModItems.cartridge)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.vape)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + ItemStack geek = ItemStack.EMPTY; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(ModItems.cartridge)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.vape)) { + + if (geek.isEmpty()) { + geek = itemStack; + } else { + overflow = true; + } + + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && !geek.isEmpty() && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = geek.copy(); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return GeekedRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java new file mode 100644 index 0000000..e729305 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/GeekedRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class GeekedRecipeSerializer implements RecipeSerializer { + public static final GeekedRecipeSerializer INSTANCE = new GeekedRecipeSerializer(GeekedRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_geeked"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public GeekedRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/PickRecipe.java b/src/main/java/llevc/ballistics/recipes/PickRecipe.java new file mode 100644 index 0000000..696e068 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/PickRecipe.java @@ -0,0 +1,103 @@ +package llevc.ballistics.recipes; + +import llevc.ballistics.ModItems; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.level.Level; + +import java.util.List; +import java.util.Objects; + +public class PickRecipe extends CustomRecipe { + public PickRecipe(CraftingBookCategory craftingBookCategory) { + super(craftingBookCategory); + } + + public boolean matches(CraftingInput recipeInput, Level level) { + boolean potion = false; + boolean flask = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + if (!potion) { + potion = true; + } else { + return false; + } + } else if (itemStack.is(ModItems.pick)) { + if (!flask) { + flask = true; + } else { + return false; + } + } else { + return false; + } + } + return (potion && flask && recipeInput.ingredientCount() <= 2); + } + + public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provider) { + ItemStack result = ItemStack.EMPTY; + ItemStack potion = ItemStack.EMPTY; + boolean flask = false; + boolean overflow = false; + + for (int i = 0; i < recipeInput.size(); i++) { + ItemStack itemStack = recipeInput.getItem(i); + if (itemStack.is(Items.POTION)) { + + if (potion.isEmpty()) { + potion = itemStack; + } else { + overflow = true; + } + + } else if (itemStack.is(ModItems.pick)) { + + if (!flask) { + flask = true; + } else { + overflow = true; + } + } else if (!itemStack.isEmpty()) { + overflow = true; + } + } + + if (!potion.isEmpty() && flask && !overflow) { + PotionContents death = Objects.requireNonNull(potion.get(DataComponents.POTION_CONTENTS)); + double level = 0; + List effects = new java.util.ArrayList<>(List.of()); + for (MobEffectInstance mobEffectInstance : death.getAllEffects()) { + level = level+mobEffectInstance.getAmplifier()+1; + if (!effects.contains(mobEffectInstance.getEffect().getRegisteredName())) { + effects.add(mobEffectInstance.getEffect().getRegisteredName()); + } + } + //Ballistics.LOGGER.info(String.valueOf(death)); + ItemStack gamer; + gamer = PotionContents.createItemStack(ModItems.pick, death.potion().orElse(Potions.WATER)); + gamer.set(DataComponents.POTION_CONTENTS, death); + result = gamer; + } + + return result; + } + + @Override + public RecipeSerializer getSerializer() { + return PickRecipeSerializer.INSTANCE; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java b/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java new file mode 100644 index 0000000..66e9141 --- /dev/null +++ b/src/main/java/llevc/ballistics/recipes/PickRecipeSerializer.java @@ -0,0 +1,40 @@ +package llevc.ballistics.recipes; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; + +public class PickRecipeSerializer implements RecipeSerializer { + public static final PickRecipeSerializer INSTANCE = new PickRecipeSerializer(PickRecipe::new); + public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("ballistics","crafting_special_pick"); + + + + private final MapCodec codec; + private final StreamCodec streamCodec; + + public PickRecipeSerializer(CustomRecipe.Serializer.Factory factory) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group(CraftingBookCategory.CODEC.fieldOf("category").orElse(CraftingBookCategory.MISC).forGetter(CraftingRecipe::category)) + .apply(instance, factory::create) + ); + this.streamCodec = StreamCodec.composite(CraftingBookCategory.STREAM_CODEC, CraftingRecipe::category, factory::create); + } + + @Override + public @NotNull MapCodec codec() { + return codec; + } + + @Override + public @NotNull StreamCodec streamCodec() { + return streamCodec; + } +} diff --git a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java index 6da53cc..6e3e856 100644 --- a/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java +++ b/src/main/java/llevc/ballistics/recipes/SnortableRecipe.java @@ -93,41 +93,7 @@ public ItemStack assemble(CraftingInput recipeInput, HolderLookup.Provider provi } if (!overflow && flask && block != Blocks.AIR) { - ItemStack yes = new ItemStack(ModItems.snortable); - List effectInstanceList = new ArrayList<>(); - - if (block.getFriction() > 0.75) { // slippppery - effectInstanceList.add(new MobEffectInstance(MobEffects.SPEED, (int) Math.ceil(400/block.getFriction()))); - } - if (block.getSpeedFactor() < 1) { // is it sticky? - effectInstanceList.add(new MobEffectInstance(MobEffects.SLOWNESS, (int) Math.ceil(200/block.getSpeedFactor()))); - } - if (block.getJumpFactor() < 1) { // sticky 2, only honey has this one - effectInstanceList.add(new MobEffectInstance(MobEffects.SLOW_FALLING,(int) Math.ceil(200/block.getJumpFactor()))); - } else if (block.getJumpFactor() > 1) { // bouncy but not bouncy - effectInstanceList.add(new MobEffectInstance(MobEffects.JUMP_BOOST,(int) Math.ceil(200*block.getJumpFactor()))); - } - if (block instanceof InfestedBlock) { // is infested? - effectInstanceList.add(new MobEffectInstance(MobEffects.INFESTED,60*20)); - } else if (block instanceof SlimeBlock) { // slimme - effectInstanceList.add(new MobEffectInstance(MobEffects.OOZING,600)); - } else if (block instanceof TntBlock) { - effectInstanceList.add(new MobEffectInstance(ModItems.ExplodePotionEffect)); - } else if (block instanceof WebBlock) { // cobweb - effectInstanceList.add(new MobEffectInstance(MobEffects.WEAVING,1200)); - } - if (block.defaultDestroyTime() > 20 || block.defaultDestroyTime() < 0) { // long/impossible to break - effectInstanceList.add(new MobEffectInstance(MobEffects.MINING_FATIGUE, 1000)); - effectInstanceList.add(new MobEffectInstance(MobEffects.RESISTANCE,1000)); - } else if (block.defaultDestroyTime() < 0.5 && block.defaultDestroyTime() >= 0) { // instant break - effectInstanceList.add(new MobEffectInstance(MobEffects.HASTE, (int) Math.ceil(200/(0.5+block.defaultDestroyTime())))); - } - - PotionContents huh = new PotionContents(Optional.of(BuiltInRegistries.POTION.wrapAsHolder(ModItems.MixedPotion)),Optional.empty(),effectInstanceList,Optional.empty()); - yes.set(DataComponents.POTION_CONTENTS,huh); - yes.set(DataComponents.DYED_COLOR, new DyedItemColor(block.defaultMapColor().col)); - yes.set(DataComponents.ITEM_NAME, Component.translatable("item.ballistics.snortable").append(block.getName())); - yes.set(DataComponents.CONSUMABLE, Consumables.defaultFood().consumeSeconds(Math.abs(block.defaultDestroyTime()/3)).animation(ItemUseAnimation.SPYGLASS).build()); + ItemStack yes = ModItems.createSnortable(block); result = yes; } diff --git a/src/main/resources/data/ballistics/recipe/cartridge.json b/src/main/resources/data/ballistics/recipe/cartridge.json new file mode 100644 index 0000000..fa24e81 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cartridge.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "cac", + "aba", + "cac" + ], + "key": { + "a": "minecraft:iron_ingot", + "b": "minecraft:glass_bottle", + "c": "minecraft:paper" + }, + "result": { + "id": "ballistics:cartridge", + "count": 16 + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/cartridge_fill.json b/src/main/resources/data/ballistics/recipe/cartridge_fill.json new file mode 100644 index 0000000..5271035 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cartridge_fill.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_cartridge_fill", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/cig.json b/src/main/resources/data/ballistics/recipe/cig.json new file mode 100644 index 0000000..7019da6 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/cig.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "dbe", + "bab", + "cbd" + ], + "key": { + "a": "minecraft:slime_ball", + "b": "minecraft:paper", + "c": "minecraft:honey_bottle", + "d": "minecraft:iron_nugget", + "e": "minecraft:string" + }, + "result": { + "id": "ballistics:cig", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/geeked_fill.json b/src/main/resources/data/ballistics/recipe/geeked_fill.json new file mode 100644 index 0000000..c7d5ddb --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/geeked_fill.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_geeked", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/pick.json b/src/main/resources/data/ballistics/recipe/pick.json new file mode 100644 index 0000000..73be7cf --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/pick.json @@ -0,0 +1,4 @@ +{ + "type": "ballistics:crafting_special_pick", + "category": "equipment" +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/pick1.json b/src/main/resources/data/ballistics/recipe/pick1.json new file mode 100644 index 0000000..49e9c3c --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/pick1.json @@ -0,0 +1,10 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "equipment", + "ingredients": [ + "minecraft:stick" + ], + "result": { + "id": "ballistics:pick" + } +} \ No newline at end of file diff --git a/src/main/resources/data/ballistics/recipe/vape.json b/src/main/resources/data/ballistics/recipe/vape.json new file mode 100644 index 0000000..c01d759 --- /dev/null +++ b/src/main/resources/data/ballistics/recipe/vape.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "dae", + "aba", + "cad" + ], + "key": { + "a": "minecraft:iron_ingot", + "b": "minecraft:slime_block", + "c": "minecraft:honey_bottle", + "d": "minecraft:paper", + "e": "minecraft:string" + }, + "result": { + "id": "ballistics:vape" + } +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/item/enchantable/durability.json b/src/main/resources/data/minecraft/tags/item/enchantable/durability.json index 9611348..cbec1bd 100644 --- a/src/main/resources/data/minecraft/tags/item/enchantable/durability.json +++ b/src/main/resources/data/minecraft/tags/item/enchantable/durability.json @@ -2,6 +2,9 @@ "replace": false, "values": [ "ballistics:rh_glove", - "ballistics:flintlock" + "ballistics:flintlock", + "ballistics:pick", + "ballistics:cig", + "ballistics:vape" ] } \ No newline at end of file From 324a3185b527dd453fc732341fff6ff9dfe8243c Mon Sep 17 00:00:00 2001 From: LLEVC <71854739+LLEVC@users.noreply.github.com> Date: Sun, 5 Apr 2026 15:33:09 -0700 Subject: [PATCH 9/9] quickly just actually fixing this --- src/main/java/llevc/ballistics/Ballistics.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/llevc/ballistics/Ballistics.java b/src/main/java/llevc/ballistics/Ballistics.java index dcec6e0..9a84e02 100644 --- a/src/main/java/llevc/ballistics/Ballistics.java +++ b/src/main/java/llevc/ballistics/Ballistics.java @@ -31,6 +31,7 @@ public void onInitialize() { Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, PickRecipeSerializer.ID, PickRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, CartridgeRecipeSerializer.ID, CartridgeRecipeSerializer.INSTANCE); Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, GeekedRecipeSerializer.ID, GeekedRecipeSerializer.INSTANCE); + Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, FlintlockLoadRecipeSerializer.ID, FlintlockLoadRecipeSerializer.INSTANCE); LOGGER.info("if you read this you're prolly gonna be touched within the next 16 hours"); }