Jump to content

Dread_Boy

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Dread_Boy's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Yesterday I found a solution to this. I could either send appropriate packets to a server or I could simulate user clicks. I went for second option and it's as simple as handleMouseClick(slot30, slot30.slotNumber, 0, ClickType.PICKUP); handleMouseClick(slot30, slot30.slotNumber, 0, ClickType.PICKUP_ALL); handleMouseClick(slot0, slot0.slotNumber, 0, ClickType.PICKUP); handleMouseClick(slot2, slot2.slotNumber, 0, ClickType.QUICK_MOVE);
  2. Hi, I'm struggling with automated villager trading. I've extended GuiMerchant, added some buttons and now I'm implementing actual trading. Method that should do the trading is: void StartTrading() { IMerchant villager = getMerchant(); EntityPlayer player = villager.getCustomer(); MerchantRecipeList trades = villager.getRecipes(player); MerchantRecipe trade = trades.get(0); ItemStack input = trade.getItemToBuy(); ItemStack materials = getFirstAvailableItemStack(player, input); if(materials == null) return; ContainerMerchant merchant = ((ContainerMerchant)inventorySlots); merchant.getMerchantInventory().setInventorySlotContents(0, materials); inventorySlots.transferStackInSlot(player, 2); inventorySlots.transferStackInSlot(player, 0); } Method works as expected but as soon as I click on newly acquired emeralds, all changes are reverted. I assume I'm missing something but I can't find any tutorial that would address this problem. getFirstAvailableItemStack method in case you are interested: ItemStack getFirstAvailableItemStack(EntityPlayer player, ItemStack itemStack){ for(ItemStack stack:player.inventory.mainInventory){ if(stack != null){ if(stack.getItem().equals(itemStack.getItem())) return stack; } } return null; }
  3. Apparently, I have to add buttons in initGui instead of constructor: @Override public void initGui() { // TODO Auto-generated method stub super.initGui(); this.buttonList.add(this.buttonStart = new MerchantButton(0, guiLeft + xSize - 28, guiTop + 45, MerchantButton.textureStart)); this.buttonList.add(this.buttonOptions = new MerchantButton(0, guiLeft + xSize - 28, guiTop + 61, MerchantButton.textureOptions)); }
  4. Great, I've been trying to get it working but I can't. Removing all unused or irrelevant code: public class GuiAutoMerchant extends GuiMerchant { GuiButton buttonStart; public GuiAutoMerchant(InventoryPlayer inventory, IMerchant merchant, World worldIn) { super(inventory, merchant, worldIn); // TODO Auto-generated constructor stub this.buttonList.add(this.buttonOptions = new GuiButton(0, 100, 100, 200, 200, "Options")); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { // TODO Auto-generated method stub super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); System.out.println("Drawing default merchant GUI"); } } But my button doesn't show up. I opted to draw default Villager GUI but even with custom background GUI, button wasn't displayed. What am I missing?
  5. Great, I'll take a look at events you are describing. How would I go about overlaying these 2 buttons on top of vanilla GUI?
  6. Nothing of that sort, it's should also work on vanilla servers. You could also call it a hack as it will allow automatic trading... Right now I can do semi-automatic trading with autohotkey script but I wish to replace this with a mod. There will be no block or item, just two buttons added to vanilla villager screen. First one will start trading, 2nd one is for settings (trade orders and such).
  7. This is a mockup of my idea: http://imgur.com/a/VJPNA. It's automatic villager trading mod that simulates player's trading. Is it possible to do this in a way it would be useable also on vanilla servers? Trade with villager until it's locked, close UI, look away for few seconds, look back, trade again... Trade order would be determined in UI, check the pictures. If you have any feedback, feel free to voice it. I've already installed Eclipse and created sample mod, where would I go from there? I can code but I find Forge docs ... lacking? It explains 1.7 to 1.8 transition but almost nothing other than that. All tutorials I found are mostly targeted for beginners. And last question. What causes lag with XP farms? Pure amount of entities, mobs colliding and being forced to stay in one block or their pathfinding (fucked again because they are in one block)? I'm talking about client lag (FPS dropping), not necessarily server lag. If it is possible to reduce lag, I would also like to write 2nd mod that would address this issue.
×
×
  • Create New...

Important Information

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