Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Pherment

Members
  • Posts

    9
  • 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 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)
  2. @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?
  3. Thanks, this helped! I feel stupid because it was so easy
  4. 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)); } } } }
  5. 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
  6. 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
  7. Here is my code public class StainedPantsEffect extends MobEffect { public StainedPantsEffect(MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory, color); } @Override public void applyEffectTick(LivingEntity livingEntity, int amplifier) { if (!livingEntity.level.isClientSide()) { livingEntity.setSpeed(0.05f); System.out.println(livingEntity.getSpeed()); } super.applyEffectTick(livingEntity, amplifier); } @Override public boolean isDurationEffectTick(int duraation, int amplifier) { return true; } } I want that when the player had this effect, then his speed decreased. The line getSpeed shows that the player's speed is 0.1, but the line setSpeed(0.05f) does not work and the speed does not change. How can I change the player's speed?
×
×
  • Create New...

Important Information

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