-
Posts
54 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Frontear
-
This isn't even the right website for this kind of question, yet people still tried to help you. Multiple people have made it clear that this is likely an issue with your DNS. You can restart your router, restart your pc, flush your dns, change it to another, more well-known provider, or check to make sure it isn't blocked via some firewall. Instead of being so rude towards the people who have tried to help, maybe you should try solving the problem using the information given.
-
Process resources and replacements when executing code
Frontear replied to Frontear's topic in ForgeGradle
I just restarted my IDE and everything decided to work fine. I just had to fix an issue with `MISSING REPLACEMENT DATA FOR RUN_DIR`, which was fixed by adding `runDir = "run"` into the `minecraft` area. -
Normally when you start minecraft (usually through the generated run configurations), your mcmod.info will contain stuff like `${version}` and `${mcversion}`. While I am aware that these will be fixed when actually building the code (processResources is called), I want to be able to run them in addition to my `replaceIn` and `replace` snippets before being able to test. Obviously the generated configurations will not have this happen. I considered runClient, and for a while it actually used to work, but now it no longer works, and I am at a loss. Additionally, while `processResources` works perfectly fine as I'm building, the `replace` stuff does not. How can I resolve these issues? build.gradle buildscript { repositories { jcenter() maven { name = "forge" url = "https://files.minecraftforge.net/maven" } } dependencies { classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT" } } apply plugin: "net.minecraftforge.gradle.forge" version = "0.1" group = "org.frontear" archivesBaseName = "MyMod" targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_8 minecraft { version = "1.8.9-11.15.1.2318-1.8.9" mappings = "stable_22" replaceIn 'MyMod.java' replace '${modid}': archivesBaseName.toLowerCase(), '${version}': project.version } repositories { mavenCentral() } processResources { // this will ensure that this task is redone when the values change. inputs.property "modid", archivesBaseName.toLowerCase() inputs.property "name", archivesBaseName inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include "mcmod.info" // replace modid, name, version and mcversion expand "modid": archivesBaseName.toLowerCase(), "name": archivesBaseName, "version": project.version, "mcversion": project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude "mcmod.info" } } MyMod.java package org.frontear.mymod; import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @Mod(modid = "${modid}", version = "${version}") public class MyMod { @Mod.EventHandler public void init(FMLInitializationEvent event) { // some example code System.out.println("DIRT BLOCK >> " + Blocks.dirt.getUnlocalizedName()); } } mcmod.info [ { "modid": "${modid}", "name": "${name}", "description": "Blah blah blah, something something something", "version": "${version}", "mcversion": "${mcversion}", "url": "", "updateUrl": "", "authorList": [ "Frontear" ], "credits": "", "logoFile": "", "screenshots": [], "dependencies": [] } ]
-
@SubscribeEvent public void onTick(TickEvent.PlayerTickEvent event) { if (event.phase != TickEvent.Phase.START) return; // see EntityPlayer.onUpdate if (event.player instanceof EntityPlayerSP) { final EntityPlayerSP player = (EntityPlayerSP) event.player; if (player.world.getCollidingBoundingBoxes(player, player.getEntityBoundingBox().addCoord(player.motionX, player.motionY, player.motionZ)).isEmpty()) { player.jump(); } } } I wanted to be able to extend the functionality of AutoJump, by adding a feature which would make the player jump if they reached the end of a block. I was given this code by someone on discord, and while I've got a vague understanding of how it works, it does not fully operate right. Pretty consistently, it will burn in lava if I try to use it when there is a lava below the player and when it attempts to jump, which is definitely not wanted. How can I implement something like that?
-
https://en.wikipedia.org/wiki/Byte_order_mark
-
How would I add multiple colors to one single chat line?
Frontear replied to Frontear's topic in Modder Support
I've solved the issue. For future reference, the safest thing to do (to avoid any formatting problems), is to simply create multiple TextComponentStrings, then appendSibling them to your main TextComponentString: TextComponentString parent = new TextComponentString(""); parent.appendSibling(new TextComponentString("blah blah").setChatStyle(new ChatStyle().setColor(TextFormatting.BLUE))); parent.appendSibling(new TextComponentString("foo bar").setChatStyle(new ChatStyle().setColor(TextFormatting.RED))); mc.ingameGUI.getChatGUI().printChatMessage(parent); Will show up in chat as: blah blah foo bar -
I want to create a chat message with a specific format: The problem is, I see no way to do this in a TextComponentString by default. I can only add one message, and only set it's color at one place. Is it possible to do what I want to do above?
-
Differences between EntityPlayerSP and EntityPlayerMP
Frontear replied to Frontear's topic in Modder Support
Perfect, thanks so much! -
I can't seem to figure this out. Originally I thought EntityPlayerSP was simply your client-sided player, while EntityPlayerMP was just any other player connected to your server, but I don't think this is right, considering there is also an EntityOtherPlayerMP, which indicates that it would be the other players on your server. What are they exactly? When are they applied?
-
Perhaps it's my code's fault, because LivingHurtEvent does not fire while on a multiplayer world, even for myself. While I can understand that LivingHurtEvent on EntityLIvingBase wouldn't normally fire because I don't have direct access to all the players on the server, I was hoping the event in EntityPlayer would fire for myself. Is this even possible for me to do? Relevant code: @SubscribeEvent public void onLivingHurt(LivingHurtEvent event) { if (event.getEntity().getName().equals(mc.player.getName()) { // the player has been hurt doSomething(); } } EDIT: I've found a method which works properly, It is LivingAttackEvent
-
I've been trying to get find an event which fires when the player get's hurt, that is, our current player. I've tried LivingHurtEvent, but it doesn't seem to even fire on a multiplayer world. What event can I use for this?
-
The update for 1.13 is being worked on, but there is no release date for it yet. (12/20/18 Update): The goal is to have a working build available by New Years. Updates to a new version of Minecraft take a lot of work, so please be patient. (12/20/18 Update): In addition, the Dev team has taken this opportunity to update and retool right down to FML. This means making things more future-proof, partly by cleaning out/replacing a TON of legacy code that has been there since the early days and is showing its age. Please refrain from making "is it done yet?" threads. The update will be ready when it is ready. (12/20/18 Update): For those of you who insist on asking for an ETA, the most accurate estimate can be made by looking at what patches still have to be ported. Here is the most recent official statement. In the meantime, DO NOT fall for sites offering Forge for 1.13, these sites will NOT magically provide you with software that has not been released yet, they will more likely install malware on your computer.
-
Do you want the proper, renamed fields? Set up a decompWorkspace then. Currently, you're using the searge names, which are something like field_*****, param_*****, or method_*****.
-
It is possible. You'd simply need to add a ghost entity to the current world, and not allow it to sync with the server. I'm curious why you want this though. Additionally, this client-sided entity won't be able to do anything, other than exist on your screen. Kinda pointless, no?
-
The code in question is the following: @SubscribeEvent public void onTick(TickEvent.PlayerTickEvent event) { if (event.phase != TickEvent.Phase.START) return; // see EntityPlayer.onUpdate if (event.side != Side.CLIENT) return; // only work on the player if it is a EntityPlayerSP if (doSomething((EntityPlayerSP) event.player)) { doSomethingElse(); } } According to the PlayerTickEvent class: super(Type.PLAYER, player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT, phase); It should automatically set the 'Side' enum accordingly, so why is the cast error occuring? I'm checking already for if it is a Side.Client, which would mean a EntityPlayerSP only.
-
[1.12.2] how do i run code only on the client?
Frontear replied to CNKManga's topic in Modder Support
If I may, OP, you will have a very hard time getting any sort of help if you keep being stubborn about getting people to view your code. Frankly, nobody here is interested to steal your code, nobody wants to plagiarize any functions, or anything like that. By refusing to show us an entire code base so that we, as helpers are not able to view it, you limit your ability to get help by a lot. It makes threads extremely messy and random when you post small snippets, especially considering you aren't posting enough code for us to help without seeing more in the first place. -
Create a KeyBinding object, register a KeyInputEvent and check if your object.isKeyDown(). Also make sure to ClientRegistry.registerKeyBinding()` on your object.
-
java.lang.OutOfMemoryError: Java heap space in Forge 1.12.2
Frontear replied to iamdjgames's topic in Support & Bug Reports
Define a -Xmx as well, which limits the heap size. I'd give it -Xmx2G which gives 2GB Ram -
Crash log? Something?
-
java.lang.OutOfMemoryError: Java heap space in Forge 1.12.2
Frontear replied to iamdjgames's topic in Support & Bug Reports
-Xmx512M That right there is your issue. Here, you are only giving Java 512MB of RAM. At least 1GB is recommended. -
That's extremely broad. Im not going to download, compile, and figure out what is not going right, and report back. You need to specify an actual issue. What do you think is wrong?
-
Effectively, here is the code I've currently been working with: Main Class: @SubscribeEvent public void onGuiScreen(GuiOpenEvent event) { InputMenu menu; if (event.gui instanceof GuiMainMenu) { menu = new InputMenu(event.gui); event.gui = menu; } } InputMenu Class: public class InputMenu extends GuiScreen { private GuiTextField inputField; private GuiScreen previousScreen; public InputMenu(GuiScreen previousScreen) { this.previousScreen = previousScreen; // save the main menu to return to later } @Override public void initGui() { inputField = new GuiTextField(-1, fontRendererObj ...); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { inputField.drawTextBox(); inputField.setFocused(true); } @Override public void updateScreen() { inputField.updateCursorCounter(); } @Override protected void keyTyped(char typedChar, int keyCode) throws IOException { if (keyCode == Keyboard.KEY_RETURN) { // go back to menu HandleInput(); mc.displayGuiScreen(previousScreen); // doesn't work } inputField.textboxKeyTyped(typedChar, keyCode); } } This isn't returning to the main menu, but is instead staying on the InputMenu screen, and only resetting the textField to empty characters upon pressing enter. I can't get it to return, even though I have set the mc.displayGuiScreen correctly. What might be the issue? EDIT: SOLVED The issue was that GuiOpenEvent got called when I tried to go back to the MainMenu, which, according to my old conditionals, would just display the InputMenu again. Adding a boolean fixed this, by checking if the user has already seen this menu before