Quieter bones and VBones Spawning

This commit is contained in:
Vos
2026-03-11 21:51:43 -05:00
parent eb804c6f17
commit 04d9663d38
49 changed files with 301 additions and 4 deletions
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}
@@ -7,6 +7,7 @@ import com.acethewildfire.acesbs.effect.ModEffects;
import com.acethewildfire.acesbs.enchantment.ModEnchantmentEffects;
import com.acethewildfire.acesbs.entity.ModEntities;
import com.acethewildfire.acesbs.entity.custom.FrenEntity;
import com.acethewildfire.acesbs.entity.custom.VulgarBones;
import com.acethewildfire.acesbs.item.ModItemGroups;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.particle.ModParticles;
@@ -14,10 +15,7 @@ import com.acethewildfire.acesbs.potion.ModPotions;
import com.acethewildfire.acesbs.recipe.ModRecipies;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import com.acethewildfire.acesbs.sounds.ModSounds;
import com.acethewildfire.acesbs.util.HammerUsageEvent;
import com.acethewildfire.acesbs.util.ModStats;
import com.acethewildfire.acesbs.util.UpdateRecipies;
import com.acethewildfire.acesbs.util.YouMonsterEvent;
import com.acethewildfire.acesbs.util.*;
import com.acethewildfire.acesbs.world.gen.ModWorldGeneration;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
@@ -27,6 +25,7 @@ import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistryBuilder;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
import net.minecraft.entity.mob.SkeletonEntity;
import net.minecraft.item.Items;
import net.minecraft.potion.Potions;
import org.slf4j.Logger;
@@ -62,6 +61,8 @@ public class AcesBS implements ModInitializer {
ModParticles.registerModParticles();
ModStats.registerStats();
ConversionManager.init();
ModDataComponentTypes.registerDataComponentsTypes();
UpdateRecipies.updateVanilla();
@@ -92,5 +93,6 @@ public class AcesBS implements ModInitializer {
FlammableBlockRegistry.getDefaultInstance().add(ModBlocks.LEMONWOOD_LEAVES, 30, 60);
FabricDefaultAttributeRegistry.register(ModEntities.FREN, FrenEntity.createAttributes());
FabricDefaultAttributeRegistry.register(ModEntities.VULGAR_BONES, SkeletonEntity.createAbstractSkeletonAttributes());
}
}
@@ -21,6 +21,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.SkeletonEntityRenderer;
public class AcesBSClient implements ClientModInitializer {
@Override
@@ -37,6 +38,7 @@ public class AcesBSClient implements ClientModInitializer {
EntityModelLayerRegistry.registerModelLayer(FrenModel.FREN, FrenModel::getTexturedModelData);
EntityRendererRegistry.register(ModEntities.FREN, FrenRenderer::new);
EntityRendererRegistry.register(ModEntities.VULGAR_BONES, SkeletonEntityRenderer::new);
EntityModelLayerRegistry.registerModelLayer(CombustibleLemonModel.C_LEMON, CombustibleLemonModel::getTexturedModelData);
EntityRendererRegistry.register(ModEntities.C_LEMON, CombustibleLemonRenderer::new);
@@ -110,5 +110,8 @@ public class ModModelProvider extends FabricModelProvider {
itemModelGenerator.register(ModItems.FREN_SPAWN_EGG,
new Model(Optional.of(Identifier.of("item/template_spawn_egg")), Optional.empty()));
itemModelGenerator.register(ModItems.VULGAR_BONES_SPAWN_EGG,
new Model(Optional.of(Identifier.of("item/template_spawn_egg")), Optional.empty()));
}
}
@@ -3,10 +3,22 @@ package com.acethewildfire.acesbs.entity;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.entity.custom.CombustibleLemonEntity;
import com.acethewildfire.acesbs.entity.custom.FrenEntity;
import com.acethewildfire.acesbs.entity.custom.VulgarBones;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.util.ConversionManager;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.mob.SkeletonEntity;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
public class ModEntities {
@@ -21,8 +33,51 @@ public class ModEntities {
EntityType.Builder.<CombustibleLemonEntity>create(CombustibleLemonEntity::new, SpawnGroup.MISC)
.dimensions(0.5F, 0.5F).build());
public static final EntityType<VulgarBones> VULGAR_BONES = Registry.register(Registries.ENTITY_TYPE,
Identifier.of(AcesBS.MOD_ID, "vulgar_bones"),
EntityType.Builder.create(VulgarBones::new, SpawnGroup.MONSTER)
.dimensions(0.6F, 1.99F).build());
public static void registerModEntities() {
UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
if (world.isClient) return ActionResult.PASS;
if (!(entity instanceof SkeletonEntity skeleton)) return ActionResult.PASS;
skeleton.setAiDisabled(true);
skeleton.setInvulnerable(true);
world.playSound(null, skeleton.getBlockPos(), SoundEvents.ENTITY_EVOKER_CAST_SPELL,
skeleton.getSoundCategory(), 1.0f, 1.0f);
((ServerWorld) world).spawnParticles(
ParticleTypes.ENCHANT,
skeleton.getX(),
skeleton.getY() + 1.0,
skeleton.getZ(),
5, // count
0.2, // dx
0.2, // dy
0.2, // dz
0.0 // speed
);
ItemStack stack = player.getStackInHand(hand);
if (!stack.isOf(ModItems.STABLE_ENTROPY)) return ActionResult.PASS;
ConversionManager.startConversion(skeleton, 20);
if (!player.getAbilities().creativeMode) {
stack.decrement(1);
}
return ActionResult.SUCCESS;
});
AcesBS.LOGGER.info("Registering Mod Entities for " + AcesBS.MOD_ID);
}
}
@@ -0,0 +1,65 @@
package com.acethewildfire.acesbs.entity.custom;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.sounds.ModSounds;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.ai.goal.BowAttackGoal;
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.mob.SkeletonEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.World;
public class VulgarBones extends SkeletonEntity {
public VulgarBones(EntityType<? extends SkeletonEntity> entityType, World world) {
super(entityType, world);
}
@Override
protected SoundEvent getAmbientSound() {
return ModSounds.VULGAR_BONES_AMBIENT;
}
@Override
protected SoundEvent getHurtSound(DamageSource source) {
return ModSounds.VULGAR_BONES_HURT;
}
@Override
protected SoundEvent getDeathSound() {
return ModSounds.VULGAR_BONES_DEATH;
}
@Override
public int getMinAmbientSoundDelay() {
return 200 + this.random.nextInt(200);
}
@Override
protected void initEquipment(Random random, LocalDifficulty localDifficulty) {
super.initEquipment(random, localDifficulty);
this.equipStack(EquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
// this.equipStack(EquipmentSlot.OFFHAND, new ItemStack(ModItems.CIGARETTE));
}
@Override
protected void initGoals() {
super.initGoals();
// Remove existing bow/ranged attack goal
this.goalSelector.getGoals().removeIf(goalEntry ->
goalEntry.getGoal() instanceof BowAttackGoal<?>
);
// Add melee attack AI
this.goalSelector.add(4, new MeleeAttackGoal(this, 1.0, false));
}
}
@@ -38,6 +38,7 @@ public class ModItemGroups {
entries.add(ModItems.CIGARETTE_LEMON);
entries.add(ModItems.CIGARETTE_FUNNY);
entries.add(ModItems.FREN_SPAWN_EGG);
entries.add(ModItems.VULGAR_BONES_SPAWN_EGG);
})
.build();
@@ -187,6 +187,8 @@ public class ModItems {
public static final Item FREN_SPAWN_EGG = registerItem("fren_spawn_egg",
new SpawnEggItem(ModEntities.FREN, 894731, 0, new Item.Settings()));
public static final Item VULGAR_BONES_SPAWN_EGG = registerItem("vulgar_bones_spawn_egg",
new SpawnEggItem(ModEntities.VULGAR_BONES, 13082270, 0, new Item.Settings()));
@@ -17,6 +17,10 @@ public class ModSounds {
public static final SoundEvent HOLY_S = registerSoundEvent("holy_s");
public static final SoundEvent BRICKED_UP = registerSoundEvent("bricked_up");
public static final SoundEvent SMOKING = registerSoundEvent("smoking");
public static final SoundEvent VULGAR_BONES_AMBIENT = registerSoundEvent("vulgar_bones_ambient");
public static final SoundEvent VULGAR_BONES_HURT = registerSoundEvent("vulgar_bones_hurt");
public static final SoundEvent VULGAR_BONES_DEATH = registerSoundEvent("vulgar_bones_death");
public static final SoundEvent VULGAR_BONES_SPAWN = registerSoundEvent("vulgar_bones_spawn");
// public static final BlockSoundGroup LIZARD_SOUNDS = new BlockSoundGroup(1f, 1f, SoundEvents.BLOCK_WOOD_BREAK, SoundEvents.BLOCK_WOOD_STEP, SoundEvents.BLOCK_WOOD_PLACE, SoundEvents.BLOCK_WOOD_HIT, SoundEvents.BLOCK_WOOD_FALL)
@@ -0,0 +1,20 @@
package com.acethewildfire.acesbs.util;
import net.minecraft.registry.RegistryKey;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import java.util.UUID;
public class ConversionEntry {
public final UUID entityId;
public final RegistryKey<World> worldKey;
public int ticksRemaining;
public ConversionEntry(UUID entityId, RegistryKey<World> worldKey, int ticks) {
this.entityId = entityId;
this.worldKey = worldKey;
this.ticksRemaining = ticks;
}
}
@@ -0,0 +1,117 @@
package com.acethewildfire.acesbs.util;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.entity.ModEntities;
import com.acethewildfire.acesbs.entity.custom.VulgarBones;
import com.acethewildfire.acesbs.sounds.ModSounds;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.mob.SkeletonEntity;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
public class ConversionManager {
private static final List<ConversionEntry> conversions = new ArrayList<>();
public static void init() {
ServerTickEvents.END_SERVER_TICK.register(ConversionManager::tick);
}
public static void startConversion(SkeletonEntity skeleton, int ticks) {
conversions.add(new ConversionEntry(
skeleton.getUuid(),
skeleton.getWorld().getRegistryKey(),
ticks
));
}
private static void tick(MinecraftServer server) {
Iterator<ConversionEntry> iterator = conversions.iterator();
while (iterator.hasNext()) {
AcesBS.LOGGER.info("Ticking");
ConversionEntry entry = iterator.next();
ServerWorld world = server.getWorld(entry.worldKey);
if (world == null) {
iterator.remove();
continue;
}
Entity entity = world.getEntity(entry.entityId);
if (!(entity instanceof SkeletonEntity skeleton)) {
iterator.remove();
continue;
}
entry.ticksRemaining--;
if (entry.ticksRemaining <= 0) {
VulgarBones v_bones = ModEntities.VULGAR_BONES.create(world);
if (v_bones == null) {
iterator.remove();
continue;
}
world.playSound(null, skeleton.getBlockPos(),
ModSounds.VULGAR_BONES_SPAWN,
skeleton.getSoundCategory(), 1f, 1f);
world.spawnParticles(
ParticleTypes.EXPLOSION,
skeleton.getX(),
skeleton.getY() + 1.0,
skeleton.getZ(),
5, // count
0.2, // dx
0.2, // dy
0.2, // dz
0.0 // speed
);
v_bones.refreshPositionAndAngles(
skeleton.getX(),
skeleton.getY(),
skeleton.getZ(),
skeleton.getYaw(),
skeleton.getPitch()
);
v_bones.equipStack(EquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
v_bones.prevYaw = skeleton.prevYaw;
v_bones.prevPitch = skeleton.prevPitch;
v_bones.setBodyYaw(skeleton.getBodyYaw());
v_bones.setHeadYaw(skeleton.getHeadYaw());
world.spawnEntity(v_bones);
skeleton.discard();
iterator.remove();
}
}
}
}
@@ -57,6 +57,7 @@
"item.acesbs.cigarette_funny": "Hazy Cigarette",
"item.acesbs.fren_spawn_egg": "Fren Spawn Egg",
"item.acesbs.vulgar_bones_spawn_egg": "Vulgar Bones Spawn Egg",
"painting.acesbs.herald.title": "Herald's Banner",
@@ -190,11 +191,17 @@
"sounds.acesbs.grumble": "Stomach Grumbling",
"sounds.acesbs.crab_rave": "Jukebox plays Crab Rave",
"sounds.acesbs.smoking": "Violent Smoking",
"sounds.acesbs.vulgar_bones_spawn": "Skeleton Transforms into Vulgar Bones",
"sounds.acesbs.vulgar_bones_ambient": "Vulgar Bones Swears",
"sounds.acesbs.vulgar_bones_hurt": "Vulgar Bones Swears Painfully",
"sounds.acesbs.vulgar_bones_death": "Vulgar Bones Utters Final Swears",
"enchantment.acesbs.lightning_strike": "Lightning Strike",
"entity.acesbs.fren": "Fren",
"entity.acesbs.combustible_lemon": "Combustible Lemon",
"entity.acesbs.vulgar_bones": "Captain Vulgar Bones",
"effect.acesbs.infernal_fire": "Infernal Fire",
"effect.acesbs.lemon": "Puckered",
@@ -49,5 +49,21 @@
"stream": true
}
]
},
"vulgar_bones_spawn": {
"subtitle": "sounds.acesbs.vulgar_bones_spawn",
"sounds": ["acesbs:vulgar_bones_ambient_6"]
},
"vulgar_bones_ambient": {
"subtitle": "sounds.acesbs.vulgar_bones_ambient",
"sounds": ["acesbs:vulgar_bones_ambient_1", "acesbs:vulgar_bones_ambient_2","acesbs:vulgar_bones_ambient_3","acesbs:vulgar_bones_ambient_4","acesbs:vulgar_bones_ambient_5","acesbs:vulgar_bones_ambient_6","acesbs:vulgar_bones_ambient_7","acesbs:vulgar_bones_ambient_8","acesbs:vulgar_bones_ambient_9","acesbs:vulgar_bones_ambient_10"]
},
"vulgar_bones_hurt": {
"subtitle": "sounds.acesbs.vulgar_bones_hurt",
"sounds": ["acesbs:vulgar_bones_hurt_1", "acesbs:vulgar_bones_hurt_2", "acesbs:vulgar_bones_hurt_3", "acesbs:vulgar_bones_hurt_4"]
},
"vulgar_bones_death": {
"subtitle": "sounds.acesbs.vulgar_bones_death",
"sounds": ["acesbs:vulgar_bones_death_1", "acesbs:vulgar_bones_death_2", "acesbs:vulgar_bones_death_3", "acesbs:vulgar_bones_death_4"]
}
}