Everything posted by FantaLaTone
-
[SOLVED] [1.19] Cancel the crouching [CODES]
it is just making player can't crouch visually I can still crouch Eyes are going down and player gets slower
-
[SOLVED] [1.19] Cancel the crouching [CODES]
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; } }
-
[SOLVED] [1.19] Cancel the crouching [CODES]
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?
-
[SOLVED] [1.19] Cancel the crouching [CODES]
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!
-
[SOLVED] [1.19] Cancel the crouching [CODES]
Any help?
-
[SOLVED] [1.19] Cancel the crouching [CODES]
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.
-
[SOLVED] [1.19] Cancel the crouching [CODES]
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.
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
ok, thanks it worked
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
i know, i am asking for how i can get player's x and other things like LivingEntity p = event.clicker;
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
@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?
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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!"); } } }
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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)
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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!"); } }
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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); } }
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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); }
-
[SOLVED][1.18.2] Implementing player left clicks and right clicks
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?
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
Thanks for helps I made it. I just copied codes from shulkerboxblock & shulkerboxblockentity classes.
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
my bad I forgot to put .get() at the end of the HexcraftBlocks.CRATE_WHITE_OAK
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
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)
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
Ok thanks for answers I will try them
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
Yes, but I couldn't understand anything. Is this what I need? public static final ResourceLocation CONTENTS = new ResourceLocation("contents");
-
[SOLVED] [1.19] How to turn barrel like block entities to shulker like block entities?
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
-
[SOLVED] [1.19] I got some errors while porting my 1.18 mod to 1.19
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
-
[SOLVED] [1.19] I got some errors while porting my 1.18 mod to 1.19
Yeah I get rid off the registerMenu method but now those lambda functions in registers giving some errors
-
[SOLVED] [1.19] I got some errors while porting my 1.18 mod to 1.19
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); }
IPS spam blocked by CleanTalk.