• 0

    posted a message on trying to find an even that fires on after messing with a placed blocks inventory

    So I was going to name this "Looking for an even that fires when you close a chest" but then I realized for my purposes I'd need that for every that has an inventory you can access.
    So armor stands, Item frames, those weapon holders from custom NPCS that are really cool.

    With that realization the question has become bigger and my first two knee jerk reactions to deal with it are:

    Can I some how extend or access the Blocks Class file to tap into event that fire when players take things from the inventory? Which I guess is a java question but it's something I wish I could do all the time so I'll ask any where.

    Or option B:
    Is their some way I can solve this by utilizing whatever system mine craft uses to save all the inventories any way?

    or does someone know a third option?

    Posted in: Modification Development
  • 0

    posted a message on Is their a code to see if the palyer is in a GUI, and if so can it narrow down, WHICH gui?

    I'm still working on plugins!

    This time I'm trying to add a button to a GUI from a different mod to open a new GUI that I made. I found no way to do that BUT, I did find a way to make it look like I did.
    Basically, I took a button and rendered it over the hud in game, then made a player event that if that mouse X an Y values were where the button was on the screen, it opens the GUI I made.

    The only problem is I don't know when the GUI is closed or opened so for right now, the button is just all ways on the screen no matter what.

    SO MY ACTUAL QUESTION WAS if their was a method I could call or something I could do to check if the player was in a GUI. if I could get the specific GUI they where in that would be even better.

    Right now though, the GUI I'm plugging into only opens under a specific button press, and when a certain player variable is a certain value. So I can un-hide the button like that but I can't think of a way to know if they have exited the GUI screen so a method like this would be loads of help. If someone can think of a way I can know when they close the GUI screen that would be good enough. I'll keep brain storming in the meantime.

    Posted in: Modification Development
  • 0

    posted a message on Does anyone know how the code that slows down the player when they let go of the wasd keys works? (trying to make a gliding code

    I ended up making a variable outside the method so it wouldn't get update over and over, and stored the current speed their each time the method got called, and used that as a reference instead of motion X and motion Z. it's a bit tricky to get it to feel right but it's working.

    Posted in: Modification Development
  • 0

    posted a message on Does anyone know how the code that slows down the player when they let go of the wasd keys works? (trying to make a gliding code

    So technically I'm coding in 1.7.10 since the mod I'm writing this plugin for hasn't update yet, but any info would be helpful really.

    Basically I'm trying to make a glide function for the player, like a Hang glider, but I Don't know how mine craft slows down the player so the controls are a bit choppy, and I wanted to find that code so I have a better understanding of how it works.


    If you need to know what I've done so far, I found out that gravity pushes you down at a rate of 0.08 so adding that gives me more control over how going up and down works but no matter what number I use I can't seem to offset the effects of the game slowing down the X and Z motions (the closest I've some is 0.005 but that doesn't work either)

    I'd be open to other things that could help, like turning off mine crafts mechanics that slow you down when you release the move buttons.

    I hope that's enoguh info, If I should post my code or something just say so.
    Thanks in advance!

    Posted in: Modification Development
  • 0

    posted a message on Variables I set with IExtendedEntityProperties reset on death.

    Sorry for not replying I got caught up with stuff, but I will ddeffinatly work on this and try to post how it goes. Thank you both so much.

    Posted in: Modification Development
  • 0

    posted a message on Variables I set with IExtendedEntityProperties reset on death.

    Hi so, as the title says, Variables I set with IExtendedEntityProperties reset on death, and like, am I doing something wrong or is this supposed to happen???

    Posted in: Modification Development
  • 0

    posted a message on Trying to lock A tile entity Block so only its owner can use it and I can't seem to get the code to seee the player right.

    Ohhhh no, you were right the tile entites not saving.


    I have decided to Past bin my code!
    Block Class: https://pastebin.com/BxLQnxFn
    Though the part in urstion is mostly,

    public boolean onBlockActivated(World world, int BlockX, int BlockY, int BlockZ, EntityPlayer player, int intA, float fA, float FB, float FC)

    {

    UUID U;

    if( ((GearBedTileEntity) world.getTileEntity(BlockX, BlockY, BlockZ)).GetOwner() == null){

    ((GearBedTileEntity) world.getTileEntity(BlockX, BlockY, BlockZ)).SetOwner(player.getUniqueID().toString());

    U = UUID.fromString(((GearBedTileEntity) world.getTileEntity(BlockX, BlockY, BlockZ)).GetOwner());}

    else{U = UUID.fromString(((GearBedTileEntity) world.getTileEntity(BlockX, BlockY, BlockZ)).GetOwner());}



    if(world.func_152378_a(U) == world.func_152378_a(player.getUniqueID()

    )){

    if (world.isRemote) {

    player.openGui(WTTI.instance,

    0, world, (int) player.posX, (int) player.posY, (int) player.posZ);

    }}

    else{

    String S = "this is not yours";

    String Y = "this is" + U.toString() + "'s";

    String Z = "You are" + player.getUniqueID().toString();

    if (!world.isRemote) {

    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(S));

    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(Y));

    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(Z));}

    }

    return true;

    the Blocks tile entity class: https://pastebin.com/XNhUZe3W

    And well, Heres the string of code I use to register the tile entity: GameRegistry.registerTileEntity(GearBedTileEntity.class, "GearBedTileEntity");

    OK! NOw time to actually answer your questions! Maybe I should have put the above in the original post? My b.

    1st I'm not sure exactly what those methods of debugging are. I actually rely on printing out variables using items or events, does that count? If so I di check the value of both the UUIDs by changing them to strings and printing them in chat with this code:


    else{
    String S = "this is not yours";
    String Y = "this is" + U.toString() + "'s";
    String Z = "You are" + player.getUniqueID().toString();
    if (!world.isRemote) {
    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(S));
    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(Y));
    MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(Z));}
    }

    And the strings came out the exact same....

    2nd I assume that my method of storing the owner variable is working because I tested this earlier with a constant variable.
    Instead of storing a UUID I would store the string "four" and check for the string "four"
    at first I tried storing it as a private string in the Block class before and it would reset every time I turned the game off. So then I learned about tile entities and stored the variable with that and it would work after turning minecraft on and off. That's why I assume it's working.

    OH! ALso thank you for your help thus far!

    Posted in: Modification Development
  • 0

    posted a message on Trying to lock A tile entity Block so only its owner can use it and I can't seem to get the code to seee the player right.

    Oh yeah, and this IS in 1.7.10. I'm making this mod for a server and the focal point of the server is a mod that refuses to update past that point ssoooo I gotta live with it.

    Hi. So I'm working on a bed rework where only some of the beds count a spawn point and only you can interact with your bed, I've got most of the ownership code working it's jut one part.

    I keep storing the players Unique ID to the tile entity (Right now I'm doing it as a string then restoring it to a UUID when I do the comparison I don't know if that effects anything.) Before I tried to compare bothe UUIDs: the storedd one and the on of the player touching the bed.

    if(U == player.getUniqueID())
    This would all ways return false, even if I had just stored the UUID variable to the tile entity and had not restarted the game yet.

    So then I thought to try and get the player using the UUID? I'm not sure if that even makes sense it was jut a hunch. I changed the code to:

    if(world.func_152378_a(U) == world.func_152378_a(player.getUniqueID()))

    But now I'm afraid it will allways return true, since I don't really understand when or why forge changes the character.

    SO I'm wondering if anyone knows if my present code is working for sure or not, and any code that may work better in Identifying the specific player that actual interacted with this Block first.

    I can add the rest of my code if I need to I just didn't think it would be needed.

    edit: turns out the string ISN'T saving. Dangit....

    Posted in: Modification Development
  • 0

    posted a message on Trying to brain storm some ideas on marking areas as owned by X player.

    Thanks so much for the ideas! I might mediate on them and try and find the best combination of them to make the most effect use of them (plus what I can actually accomplish with my current skill level >_>)

    I was doing research on tile entities while this post cooked and really like the claim block idea now that I understand it XD

    Thanks :D

    Posted in: Modification Development
  • 0

    posted a message on Trying to brain storm some ideas on marking areas as owned by X player.

    Hiya. I'm trying to make my own version of one of those, server Land claiming mods.

    I'm using forge. do I need to say that?

    Right now I'm trying to think of how to assign X amount of land to X player so the game (mostly in the form of forge events) can setup reactions for the owner and other players.

    I thought about how you can save info to items NBT and maybe I could do that with pre placed blocks and Chunks but apparently NBT is a thing that needs to be built into a thing and you can't add it after the fact? I'm not sure I find it very confusing.

    So now the best idea I have is to make a lit of owned areas and pull up that list and check it during an event but that doesn't feel very optimal.....

    So guess my question is, is the info I put in this post accurate? Is their no forge supported way to save some kin of "owner variable" to a chink or block. and is using a list checking system asking for lag?

    Posted in: Modification Development
  • 0

    posted a message on Trying to use method ForgeRegistries.BLOCKS.getValue() and ForgeRegistries.ITEMS.getValue() to get mod stuff not working.

    O_O YES! THANK YOU! I will add this info to my tutorial and mod page... if this ever gets a mod page...

    Posted in: Modification Development
  • 0

    posted a message on Trying to use method ForgeRegistries.BLOCKS.getValue() and ForgeRegistries.ITEMS.getValue() to get mod stuff not working.

    The mods I'm using are for mine stuck, and pams harvest craft. I made a some code to read through a txt file, and get user made entrys. the whole idea of the mod is to make a plugin to add custom recipes to mine stuck. SO its a little long and confusing, but I can try posting it.

    https://pastebin.com/4ggpEpYR

    variables I end up using to try and get the items so far have been mod id :harvestcraft item: peanut
    and mod id minestuck item pogohammer
    I'll try some more stuff now that I know the code should be working, but that's how far i got so far.

    EDIT O_O WELP minestuck works. apparently the item is pogo_hammer. Sigh this is embarrassing , My B. Imma try and get the pam thing to work.

    edit again: and pams harvest crft works with peanutitem instad of peanut. Myyy b again.

    Posted in: Modification Development
  • 0

    posted a message on Trying to use method ForgeRegistries.BLOCKS.getValue() and ForgeRegistries.ITEMS.getValue() to get mod stuff not working.

    Hi, I'm trying to use the code:

    ResourceLocation R = new ResourceLocation(modId, item name);
    ForgeRegistries.BLOCKS.getValue(R);

    OR

    ForgeRegistries.ITEMS.getValue(R);


    And it works for mine craft where the mod Id is the string "minecraft" but when I try and use it on a modid and item it doesn't work. is their a reason for this? like something I don't get about this method? its hard to test cus I'm using thi to make a plugin for another mod and when I tried to get the git hub repository into my IDE (eclipse) it didn't really work and I'm still trying to get it to work, so I can only test this mod by compiling it and using it with the other mod.
    SO any info you can throw at me would be appreciated.
    Thanks in advance.

    Posted in: Modification Development
  • 0

    posted a message on updating a mod from 1.7.10 to 1.11 in only that GameRegistry.findItem no longer seems to work.

    THat did it ! Thanks a ton! The only thing I had to learn was how to make a resource location variable. whitch is basically,
    ResourceLocation R = new ResourceLocation(modId, item);
    which is nice cus it means I didn't ave to change ANYTHING!
    i mean their are some problems with my combination scripts (is scripts a good word?) but that has to do with the mod changing from 1.7.10 to 1.11.
    Thanks again :D

    edit: crap. sooo its not working for mods. how do I find a mods resource domain? wish I'd realized this before I marked it resolved....

    Posted in: Modification Development
  • To post a comment, please or register a new account.