Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mew

Members
  • Joined

  • Last visited

Everything posted by Mew

  1. Hmm... I'm thinking that if I want to give the vanilla items custom abilities then I should use this...
  2. I think I see it... I'm thinking either put it near the BEGINNING, or but a load thing in the loadNBT mehtod? [EDIT] Or is it to do with the fact that I used the variable "compound" to set the tag, but "nbt" for everything else?
  3. Same problem as before, it does not save the data that it is supposed to. If I close the world, then reopen it, it relaunches the GUI that should only launch if the playersClass string in the PlayerInformation file (found here: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java) is "" or nothing pretty much. (if it was null it would crash. Or so I have been told.) So why is my data, A) not saving/writing (not an issue. I am almost certain) or B) being reset. And is there a better way to launch the GUI? what I have atm: @Override public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { PlayerInformation playerInfo = PlayerInformation .forPlayer((EntityPlayerMP) player); if (playerInfo.getPlayersClass().equals("")) { ((EntityPlayerMP) player).openGui(RPG.instance, EnumGui.LoreStartingPage.getIndex(), ((EntityPlayerMP) player).worldObj, 0, 0, 0); } else { ((EntityPlayerMP) player) .sendChatToPlayer("<Mysterious Voice> Welcome back master " + playerInfo.getPlayersClass()); } if (SoundLoader.didSoundsLoad == true) { ((EntityPlayerMP) player) .sendChatToPlayer("[MinePG Sound Loader] Loaded Sounds Successfully"); } else if (SoundLoader.didSoundsLoad == false) { ((EntityPlayerMP) player) .sendChatToPlayer("[MinePG Sound Loader] Failed to load one or more sounds"); } }
  4. Hmm... maybe.... What I really want to know is what a core mod does, and what are good uses for them
  5. Yeah, sorry. I know I can be a bit of an idiot and a bit slow witted at times, sorry. Here is the code I now have for the GUI in relation to the execute() method: package rpg.client.gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import rpg.BaseClassList; import rpg.client.HudOverlayHandler; import rpg.gui.ContainerEmpty; import rpg.network.packet.PacketChoseArcher; import rpg.network.packet.PacketChoseMage; import rpg.network.packet.PacketChoseWarrior; import rpg.playerinfo.PlayerInformation; public class GuiChooseClass extends GuiContainer { String[] starterList; Item item; public GuiChooseClass() { super(new ContainerEmpty()); starterList = BaseClassList.getStarterStringList(); } @Override @SuppressWarnings("unchecked") public void initGui() { super.initGui(); buttonList.clear(); for (int i = 0; i < starterList.length; i++) { buttonList.add(new GuiButton(i, width / 3 - 100, height / 6 + i * 20, starterList[i])); } } @Override public void actionPerformed(GuiButton button) { switch(button.id) { case 0: new PacketChoseArcher().sendToServer(); break; case 1: new PacketChoseMage().sendToServer(); break; case 2: new PacketChoseWarrior().sendToServer(); break; } PlayerInformation playerInfo = PlayerInformation.forPlayer(mc.thePlayer); mc.thePlayer.addExperienceLevel(1); mc.thePlayer.sendChatToPlayer("[MinePG] You have chosen the path of the " + playerInfo.getPlayersClass()); mc.thePlayer.sendChatToPlayer("<Mysterious Voice> Take care in this world my Friend..."); mc.thePlayer.sendChatToPlayer("<Mysterious Voice> Many things lurk here that are better left alone"); mc.thePlayer.sendChatToPlayer("<Mysterious Voice> ..."); mc.thePlayer.sendChatToPlayer("<Mysterious Voice> You will need to be equiped"); mc.thePlayer.sendChatToPlayer("<Mysterious Voice> Have this equipment, learn to use it"); mc.thePlayer.closeScreen(); MinecraftForge.EVENT_BUS.register(new HudOverlayHandler()); } @Override public void drawGuiContainerBackgroundLayer(float par3, int par1, int par2) { drawDefaultBackground(); drawString(fontRenderer, "Welcome to the world of MinePG!!", 3, 10, 0xFFFFFF); drawString(fontRenderer, "Please pick your desired Class:", 3, 20, 0xFFFFFF); } @Override public void keyTyped(char i, int i1) { } } And here is an example of one of the packets: package rpg.network.packet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import rpg.config.base.archer.ArcherArmor; import rpg.config.base.archer.ArcherWeapons; import rpg.playerinfo.PlayerInformation; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import cpw.mods.fml.relauncher.Side; public class PacketChoseArcher extends MinePGPacket { @Override protected void execute(EntityPlayer player, Side side) { if(side.isServer()) { PlayerInformation playerInfo = PlayerInformation.forPlayer(player); playerInfo.setPlayersClass("Archer"); playerInfo.setCurrency(20); player.inventory.addItemStackToInventory(new ItemStack( ArcherWeapons.bowTraining, 1)); player.inventory.addItemStackToInventory(new ItemStack( ArcherWeapons.arrowTraining, 32)); player.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.tunicTraining, 1)); player.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.legsTraining, 1)); player.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.bootsTraining, 1)); } } @Override protected void readData(ByteArrayDataInput in) { } @Override protected void writeData(ByteArrayDataOutput out) { } }
  6. I believe I didn't explain my idea well enough. And it would also require a core mod to be made. have you tried making a function that "Mirrors" the normal function? Then mirror everything else that is needed for it and such? Though this will also probably require either a base edit or a core mod.
  7. Mew replied to Turakar's topic in Modder Support
    Research Tile-entities my friend. They are the entities of the non living
  8. Hmm... I was wondering, could you maybe make an invisible replica of the player entity that has these set attributes? Then, when you needed to use those attributes, switch out the EntityPlayer to your "clone"? Then once that action has been performed, reverts back to that EntityPlayer that was originally used?
  9. Well, I tried putting stuff in the execute() method, but it didn't work. I am completely lost... I will reexplain what I am trying to do so that you can give me a detailed explanation of what to do. I am making an RPG mod that has classes (e.g. Archer, Mage, Warrior) and that is set in a GUI that opens when the player opens the world. But my problem is that I can only save the players class for the time the world is open, but as soon as you quit the world, the variable gets reset. So I tired using the IExtendedEntityProperties, and that STILL doesn't seem to be working for saving the variable. I also only want to open the GUI when the world is a new one, and not already loaded once. So my new, revised question is: How would I do above mentioned?
  10. I was wondering, how would I go about making a core mod? From what I understand, core mods allow you to "edit" base classes without actually editing them. And if that is true, then I definitely need it for my mod. And I believe this is done with ASM transformers? How would I use those?
  11. Mew replied to Chibill's topic in Modder Support
    Read through my config code and any other code you feel like here: https://github.com/ModderPenguin/MinePG
  12. This is what is inside a typical packet of mine: package rpg.network.packet; import net.minecraft.entity.player.EntityPlayer; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import cpw.mods.fml.relauncher.Side; public class PacketChangeClass extends MinePGPacket { @Override protected void execute(EntityPlayer player, Side side) { } @Override protected void readData(ByteArrayDataInput in) { } @Override protected void writeData(ByteArrayDataOutput out) { } } The execute method is wat actually does stuff...
  13. What I would try to do (probably won't work) is make it so that it checks to see if the player is on a special ban list (that you create, e.g. specialban.txt or whatever) and if the player is on that list, then don't connect, display the connection error GUI or something similar.
  14. Okay. I think I understand now. I make a packet for the button, and then, depending on the button id, add stuff to the players inventory and stuff like INSIDE the packet? in the execute() method?
  15. What I meant was, how do I tell the code to do it server side?
  16. How do I do it server side?
  17. Uhh, the items ARE usuable. And I have a packet for the playerinformation, but i don't have one for buttons what kind of packet would that be? And, just to make sure that the items are usuable, how do I make it server side?
  18. Ok. I have where I change the value here: switch (button.id) { case 0: playerInfo.setPlayersClass("Archer"); playerInfo.setCurrency(20); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( ArcherWeapons.bowTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( ArcherWeapons.arrowTraining, 32)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.tunicTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.legsTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( ArcherArmor.bootsTraining, 1)); break; case 1: playerInfo.setPlayersClass("Mage"); playerInfo.setCurrency(20); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( MageWeapons.staffTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( MageArmor.hatTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( MageArmor.robeTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( MageArmor.sandalsTraining, 1)); break; case 2: playerInfo.setPlayersClass("Warrior"); playerInfo.setCurrency(20); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( WarriorWeapons.swordTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( WarriorArmor.helmetTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( WarriorArmor.cuirassTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( WarriorArmor.greavesTraining, 1)); mc.thePlayer.inventory.addItemStackToInventory(new ItemStack( WarriorArmor.sabatonsTraining, 1)); break; } That is where it is all done. This is inside the onButtonClicked() or whatever its called.
  19. oops... I am such a fail at looking and um, how and when would I send my packet?
  20. ^^^^^^^ Yeah, I would like to know this too.
  21. No, the playersClass string is in the PlayerInformation class. So how do I compare strings properly?
  22. How would I do this in this method? @Override public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { } What I have at the moment ALWAYS has the players class string set as as "". Even though I know it's saving the data to the NBT. @Override public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { PlayerInformation playerInfo = PlayerInformation.forPlayer((EntityPlayerMP)player); if (playerInfo.getPlayersClass() == "") { ((EntityPlayerMP) player).openGui(RPG.instance, EnumGui.LoreStartingPage.getIndex(), ((EntityPlayerMP) player).worldObj, 0, 0, 0); }// else { //((EntityPlayerMP) player) //.sendChatToPlayer("<Mysterious Voice> Welcome back master " //+ playerInfo.getPlayersClass()); //} if (SoundLoader.didSoundsLoad == true) { ((EntityPlayerMP) player) .sendChatToPlayer("[MinePG Sound Loader] Loaded Sounds Successfully"); } else if (SoundLoader.didSoundsLoad == false) { ((EntityPlayerMP) player) .sendChatToPlayer("[MinePG Sound Loader] Failed to load one or more sounds"); } } So how would I change my method to suit the needs of the if() statement?
  23. Yeah, but that won't be released. I am going to change it around. That was to just get me started. And yes, I'm pretty sure I use the Karma event. I have karma in the mod. I'm sorry if seem like I am copying your code, I am just using that as a base to then change and build of to fit my purposes. I am not 100% percent sure what it is, but I am fairly certain it is to do with core mod transformers. Which is another topic I would like to learn about...
  24. Well it helps ALOT, except for the fact, how do I then call a method I have created that gets a field? Such as I have the method, getRandomString(); that return a string. How do I call that method? I thought something like this: (YourDataClass)entity.getExtendedProperties("someUniqueIdentifierEgModid").getRandomString(); but it didn't recognise the method. Do I have to make the methods static?
  25. I am wondering how I would go about this. This seems the best option to me as I can't seem to get anything else to really work... A tutorial on IExtendedEntityProperties or using the Entity.getEntityData() method. But as nothing seems to be avaliable with these, I want to create my own custom .dat file or whatever file is needed for NBTs'.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.