Jump to content

Bugzoo

Members
  • Posts

    268
  • Joined

  • Last visited

Everything posted by Bugzoo

  1. I want to consume blocks, not items
  2. Title says it all
  3. I want to add pictures that are gui buttons. Thanks
  4. I have a food that when you eat it, it adds 16000 ticks to the worlds time. But everytime i eat it, the time changes for a second and then goes back to the way it was before. Here is my code protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer entity) { mc.theWorld.setWorldTime(mc.theWorld.getWorldTime() + 16000); }
  5. This is not a bug. You cant place redstone over vanilla slabs either
  6. That mod is going to evolve the way we play minecraft
  7. Got it fixed. I was adding the buttons in the drawScreen method instead of the initGui
  8. I found out that when I press the button, it glitches and keeps pressing the button. So if i press it ones it actually presses tons of times. do you know how to fix this, or why its happening
  9. Still doesnt make a difference
  10. Sorry... public void actionPerformed(GuiButton guibutton){ if(guibutton.id == 1){ Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "DrinksNetwork"; packet.sentID = 50; PacketDispatcher.sendPacketToServer(packet); }
  11. Im handling a packet so its pretty obvious what class its in but heres my code package MinespressoMod; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; public class PacketHandler implements IPacketHandler { @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { //Cappuccino if (packet.channel.equals("DrinksNetwork") && packet.sentID == 1) { ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.Cappuccino, 1)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 2) { ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.SugaryCappuccino, 1)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 3) { ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.MagicCappuccino, 1)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 4) { ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.SugaryMagicCappuccino, 1)); } //Coffee if (packet.channel.equals("DrinksNetwork") && packet.sentID == 10) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Coffee)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 11) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryCoffee)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 12) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.MagicCoffee)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 13) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMagicCoffee)); } //Minespresso if (packet.channel.equals("DrinksNetwork") && packet.sentID == 20) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Minespresso)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 21) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMinespresso)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 22) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.MagicMinespresso)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 23) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMagicMinespresso)); } //Latte if (packet.channel.equals("DrinksNetwork") && packet.sentID == 30) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Latte)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 31) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryLatte)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 32) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.MagicLatte)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 33) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMagicLatte)); } //Tea if (packet.channel.equals("DrinksNetwork") && packet.sentID == 40) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Tea)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 41) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryTea)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 42) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.MagicTea)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 43) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMagicTea)); } //HotChocolate if (packet.channel.equals("DrinksNetwork") && packet.sentID == 50) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.HotChocolate)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 51) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryHotChocolate)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 52) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.MagicHotChocolate)); } if (packet.channel.equals("DrinksNetwork") && packet.sentID == 53) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.SugaryMagicHotChocolate)); } } private void handleRandom(Packet250CustomPayload packet) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); int randomInt1; int randomInt2; try { randomInt1 = inputStream.readInt(); randomInt2 = inputStream.readInt(); } catch (IOException e) { e.printStackTrace(); return; } System.out.println(randomInt1 + " " + randomInt2); } }
  12. Im sending a packet. if (packet.channel.equals("DrinksNetwork") && packet.sentID == 1) { ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.Cappuccino, 1)); }
  13. Im using addItemStackToInventory and i keep getting random numbers of items back. Here is the code im using ((EntityPlayer)player).inventory.addItemStackToInventory(new ItemStack(Minespresso.SugaryMagicCappuccino, 1));
  14. Thanks you so much!
  15. I have buttons that when you press send packets to the server. Here is how i handle the packets if (packet.channel.equals("DrinksNetwork")) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Cappuccino)); } But since i have multiple buttons, I need to give the guibutton id and I dont know if you can do that. Here is what i tried if (packet.channel.equals("DrinksNetwork" && CappuccinoGUI.guibutton == 1)) { ((EntityPlayer)player).inventory.setInventorySlotContents(1, new ItemStack(Minespresso.Cappuccino)); } But that code doesnt work
  16. Wow, halarious. Thanks so much for the help, I finally got it working
  17. Im going to sound like a retard, but how do i cast. I have learnt java... but i forget
  18. Thats just a Player, not EntityPlayer. and i cant give the player an item with it
  19. Yea, i just changed that, stupid mistake. But the real problem is I cant give the player an item because i need an EntityPlayer in the onPacketData method.
  20. I'm getting there, now all I need is to find a way to give the player an item on button click from within the PacketHandler. I cant give the player an item since there is not EntityPlayer in the onPacketData method. By the way, im using 1.6.4 so I can have my mod for 1.6.4 and 1.7.2
  21. I'm not sure its possible to stop ores from other mods spawning, but if you increase the rarity of your ores then its likely to have some affect.
  22. package MinespressoMod; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; public class CappuccinoGui extends GuiScreen{ public final int xSizeBackground1 = 248; public final int ySizeBackground1 = 166; public ResourceLocation background1 = new ResourceLocation("minedrinks", "textures/gui/CappuccinoBackground.png"); public ResourceLocation Coffee = new ResourceLocation("minedrinks", "textures/items/coffee.png"); @Override public void actionPerformed(GuiButton guibutton){ if(guibutton.id == 1){ Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "GenericRandom"; Side side = FMLCommonHandler.instance().getEffectiveSide(); if (side == Side.SERVER) { } else if (side == Side.CLIENT) { // We are on the client side. EntityClientPlayerMP player = (EntityClientPlayerMP) playerEntity; player.sendQueue.addToSendQueue(packet); } else { // We are on the Bukkit server. } return false; mc.thePlayer.inventory.addItemStackToInventory(par1ItemStack)(1, new ItemStack(Minespresso.Cappuccino)); } } public CappuccinoGui(){ } public boolean doesGuiPauseGame(){ return false; } public void drawScreen(int i, int j, float f){ buttonList.add(new GuiButton(1, width / 2 - 70, height / 2 - 40, 130, 20, "Regular Cappuccino")); buttonList.add(new GuiButton(2, width / 2 - 70, height / 2 - 15, 130, 20, "Extra Sugary Cappuccino")); buttonList.add(new GuiButton(3, width / 2 - 70, height / 2 + 15, 130, 20, "Magical Cappuccino")); buttonList.add(new GuiButton(4, width / 2 - 70, height / 2 + 40, 130, 20, "Sugary Magic Cappuccino")); //Background Texture GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(background1); int k1 = (this.width - this.xSizeBackground1) / 2; int l1 = (this.height - this.ySizeBackground1) / 2; this.drawTexturedModalRect(k1, l1, 0, 0, this.xSizeBackground1, this.ySizeBackground1); super.drawScreen(i, j, f); } } I Tried this code but the playerEntity is not working and I cant create an EntityPlayer in the parameters
  23. Yea, but i cant seem to send a packet onButton clicked
×
×
  • Create New...

Important Information

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