Jump to content

[1.8] My First Modding Experience


statphantom

Recommended Posts

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Sorry had no progress yesterday, I have had some stuff happening so didn't have the time. But back to business! I still am having trouble manually doing a check to destroy my item as I damage it from an event handler as there is no onItemUse call but I can't figure out how to manually destroy the item, it just degrades to 0 then the bar starts to fade red once it gets into negative numbers.

 

Also how do I create and store player unique values? I am wanting to create a few 'skills' and 'levels' etc for things like mining, strength, agility etc.

 

Thanks for all your guys support, this forum has been an amazing help for me.

Link to comment
Share on other sites

Also how do I create and store player unique values? I am wanting to create a few 'skills' and 'levels' etc for things like mining, strength, agility etc.

 

You'll want to use

[url=http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and]IExtendedEntityProperties[/url]

for that.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

player.inventory.mainInventory[player.inventory.currentItem] = null;

Note: This should be done on server side, so you wll have to update client by settin update boolean to true.

 

player.addChatComponentMessage(new ChatComponentText("Message"));

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

player.inventory.mainInventory[player.inventory.currentItem] = null;

Note: This should be done on server side, so you wll have to update client by settin update boolean to true.

 

player.addChatComponentMessage(new ChatComponentText("Message"));

 

thanks! if I create a new function but call that function through a isRemote check is that function only run on server side then?

 

Link to comment
Share on other sites

player.inventory.mainInventory[player.inventory.currentItem] = null;

Note: This should be done on server side, so you wll have to update client by settin update boolean to true.

 

player.addChatComponentMessage(new ChatComponentText("Message"));

 

thanks! if I create a new function but call that function through a isRemote check is that function only run on server side then?

 

No. In a way, this is what makes @SideOnly different from isRemote(). You can use isRemote() to run a part of the method on a specified side, or choose to only run it on one side (yet the method exists on both sides, unlike @SideOnly).

 

This code has a block that is only called on the server. The method is called on both sides, but the block checks with side to execute on.

public void example(World world)
{

    System.out.println("This code is ran on both the client and the server (if the method is called that way I.E called on common)");

    if(!world.isRemote)
    {
        System.out.println("This code is ran only on the server.");
    }
}

 

You shouldn't really need to do this - it will make your method fully server side but the method will exist on both sides

public void example(World world)
{
    if(world.isRemote)
    {
        return;
    }
    System.out.println("You will only see this code displayed through the server in the console, yet the method exists on both sides."
}

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

player.inventory.mainInventory[player.inventory.currentItem] = null;

Note: This should be done on server side, so you wll have to update client by settin update boolean to true.

 

player.addChatComponentMessage(new ChatComponentText("Message"));

 

thanks! if I create a new function but call that function through a isRemote check is that function only run on server side then?

 

No. In a way, this is what makes @SideOnly different from isRemote(). You can use isRemote() to run a part of the method on a specified side, or choose to only run it on one side (yet the method exists on both sides, unlike @SideOnly).

 

This code has a block that is only called on the server. The method is called on both sides, but the block checks with side to execute on.

public void example(World world)
{

    System.out.println("This code is ran on both the client and the server (if the method is called that way I.E called on common)");

    if(!world.isRemote)
    {
        System.out.println("This code is ran only on the server.");
    }
}

 

You shouldn't really need to do this - it will make your method fully server side but the method will exist on both sides

public void example(World world)
{
    if(world.isRemote)
    {
        return;
    }
    System.out.println("You will only see this code displayed through the server in the console, yet the method exists on both sides."
}

 

Yes I know it will also be compiled on client side but will it only RUN on server side if I do this?

 

public void example(World world)
{
    if(world.isRemote)
    {
        example2();
    }
    System.out.println("You will only see this code displayed through the server in the console, yet the method exists on both sides."
}

public void example2() {
    System.out.println("This will only run on server?");
}

Link to comment
Share on other sites

Really happy today, I decided to try and add a custom sound of my tools breaking, since again I have to set damage, set to null etc manually I also need to manually play a sound, so I downloaded one from a royalty free website and very first try, WORKED PERFECTLY. Really rare when that happens but when it does god its a wave of ecstasy (I really need a life).

 

PS: should damaging tools be done server side only?

Link to comment
Share on other sites

Hey all, I am looking for a partner developer to help develop this mod :) obviously I can't pay as it is a home project / non-profit mod etc, however I will DEFINITELY give you all the credit you deserve even if you don't ask for it.

 

If you want to help in any way with the live development on my mod add me on skype 'statphantom' or post here :) thanks.

Link to comment
Share on other sites

Hey everyone, thanks for the support so far. Question does onBlockDestroyedEvent(HarvestDropsEvent event)  called on every block destroyed? e.g. creeper explosions, quarry, etc?

 

also, how hard is it to add stuff to world gen? I would like to add some fibrous plants such as Jute etc. just wondering if it is something I could do soon or if it's really hard something I should do much later.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




×
×
  • Create New...

Important Information

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