
Koolade446
Members-
Posts
22 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Koolade446's Achievements

Tree Puncher (2/8)
1
Reputation
-
I am creating a custom portal and I want it to act similar to a nether portal. I have created an overlay that is painted on screen when you stand in the portal but I need to create the camera warp that happens when you are standing in a portal and I cant figure out how to do this. Any help is appreciated!
-
Yeah, see I had the same thought but then I tried to load a single-player world and the game crashed on the Joining World screen with Null Pointer. I think there's a split second where the player hasn't technically logged on but is still ticking idk its weird.
-
I’m facepalming so hard at myself right now cause I was totally about to tell you how you were wrong and then I realized oh tickRem would get refreshed every tick. So then my thought is to use while loops however I tend to try and avoid while loops because they lock up threads. Here’s a major question I have about forge. Is a separate instance of each class instantiated for each player or is it more like spigot where I need to make sure my code is accounting for multiple players? Because my next thought for a solution here would be to use an instance variable or a HashMap with player name or uuid:tickRem that clears as soon as they step off the saw. Also I tested the code doing damage every tick and it works fine but I am worried about system resources on a server with many people running checks every 1/20 of a second could get be too much on a server with many people.
-
How to log into Minecraft inside of Eclipse
Koolade446 replied to Sun_Minecraft's topic in Modder Support
This isn't true HOWEVER its super complicated to do and you have to change the command every time. Below is a code snippet from a custom minecraft launcher I'm working on so there may be some unnecessary steps focus mainly on the HTTP connections, request types, and request bodys/url endpoints. Forewarning this is incredibly complicated and i would advise against it. If you need to test your mod on a server just put it in offline mode. -
the issue with this is if a player gets on a saw and player.tickCount % 20 is 14 the player could have 19 ticks or almost a whole second to get off the saw before a tick of damage would be delt so if they like ran across it they may not take damage. Would something like this work instead: @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE) public class EventListener { @SubscribeEvent public static void checkStance(TickEvent.PlayerTickEvent e) { if (e.player != null) { //I realised checking if the level was null was a mute point because if the player wasn't null then the level couldn't be either final int tickRem = e.player.tickCount % 20; if (e.player.level.getBlockState(e.player.getOnPos()).getBlock() instanceof StonecutterBlock && e.player.tickCount % 20 == tickRem) { e.player.hurt(DamageSource.OUT_OF_WORLD, 30f); } } } } To make sure the player always takes damage on the first tick they stand on the saw for or am I misunderstanding something about how ticks work.
-
Ok, thanks. I haven't ever really done anything server-side mostly client side until mods and mostly 1.8 so sorry for my lack of knowledge of both server-side behavior and current forge events. Thanks for that so Possibly use PlayerTickEvent? How does LivingUpdateEvent fire is it just a tick thing or does the player have to do some kind of action? thanks for your help. Edit: Ok heres my now working code @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE) public class EventListener { @SubscribeEvent public static void checkStance(TickEvent.PlayerTickEvent e) { if (e.player != null && e.player.level != null) { if (e.player.level.getBlockState(e.player.getOnPos()).getBlock() instanceof StonecutterBlock) { HyperIon.getLOGGER().info("Player is on saw"); e.player.hurt(DamageSource.OUT_OF_WORLD, 1.5f); } } } } Any other advice? I plan to eventually implement a custom DamageSource btw the OUT_OF_WORLD source was just for testing
-
So I'm trying to add a piece to my mod to make Stonecutters hurt players. So im listening for WorldTickEvent and if the player is standing on a stone cutter im using Player.hurt(DamageSource.OUT_OF_WORLD, 0.4f) Heres my code: @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE) public class EventListener { @SubscribeEvent public static void checkStance(TickEvent.WorldTickEvent e) { if (Minecraft.getInstance().player != null) { if (Minecraft.getInstance().player.level.getBlockState(Minecraft.getInstance().player.getOnPos()).getBlock() instanceof StonecutterBlock) { HyperIon.getLOGGER().info("Player is on saw"); Minecraft.getInstance().player.hurt(DamageSource.OUT_OF_WORLD, 0.4f); } } } } The console prints out "player is on saw" whenever I stand on a saw but it just doesn't hurt me and I can't figure out why.
-
I tried adding those to both my render and init methods and no dice. is there a way to register a GUI in 1.18? I'm doing this one a little different from how I would do GUI's in the past because 1.18 changed everything and the docs are pitiful. In the past, I would register and open a GUI like this //Register FMLModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, ...) //Open NetworkHooks.openGui. But FMLModLoadingContext doesn't exist anymore in 1.18 so instead, I'm using the open method so I never registered it? also never used the RenderSystem and Mojang insists on being annoying and naming their variables stupid things like p_98389 so i have no clue what the ints and floats in the method you gave me represent. Thanks for any help.
-
The title lays it out. I'm pretty new to forge and 1.18 changed everything i know so yeah here goes I created a menu GUI and bound it to a key all works well but the GUI just uses the default missing GUI texture from Minecraft even though i have a texture set. Here's my code: public class MenuUI extends Screen { private static final int WIDTH = 179; private static final int HEIGHT = 151; private final ResourceLocation Texture = new ResourceLocation(NoLifeSmpMod.ModID, "textures/gui/menu.png"); protected MenuUI() { super(new TranslatableComponent("screen." + NoLifeSmpMod.ModID + ".Menu")); } @Override protected void init() { int relX = (this.width - WIDTH) / 2; int relY = (this.height - HEIGHT) / 2; addRenderableWidget(new Button(relX + 10, relY + 10, 160, 20, new TextComponent("Button test"), button -> sendMessage("Press recived"))); } @Override public boolean isPauseScreen() { return false; } @Override public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { int relX = (this.width - WIDTH) / 2; int relY = (this.height - HEIGHT) / 2; assert this.minecraft != null; this.minecraft.getTextureManager().bindForSetup(Texture); this.blit(poseStack, relX, relY, 0, 0, WIDTH, HEIGHT); super.render(poseStack, mouseX, mouseY, partialTicks); } public static void open() { Minecraft.getInstance().setScreen(new MenuUI()); } } in the past I used this.minecraft.getTextureManager().bind(texture) but that doesn't exist anymore so I assumed it had been replaced by this.minecraft.getTextureManager().bindForSetup() Am I wrong? IDK please help me.
-
[1.15.2] How do I add a new KeyBinding?
Koolade446 replied to TheThorneCorporation's topic in Modder Support
Sorry if this is necroposting but I have the keybind set up (mind you this is on .1.18 so I'm using the new KeyMapping rather than KeyBinding) But I don't quite understand how to make it be changeable in the Minecraft settings menu? I assumed it would be changeable after registering it but it's not and I don't get how to set it to be there. Code (sorry it's sloppy I'm just testing proof of concept, for now, I plan to clean it up later) @Mod.EventBusSubscriber public class KeyBindHandler { private static final KeyMapping MenuKey = new KeyMapping("key.menu", KeyConflictContext.UNIVERSAL, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_H, KeyMapping.CATEGORY_GAMEPLAY); @SubscribeEvent public static void registerKeyBinds (FMLClientSetupEvent e) { ClientRegistry.registerKeyBinding(MenuKey); } @SubscribeEvent public static void onKeyPress (InputEvent.KeyInputEvent e) { if (MenuKey.isDown()) { MenuUI.open(); } } } to be clear everything works, I can press h and open my GUI and use it the only thing is it cant be changed in the menu. Edit: lol I'm an idiot ignore me. Turns out i have to use the right event bus weird how that works huh *facepalm* so anyways I used a nested class and changed the event busses so that the ClientSetupEvent was under a MOD event bus and the KeyInputEvent was under a FORGE event bus and problem solved. -
Game crashes when custom entity holds an item
Koolade446 replied to Koolade446's topic in Modder Support
Never mind I got it -
Game crashes when custom entity holds an item
Koolade446 replied to Koolade446's topic in Modder Support
I know how to use generics my friend. My question was how I can make my entity able to render the item in hand -
Game crashes when custom entity holds an item
Koolade446 replied to Koolade446's topic in Modder Support
Okay I'm new to modding so whats a better way to do this?