Bubble Pipe

This commit is contained in:
Vos
2026-03-14 20:48:02 -05:00
parent 4fc01cc748
commit 327855e057
13 changed files with 183 additions and 24 deletions
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_birch_planks": {
"conditions": {
"items": [
{
"items": "minecraft:birch_planks"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:bubble_pipe"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_birch_planks"
]
],
"rewards": {
"recipes": [
"acesbs:bubble_pipe"
]
}
}
@@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"item": "minecraft:iron_ingot"
},
"P": {
"item": "minecraft:birch_planks"
}
},
"pattern": [
" #",
"PPP",
" "
],
"result": {
"count": 1,
"id": "acesbs:bubble_pipe"
}
}
@@ -1,4 +1,3 @@
Bubble Pipe + Pale Wood + Vanilla Wood Types
Ahab's Harpoon Ahab's Harpoon
Aquarium Gravel Aquarium Gravel
Burning Wizard (Infernal Ashes on a Villager) Burning Wizard (Infernal Ashes on a Villager)
@@ -22,6 +22,9 @@ public class ModDataComponentTypes {
public static final ComponentType<String> COMMAND = public static final ComponentType<String> COMMAND =
register("command", stringBuilder -> stringBuilder.codec(Codec.STRING).packetCodec(PacketCodecs.STRING)); register("command", stringBuilder -> stringBuilder.codec(Codec.STRING).packetCodec(PacketCodecs.STRING));
// public static final ComponentType<Integer> PIPE_VARIANT =
// register("pipe_variant", integerBuilder -> integerBuilder.codec(Codec.INT).packetCodec(PacketCodecs.INTEGER));
public static final ComponentType<Boolean> COMMAND_ACTIVE = public static final ComponentType<Boolean> COMMAND_ACTIVE =
register("command_active", booleanBuilder -> booleanBuilder.codec(Codec.BOOL).packetCodec(PacketCodecs.BOOL)); register("command_active", booleanBuilder -> booleanBuilder.codec(Codec.BOOL).packetCodec(PacketCodecs.BOOL));
@@ -194,6 +194,15 @@ public class ModRecipeProvider extends FabricRecipeProvider {
.criterion(hasItem(ModBlocks.STRIPPED_LEMONWOOD_LOG), conditionsFromItem(ModBlocks.STRIPPED_LEMONWOOD_LOG)) .criterion(hasItem(ModBlocks.STRIPPED_LEMONWOOD_LOG), conditionsFromItem(ModBlocks.STRIPPED_LEMONWOOD_LOG))
.offerTo(recipeExporter); .offerTo(recipeExporter);
ShapedRecipeJsonBuilder.create(RecipeCategory.FOOD, ModItems.BUBBLE_PIPE, 1)
.pattern(" #")
.pattern("PPP")
.pattern(" ")
.input('#', Items.IRON_INGOT)
.input('P', Blocks.BIRCH_PLANKS)
.criterion(hasItem(Blocks.BIRCH_PLANKS), conditionsFromItem(Blocks.BIRCH_PLANKS))
.offerTo(recipeExporter);
createStairsRecipe(ModBlocks.LEMONWOOD_STAIRS, Ingredient.ofItems(ModBlocks.LEMONWOOD_PLANKS)) createStairsRecipe(ModBlocks.LEMONWOOD_STAIRS, Ingredient.ofItems(ModBlocks.LEMONWOOD_PLANKS))
.criterion(hasItem(ModBlocks.LEMONWOOD_PLANKS), conditionsFromItem(ModBlocks.LEMONWOOD_PLANKS)) .criterion(hasItem(ModBlocks.LEMONWOOD_PLANKS), conditionsFromItem(ModBlocks.LEMONWOOD_PLANKS))
.offerTo(recipeExporter); .offerTo(recipeExporter);
@@ -38,6 +38,7 @@ public class ModItemGroups {
entries.add(ModItems.CIGARETTE); entries.add(ModItems.CIGARETTE);
entries.add(ModItems.CIGARETTE_LEMON); entries.add(ModItems.CIGARETTE_LEMON);
entries.add(ModItems.CIGARETTE_FUNNY); entries.add(ModItems.CIGARETTE_FUNNY);
entries.add(ModItems.BUBBLE_PIPE);
entries.add(ModItems.FREN_SPAWN_EGG); entries.add(ModItems.FREN_SPAWN_EGG);
entries.add(ModItems.VULGAR_BONES_SPAWN_EGG); entries.add(ModItems.VULGAR_BONES_SPAWN_EGG);
}) })
@@ -205,6 +205,7 @@ public class ModItems {
public static final Item CIGARETTE = registerItem("cigarette", new Cigarette(new Item.Settings().maxCount(20))); public static final Item CIGARETTE = registerItem("cigarette", new Cigarette(new Item.Settings().maxCount(20)));
public static final Item CIGARETTE_LEMON = registerItem("cigarette_lemon", new CigaretteLemon(new Item.Settings().maxCount(20))); public static final Item CIGARETTE_LEMON = registerItem("cigarette_lemon", new CigaretteLemon(new Item.Settings().maxCount(20)));
public static final Item CIGARETTE_FUNNY = registerItem("cigarette_funny", new CigaretteFunny(new Item.Settings().maxCount(20))); public static final Item CIGARETTE_FUNNY = registerItem("cigarette_funny", new CigaretteFunny(new Item.Settings().maxCount(20)));
public static final Item BUBBLE_PIPE = registerItem("bubble_pipe", new BubblePipe(new Item.Settings().maxCount(1)));
public static final Item FREN_SPAWN_EGG = registerItem("fren_spawn_egg", public static final Item FREN_SPAWN_EGG = registerItem("fren_spawn_egg",
new SpawnEggItem(ModEntities.FREN, 894731, 0, new Item.Settings())); new SpawnEggItem(ModEntities.FREN, 894731, 0, new Item.Settings()));
@@ -1,9 +1,13 @@
package com.acethewildfire.acesbs.item.custom; package com.acethewildfire.acesbs.item.custom;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.component.ModDataComponentTypes; import com.acethewildfire.acesbs.component.ModDataComponentTypes;
import com.acethewildfire.acesbs.effect.ModEffects; import com.acethewildfire.acesbs.effect.ModEffects;
import com.acethewildfire.acesbs.item.ModItems; import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.sounds.ModSounds;
import com.acethewildfire.acesbs.sounds.PlayerAttachedSound;
import com.acethewildfire.acesbs.util.ModStats; import com.acethewildfire.acesbs.util.ModStats;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -28,6 +32,9 @@ public class BubblePipe extends Item {
super(settings); super(settings);
} }
// Store the currently playing sound (client only)
private static PlayerAttachedSound activeSound;
@Override @Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) { public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (!user.getItemCooldownManager().isCoolingDown(this)) { if (!user.getItemCooldownManager().isCoolingDown(this)) {
@@ -41,6 +48,12 @@ public class BubblePipe extends Item {
@Override @Override
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
super.onStoppedUsing(stack, world, user, remainingUseTicks); super.onStoppedUsing(stack, world, user, remainingUseTicks);
if (activeSound != null) {
MinecraftClient.getInstance().getSoundManager().stop(activeSound);
activeSound = null;
}
stack.set(ModDataComponentTypes.SMOKING, false); stack.set(ModDataComponentTypes.SMOKING, false);
} }
@@ -56,7 +69,7 @@ public class BubblePipe extends Item {
@Override @Override
public int getMaxUseTime(ItemStack stack, LivingEntity user) { public int getMaxUseTime(ItemStack stack, LivingEntity user) {
return 50; return 72000; // basically infinite hold
} }
@Override @Override
@@ -69,21 +82,18 @@ public class BubblePipe extends Item {
Vec3d look = user.getRotationVec(1.0f); Vec3d look = user.getRotationVec(1.0f);
// Spawn position (near mouth) // Spawn position (near mouth)
double x = user.getX() + look.x * 0.3; double x = user.getX() + look.x * 0.75;
double y = user.getEyeY() - 0.15; double y = user.getEyeY() - 0.15;
double z = user.getZ() + look.z * 0.3; double z = user.getZ() + look.z * 0.75;
// Base outward velocity
double speed = 0.08;
// Add small randomness so it spreads naturally // Add small randomness so it spreads naturally
double vx = look.x * speed + (world.random.nextDouble() - 0.5) * 0.02; double vx = (world.random.nextDouble() - 0.5) * 0.01;
double vy = 0.02 + (world.random.nextDouble() * 0.02); // slight upward drift double vy = 0.1 + (world.random.nextDouble() * 0.02);
double vz = look.z * speed + (world.random.nextDouble() - 0.5) * 0.02; double vz = (world.random.nextDouble() - 0.5) * 0.01;
if (remainingUseTicks % 4 == 0) { if (remainingUseTicks % 4 == 0) {
world.addParticle( world.addParticle(
ParticleTypes.SMOKE, ParticleTypes.BUBBLE_POP,
x, y, z, x, y, z,
vx, vy, vz vx, vy, vz
); );
@@ -98,14 +108,13 @@ public class BubblePipe extends Item {
user.getX(), user.getX(),
user.getY(), user.getY(),
user.getZ(), user.getZ(),
SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT,
SoundCategory.PLAYERS, SoundCategory.PLAYERS,
1.0f, 1.0f,
1.0f 1.0f
); );
} }
} }
} }
@Override @Override
@@ -122,19 +131,8 @@ public class BubblePipe extends Item {
if (!world.isClient) { if (!world.isClient) {
player.incrementStat(ModStats.CIGARETTES_USED); player.incrementStat(ModStats.CIGARETTES_USED);
player.incrementStat(Stats.USED.getOrCreateStat(ModItems.CIGARETTE));
if (player instanceof ServerPlayerEntity s_player){
int uses = s_player.getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(ModStats.CIGARETTES_USED));
if (uses >= 500) {
grantAdvancement(s_player, "500_cigarettes");
}
}
} }
} }
return stack; return stack;
} }
} }
@@ -25,6 +25,12 @@ public class ModModelPredicates {
ModelPredicateProviderRegistry.register(ModItems.CIGARETTE_LEMON, Identifier.of(AcesBS.MOD_ID, "smoking"), ModelPredicateProviderRegistry.register(ModItems.CIGARETTE_LEMON, Identifier.of(AcesBS.MOD_ID, "smoking"),
(stack, world, entity, seed) -> Boolean.TRUE.equals(stack.get(ModDataComponentTypes.SMOKING)) ? 1f : 0f); (stack, world, entity, seed) -> Boolean.TRUE.equals(stack.get(ModDataComponentTypes.SMOKING)) ? 1f : 0f);
ModelPredicateProviderRegistry.register(ModItems.BUBBLE_PIPE, Identifier.of(AcesBS.MOD_ID, "smoking"),
(stack, world, entity, seed) -> Boolean.TRUE.equals(stack.get(ModDataComponentTypes.SMOKING)) ? 1f : 0f);
// ModelPredicateProviderRegistry.register(ModItems.BUBBLE_PIPE, Identifier.of(AcesBS.MOD_ID, "pipe_variant"),
// (stack, world, entity, seed) -> stack.get(ModDataComponentTypes.PIPE_VARIANT));
registerCustomBow(ModItems.KAUPEN_BOW); registerCustomBow(ModItems.KAUPEN_BOW);
} }
@@ -71,6 +71,7 @@
"item.acesbs.cigarette": "Cigarette", "item.acesbs.cigarette": "Cigarette",
"item.acesbs.cigarette_lemon": "Cigarette", "item.acesbs.cigarette_lemon": "Cigarette",
"item.acesbs.cigarette_funny": "Hazy Cigarette", "item.acesbs.cigarette_funny": "Hazy Cigarette",
"item.acesbs.bubble_pipe": "Bubble Pipe",
"item.acesbs.fren_spawn_egg": "Fren Spawn Egg", "item.acesbs.fren_spawn_egg": "Fren Spawn Egg",
"item.acesbs.vulgar_bones_spawn_egg": "Vulgar Bones Spawn Egg", "item.acesbs.vulgar_bones_spawn_egg": "Vulgar Bones Spawn Egg",
@@ -0,0 +1,50 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "acesbs:item/birch_pipe"
},
"display": {
"thirdperson_righthand": {
"rotation": [-34.6, 74.81, 7.18],
"translation": [-1.5, 2.25, 0.5],
"scale": [0.5, 0.5, 0.5]
},
"thirdperson_lefthand": {
"rotation": [-156.57, -78.01, -155.53],
"translation": [-1, 2, 1.75],
"scale": [0.5, 0.5, 0.5]
},
"firstperson_righthand": {
"rotation": [-180, 87, 144],
"translation": [0.5, -1.5, -11]
},
"firstperson_lefthand": {
"rotation": [0, -81, 5],
"translation": [0, -2.5, -7.5]
},
"ground": {
"rotation": [90, -105, 0],
"translation": [-1.5, -3, 1],
"scale": [0.5, 0.5, 0.51]
},
"head": {
"rotation": [0, 69, 0],
"translation": [3.25, -5.25, -10.75],
"scale": [0.75, 0.75, 0.75]
}
},
"overrides": [
{
"predicate": {
"acesbs:smoking": 1
},
"model": "acesbs:item/smoking_bubble_pipe"
},
{
"predicate": {
"acesbs:pipe_variant": 1
},
"model": "acesbs:item/birch_pipe"
}
]
}
@@ -0,0 +1,38 @@
{
"format_version": "1.21.11",
"credit": "Made with Blockbench",
"parent": "minecraft:item/generated",
"textures": {
"layer0": "acesbs:item/birch_pipe"
},
"display": {
"thirdperson_righthand": {
"rotation": [-5.35, 74.81, 7.18],
"translation": [-1.5, 2.25, 1.5],
"scale": [0.5, 0.5, 0.5]
},
"thirdperson_lefthand": {
"rotation": [-156.57, -78.01, -155.53],
"translation": [-1, 2, 1.75],
"scale": [0.5, 0.5, 0.5]
},
"firstperson_righthand": {
"rotation": [-180, 87, 144],
"translation": [0.5, -7.75, -11]
},
"firstperson_lefthand": {
"rotation": [0, -81, 5],
"translation": [0, -2.5, -7.5]
},
"ground": {
"rotation": [90, -105, 0],
"translation": [-1.5, -3, 1],
"scale": [0.5, 0.5, 0.51]
},
"head": {
"rotation": [0, 69, 0],
"translation": [3.25, -5.25, -10.75],
"scale": [0.75, 0.75, 0.75]
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B