Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FantaLaTone

Members
  • Joined

  • Last visited

Everything posted by FantaLaTone

  1. it is just making player can't crouch visually I can still crouch Eyes are going down and player gets slower
  2. 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; } }
  3. 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?
  4. 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!
  5. 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.
  6. 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.
  7. i know, i am asking for how i can get player's x and other things like LivingEntity p = event.clicker;
  8. @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?
  9. theres no command like .getScreen() i just used .screen instead. latest code for 1.18.2 forge click detection package com.fantalatone.soccermod.event; import com.fantalatone.soccermod.SoccerMod; import net.minecraft.client.Minecraft; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = SoccerMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class SoccerModEvents { @SubscribeEvent public static void a(InputEvent.RawMouseEvent event) { if (Minecraft.getInstance().screen != null) return; if (event.getButton() == 0) { System.out.println("Left Click Detected!"); } } }
  10. this only detects when im on gui it is not detecting my normal clicks @SubscribeEvent public static void a(ScreenEvent.MouseClickedEvent event) { if (event.getScreen() == null) { System.out.println("boıiş!"); } if (event.getButton() == 0) { System.out.println("SOl CLİK!"); } } (i tried ScreenEvent.MouseClickedEvent.Pre too same thing)
  11. ok, i got it working with this code but i have simple question how i can test if it is in world not gui? @SubscribeEvent public static void a(InputEvent.RawMouseEvent event) { System.out.println("3131313!"); if (event.getButton() == 0) { System.out.println("SOl CLİK!"); } }
  12. package com.fantalatone.soccermod.event; import com.fantalatone.soccermod.SoccerMod; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import java.awt.event.InputEvent; @Mod.EventBusSubscriber(modid = SoccerMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class SoccerModEvents { @SubscribeEvent public void a(InputEvent.MouseButton.Pre event) { System.out.println(event); } }
  13. i meant methods by saying "commands". like just print something i tried this code but it doesnt seem to be working @SubscribeEvent public void a(InputEvent.MouseButton.Pre event) { System.out.println(event); }
  14. Hello, I have a simple Minecraft mod. I want to add a system that can track my mouse clicks and run commands when I left click or right click. I tried some solutions but I couldn't find any good resource about it. I tried some methods but no help at all. Can someone just tell which event I need to subscribe?
  15. Thanks for helps I made it. I just copied codes from shulkerboxblock & shulkerboxblockentity classes.
  16. my bad I forgot to put .get() at the end of the HexcraftBlocks.CRATE_WHITE_OAK
  17. ItemStack itemstack = new ItemStack(HexcraftBlocks.CRATE_WHITE_OAK); I am getting this error right now at this line : D:\Fiverr Tasks\adree411\src\main\java\com\masterquentus\hexcraft\block\custom\Crate_WhiteOakBlock.java:122: error: no suitable constructor found for ItemStack(RegistryObject<Block>) ItemStack itemstack = new ItemStack(HexcraftBlocks.CRATE_WHITE_OAK); ^ constructor ItemStack.ItemStack(ItemLike) is not applicable (argument mismatch; RegistryObject<Block> cannot be converted to ItemLike) constructor ItemStack.ItemStack(Holder<Item>) is not applicable (argument mismatch; RegistryObject<Block> cannot be converted to Holder<Item>) constructor ItemStack.ItemStack(CompoundTag) is not applicable (argument mismatch; RegistryObject<Block> cannot be converted to CompoundTag)
  18. Yes, but I couldn't understand anything. Is this what I need? public static final ResourceLocation CONTENTS = new ResourceLocation("contents");
  19. Hello, I have a project that adds 3 different types of crates. I want to make them store items after break like shulker boxes. I couldn't find anything about this. Should I use NBT tags to store items data? What should I do? Crate Block Entity and Crate Block's codes: https://pastebin.com/Yeqfw8a7
  20. Ok I fixed it i just simply changed new Crate_BloodOakGUIMenu(id, inv, extraData) with new Crate_BloodOakGUIMenu(id, inv, null) thanks for your helps
  21. Yeah I get rid off the registerMenu method but now those lambda functions in registers giving some errors
  22. currently this is the errors i get : D:\Fiverr Tasks\adree411\src\main\java\com\masterquentus\hexcraft\world\HexcraftMenus.java:26: error: incompatible types: inference variable B has incompatible equality constraints Container,MenuType<?> private static final DeferredRegister<Container> REGISTRY = DeferredRegister.create(ForgeRegistries.CONTAINERS, Hexcraft.MOD_ID); ^ where B is a type-variable: B extends Object declared in method <B>create(IForgeRegistry<B>,String) D:\Fiverr Tasks\adree411\src\main\java\com\masterquentus\hexcraft\world\HexcraftMenus.java:29: error: incompatible types: incompatible parameter types in lambda expression (id, inv, extraData) -> new Crate_WhiteOakGUIMenu(id, inv, extraData)); ^ D:\Fiverr Tasks\adree411\src\main\java\com\masterquentus\hexcraft\world\HexcraftMenus.java:31: error: incompatible types: incompatible parameter types in lambda expression (id, inv, extraData) -> new Crate_HellbarkGUIMenu(id, inv, extraData)); ^ D:\Fiverr Tasks\adree411\src\main\java\com\masterquentus\hexcraft\world\HexcraftMenus.java:33: error: incompatible types: incompatible parameter types in lambda expression (id, inv, extraData) -> new Crate_BloodOakGUIMenu(id, inv, extraData)); ^ and this is my current code : private static final DeferredRegister<Container> REGISTRY = DeferredRegister.create(ForgeRegistries.CONTAINERS, Hexcraft.MOD_ID); public static final RegistryObject<MenuType<Crate_WhiteOakGUIMenu>> WHITE_OAK_CRATE_GUI = REGISTRY.register("white_oak_crate_gui", (id, inv, extraData) -> new Crate_WhiteOakGUIMenu(id, inv, extraData)); public static final RegistryObject<MenuType<Crate_HellbarkGUIMenu>> HELLBARK_CRATE_GUI = REGISTRY.register("hellbark_crate_gui", (id, inv, extraData) -> new Crate_HellbarkGUIMenu(id, inv, extraData)); public static final RegistryObject<MenuType<Crate_BloodOakGUIMenu>> BLOOD_OAK_CRATE_GUI = REGISTRY.register("blood_oak_crate_gui", (id, inv, extraData) -> new Crate_BloodOakGUIMenu(id, inv, extraData)); // public static final MenuType<EbonyCrateGUIMenu> EBONY_CRATE_GUI = register("ebony_crate_gui", // (id, inv, extraData) -> new EbonyCrateGUIMenu(id, inv, extraData)); public static void register(IEventBus eventBus) { REGISTRY.register(eventBus); }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.