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

FantaLaTone

Members
  • Posts

    48
  • Joined

  • Last visited

Recent Profile Visitors

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

FantaLaTone's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Yeah, you were right. Making mobs silent for sculk sensors is really easy. Make sure your mob is implementing these: implements VibrationListener.VibrationListenerConfig And then override these methods: @Override public boolean canTriggerAvoidVibration() { return true; // Actions will not cause vibration } @Override public boolean shouldListen(ServerLevel p_223872_, GameEventListener p_223873_, BlockPos p_223874_, GameEvent p_223875_, GameEvent.Context p_223876_) { return false; // Do not listen vibrations } @Override public void onSignalReceive(ServerLevel p_223865_, GameEventListener p_223866_, BlockPos p_223867_, GameEvent p_223868_, @Nullable Entity p_223869_, @Nullable Entity p_223870_, float p_223871_) { } @Override // I DON'T KNOW WHAT THIS ONE DO :( public boolean alwaysAccepts() { return false; }
  2. Hello, I have an entity and I want to make it unable to trigger sculk sensors like Warden. I looked the Warden's code but I couldn't find anything that I can use. How I can implement that feature?
  3. Ok I finally did it working. Everything works fine. Here's the last version of my codes: accesstransformers.cfg : public net.minecraft.client.player.LocalPlayer f_108601_ # crouching ModEvents.java : package com.fantalatone.sculknightmare.event; import com.fantalatone.sculknightmare.SculkNightmare; import com.fantalatone.sculknightmare.effect.ModEffects; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.MovementInputUpdateEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = SculkNightmare.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ModEvents { @SubscribeEvent public static void onPlayerTick(MovementInputUpdateEvent event) { LocalPlayer pPlayer = Minecraft.getInstance().player; if (pPlayer.hasEffect(ModEffects.LAZY_LEGS.get())) { event.getInput().shiftKeyDown = false; pPlayer.crouching = false; } } } Thanks for everybody helped me!
  4. package com.fantalatone.sculknightmare.event; import com.fantalatone.sculknightmare.SculkNightmare; import com.fantalatone.sculknightmare.effect.ModEffects; import net.minecraft.client.Minecraft; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.monster.Creeper; import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.client.event.MovementInputUpdateEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.entity.EntityJoinLevelEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = SculkNightmare.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ModEvents { @SubscribeEvent public static void onKeyInput(InputEvent.Key event) { if (Minecraft.getInstance().screen != null) return; if (event.getKey() == 340) { Player pPlayer = Minecraft.getInstance().player; if (pPlayer.hasEffect(ModEffects.LAZY_LEGS.get())) { } } } @SubscribeEvent public static void onPlayerTick(MovementInputUpdateEvent event) { Minecraft.getInstance().player.crouching = false; } @SubscribeEvent public static void onEntityJoin(EntityJoinLevelEvent event) { if (event.getEntity() instanceof Creeper) { ((Creeper) event.getEntity()).explosionRadius = 20; } } }
  5. it is just making player can't crouch visually I can still crouch Eyes are going down and player gets slower
  6. I changed it to a public field and this my code for now and it is not working @SubscribeEvent public static void onPlayerTick(MovementInputUpdateEvent event) { if (event.getEntity() instanceof Player) { Player p = event.getEntity(); Minecraft.getInstance().player.crouching = true; } }
  7. I decided to use AccessTransforms to do it but how I can change public methods code? How do I can override it? Edit: I made AccessTransforms work. I can make fields public and change values but I couldn't understand how I can change a methods code?
  8. Hello, I am trying to cancel the crouch if player has an custom effect. I tried some methods but none of them have worked for me. Here's my current code: @SubscribeEvent public static void onKeyInput(InputEvent.Key event) { if (Minecraft.getInstance().screen != null) return; if (event.getKey() == 340) { Player pPlayer = Minecraft.getInstance().player; if (pPlayer.hasEffect(ModEffects.LAZY_LEGS.get())) { if (event.isCancelable()) { event.setCanceled(true); } // event.setCanceled(true); // pPlayer.setPose(Pose.STANDING); } } } @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if(event.phase != TickEvent.Phase.START || !event.player.isAlive()) { return; } final boolean lazyLeg = event.player.hasEffect(ModEffects.LAZY_LEGS.get()); final Pose forcedPose = event.player.getForcedPose(); if (lazyLeg && forcedPose != Pose.FALL_FLYING) { event.player.setForcedPose(Pose.FALL_FLYING); event.player.setPose(Pose.FALL_FLYING); } else if (!lazyLeg && Pose.FALL_FLYING == forcedPose) { event.player.setForcedPose(null); } } Nothing works here!
  9. By the way I copied this code from here (https://github.com/skyjay1/GreekFantasy/blob/master-1.18/src/main/java/greekfantasy/GFEvents.java) and refactored it a little bit for my use.
  10. Hello, I have a mod with some custom effects. I am trying to make if player has X custom effect player can't crouch. Here's my code for this : @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if(event.phase != TickEvent.Phase.START || !event.player.isAlive()) { return; } final boolean lazyLeg = event.player.hasEffect(ModEffects.LAZY_LEGS.get()); final Pose forcedPose = event.player.getForcedPose(); if (lazyLeg && forcedPose != Pose.STANDING) { event.player.setForcedPose(Pose.STANDING); event.player.setPose(Pose.STANDING); } else if (!lazyLeg && Pose.STANDING == forcedPose) { event.player.setForcedPose(null); } } If I switch Pose.STANDING's to Pose.FALL_FLYING the code is working but it is not working on STANDING pose. I couldn't understand why it is happening.
  11. i know, i am asking for how i can get player's x and other things like LivingEntity p = event.clicker;
  12. @Luis_ST@warjort i am sorry for pinging but can you tell me can i get the player with this click event? how i can get the player?
×
×
  • Create New...

Important Information

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