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

Frontear

Members
  • Posts

    54
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Frontear

  1. 20 minutes ago, Bryson said:

    you, people, are useless I have asked everything to try to get myself some help but no I even told you everything about my computer my internet service provider my wifi and then, your just going to give me a spamming warning for trying to get help, this is stupid someone please tell me a website I can go to where they can help me with my issue

    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.

  2. 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": []
      }
    ]
    

     

  3. @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?

  4. 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

  5. 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?

  6. 5 hours ago, diesieben07 said:

    LivingHurtEvent is fired immediately when a living entity receives damage, it can be used to alter the damage or cancel it outright.

    LivingDamageEvent is fired after all damage calculations have been done (armor, potions, LivingHurtEvent (unless cancelled)).

    Both of these fire for players. They do sometimes fire on the logical client, but not in a useful fashion.

    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

  7. 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.

  8. 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?

  9. 2 hours ago, diesieben07 said:

    Incorrect. The base class for client players is AbstractClientPlayer, which is parent class for EntityPlayerSP and EntityOtherPlayerMP. If you want to check for EntityPlayerSP do an instanceof check, that is it's purpose. Do not abuse other conditions in place of a necessary instanceof check.

    I'm curious then, what is the purpose of EntityPlayerMP in the super constructor? I see that EntityPlayerSP is your player, EntityOtherPlayerMP is everyone else on a multiplayer/server connection. What's EntityPlayerMP purpose? Additionally, when should a side check be used?

  10. 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.

  11. 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. 

    • Like 1
  12. 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

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.