Posted August 4, 20169 yr 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.
August 5, 20169 yr What do you mean automatic? Are you going to make a new block that opens a Gui and allows players to select possible villager trades? Or is the block going to be placed next to a villager and it will access that inventory to deal with trades? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr Author 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).
August 5, 20169 yr You would have to override when the player right clicks on the Villager and display a new gui/container which you can't do on a vanilla server. Actually you may be able to subscribe to a ClientTickEvent and check if the players currentScreen is the villager one and if so replace it. Though client tick event could cause lag. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr You know there is a PlayerContainerEvent that is fired whenever the player opens (or closes) a gui related to a container (of which the GuiMerchant is) as well as the GuiOpenEvent when ever the player....opens a gui (which the GuiMerchant is). Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
August 5, 20169 yr You know there is a PlayerContainerEvent that is fired whenever the player opens (or closes) a gui related to a container (of which the GuiMerchant is) as well as the GuiOpenEvent when ever the player....opens a gui (which the GuiMerchant is). Actually I did not though I makes sense that there is those sound mighty useful, though I have never had to do anything like that before. But is it possible to register GuiOpenEvent only client side and have it work? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr You know there is a PlayerContainerEvent that is fired whenever the player opens (or closes) a gui related to a container (of which the GuiMerchant is) as well as the GuiOpenEvent when ever the player....opens a gui (which the GuiMerchant is). Actually I did not though I makes sense that there is those sound mighty useful, though I have never had to do anything like that before. But is it possible to register GuiOpenEvent only client side and have it work? Yes, any eventhandler can be registered on both sides or just one. The subscribed events do have to be fired on that particular side of course.
August 5, 20169 yr Yes, any eventhandler can be registered on both sides or just one. The subscribed events do have to be fired on that particular side of course. Alright I have never made an only server side mod or a client side mod before good to know. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr Author 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?
August 5, 20169 yr You wouldn't be overlaying you would be creating a new Gui in general, the easiest way would be to extend GuiMerchant and in init add Buttons. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 7, 20169 yr Author 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?
August 8, 20169 yr Author 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)); }
August 8, 20169 yr Yes. Yes you do. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.