Jump to content

Pherment

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Pherment's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I have a structure, and sometimes several mobs spawn there. This is a boss and must spawn alone. Here is the code for spawning entities in the structure { "type": "minecraft:jigsaw", "start_pool": "egyptcraft:boss_pyramid/start_pool", "size": 5, "max_distance_from_center": 80, "biomes": "#egyptcraft:has_structure/boss_pyramid", "step": "surface_structures", "start_height": { "absolute": 0 }, "project_start_to_heightmap": "WORLD_SURFACE_WG", "use_expansion_hack": false, "spawn_overrides": { "monster": { "bounding_box": "full", "spawns": [ { "type": "egyptcraft:anubis", "maxCount": 1, "minCount": 1, "weight": 100 } ] } } } Maybe it's something else?
  2. I have a mob. I would like it to have a boss bar when it spawns. I also have a structure, I would like that when I enter it, this boss will spawn in it at a certain point. And if possible, how to make the boss not go beyond the structure? public class Anubis extends Monster implements IAnimatable { private AnimationFactory factory = new AnimationFactory(this); public Anubis(EntityType<? extends Monster> entityType, Level level) { super(entityType, level); } public static AttributeSupplier setAttributes() { return Monster.createMobAttributes() .add(Attributes.MAX_HEALTH, 400D) .add(Attributes.ARMOR, 10D) .add(Attributes.ATTACK_DAMAGE, 20D) .add(Attributes.ATTACK_SPEED, 5f) .add(Attributes.MOVEMENT_SPEED, 0.2f).build(); } @Override protected void registerGoals() { this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 2.2D, false)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); } private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) { if (event.isMoving()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anubis.walk", true)); return PlayState.CONTINUE; } event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anubis.idle", true)); return PlayState.CONTINUE; } private PlayState attackPredicate(AnimationEvent event) { if(this.swinging && event.getController().getAnimationState().equals(AnimationState.Stopped)) { event.getController().markNeedsReload(); event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anubis.attack", false)); this.swinging = false; } return PlayState.CONTINUE; } @Override public void registerControllers(AnimationData data) { data.addAnimationController(new AnimationController(this, "controller", 0, this::predicate)); data.addAnimationController(new AnimationController(this, "attackController", 0, this::attackPredicate)); } @Override public AnimationFactory getFactory() { return factory; } }
  3. This is my code @Override public AbstractArrow customArrow(AbstractArrow arrow, Level pLevel) { arrow.setBaseDamage(arrow.getBaseDamage() + this.pDamage); Vec3 Vec3 = pLevel.getEntities(); arrow.move(MoverType.PLAYER, Vec3); return super.customArrow(arrow); } It throws this error - 'getEntities()' has protected access in 'net.minecraft.world.level.Level'
  4. I want the arrow fired from the bow to fly to the nearest mob, but I need to somehow determine its coordinates
  5. I would like not only to add damage, but also to manipulate other properties. For example, how can I change the charging speed of the bow. Or add two more arrows to the side, like a crossbow. Or even make an arrow that flies after the mob itself, as if it were an aim
  6. Hello! How can you make a tooltip translatable? So that it can be translated into en_us.json Here is what I have components.add(Component.literal("tooltip.press_shift").withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD));
  7. I have a code own sapling block public class BananSaplingBlock extends BushBlock { public static final IntegerProperty STAGE = BlockStateProperties.STAGE; private final AbstractTreeGrower treeGrower; public BananSaplingBlock(AbstractTreeGrower AbsTreeGrower, BlockBehaviour.Properties properties) { super(properties); this.treeGrower = AbsTreeGrower; this.registerDefaultState(this.stateDefinition.any().setValue(STAGE, Integer.valueOf(0))); } @Override protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { return state.is(BlockTags.SAND); } @Override public PlantType getPlantType(BlockGetter level, BlockPos pos) { return PlantType.DESERT; } } And have code configured features public class KCConfiguredFeatures { public static final Holder<ConfiguredFeature<TreeConfiguration, ?>> BANAN_TREE = FeatureUtils.register("banan", Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder( BlockStateProvider.simple(KCBlock.BANAN_LOG.get()), new StraightTrunkPlacer(5,6,3), BlockStateProvider.simple(KCBlock.BANAN_LEAVES.get()), new BlobFoliagePlacer(ConstantInt.of(2), ConstantInt.of(0), 4), new TwoLayersFeatureSize(1,0,2) ).dirt().build()); } I need my tree to grow only on sand. I read that you need to add a dirt method to the ConfiguredFeatures so that the tree grows on some specific block, but I do not understand what needs to be written in it. I would like to get help from you. And if there are errors in the code, then help fix them (And they can be)
  8. @Override public void applyEffectTick(LivingEntity livingEntity, int amplifier) { if(!livingEntity.level.isClientSide() && livingEntity instanceof Player player) { Double x = livingEntity.getX(); Double y = livingEntity.getY(); Double z = livingEntity.getZ(); livingEntity.level.playSound(player, x, y, z, KCSound.WHAT.get(), SoundSource.MASTER, 1, 1); livingEntity.teleportTo(x, y, z); livingEntity.setDeltaMovement(0, 0, 0); } super.applyEffectTick(livingEntity, amplifier); } I have an effect code that needs to freeze and play a sound. The problem is that the freeze works, but the sound does not. How can this problem be solved?
  9. Thanks, this helped! I feel stupid because it was so easy
  10. I have this code package com.pherment.kirillcraft.events; import com.pherment.kirillcraft.KirillCraft; import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = KirillCraft.MODID) public class KCEvents { @SubscribeEvent public static void setHeadacheWhenPlayerMountingOnBoat(EntityMountEvent event) { if (!event.getEntity().level.isClientSide()) { if (event.isMounting()) { //code add effect } } } } And I don't understand how you can give the player an effect. I looked at all the documentation, and livingEntities and mobEffects and everything that can be related to effects and the player. But nothing helps or works. I even tried this code. It would seem that it should work, but it does not work and minecraft gives an error @Mod.EventBusSubscriber(modid = KirillCraft.MODID) public class KCEvents { @SubscribeEvent public static void setHeadacheWhenPlayerMountingOnBoat(EntityMountEvent event, LivingEntity player) { if (!event.getEntity().level.isClientSide()) { if (event.isMounting()) { player.addEffect(new MobEffectInstance(KCEffect.HEADACHE.get(), 400)); } } } }
  11. I have a class with an event. When the player gets into the boat, the function is triggered. I need that when the player gets into the boat, then he has a certain effect. How can this be implemented? Help pls
  12. I need to create a nausea effect, the same as in minecraft, but break the MobEffects and MobEffect classes, I did not find anything about this and decided to ask here on the forum
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.