Everything posted by BusyBeever
-
[1.7.10] GuiOverlay
My mistake was the wrong ElementType for the event. ElementType.Experience works fine
-
[1.7.10] GuiOverlay
Well ur code works, so I got something to work with but there is one thing u should seriously improve Integer.parseInt("FFFFFF", 16) Replace that with 0xFFFFFF .. What u are doing is slow and dirty
-
[1.7.10] GuiOverlay
Hey everyone, first of all I know a lot of people will be complaining that 1.7 is ancient, but I cant update until mods I depent on do. I got an GUIOverlay that is supposed to render text to the screen. It works fince in 1.10 (with some minor adjustments to the newer version) but in 1.7 there is no text showing, and I have no idea why. The code is getting called, I see my sysout on the console @SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { if(holder==null) holder = QuestHolder.get(); if(event.isCancelable() && (event.type==ElementType.ALL)) { mc.getTextureManager().bindTexture(texture); ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int i=0; int height = 30; mc.fontRenderer.drawStringWithShadow("Test", sr.getScaledWidth()/2, sr.getScaledHeight()/2, 0xFFFFFF); for (Quest quest : holder.getQuests()) { System.out.println(holder.getQuests().size()); if(!quest.isFollowed()) { mc.fontRenderer.drawString(quest.getName(), 100, height, WHITE); for(Condition condition:quest.getConditions()) { i+=1; mc.fontRenderer.drawString(condition.getDescription(), 30, height+10*i, condition.isFinished()? GREEN: RED); } i=0; height+=50; } } } }
-
[1.10] Best time to sync capabilites
to be honest. it doesnt matter if I have Minecraft.getMinecraft().thePlayer in the handler method, because I am 100% sure that when I am inside this method it is on client side. But changing to the other event isnt helping..
-
[1.10] Best time to sync capabilites
This should be everything that is problem related.. I found one solution but that one sucks seriously EventHandler @SubscribeEvent public void playerJoined(final PlayerLoggedInEvent event) { final QuestHolder holder =event.player.getCapability(CapabilityQuestHolder.CAPABILITY_QUEST_HANDLER, null); /* *Dirty workaround .. new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } for (Quest quest : holder.getQuests()) { Questmod.network.sendTo(new PacketAddQuest(quest), (EntityPlayerMP) event.player); } } }).start(); */ for (Quest quest : holder.getQuests()) { Questmod.network.sendTo(new PacketAddQuest(quest), (EntityPlayerMP) event.player); } } PacketHandler @Override public IMessage onMessage(final PacketAddQuest message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { QuestHolder holder = QuestHolderHandler.get(); holder.addQuest(message.quest); System.out.println(holder.getQuests().size()); } }); return null; } QuestHolderHandler#get @SideOnly(Side.CLIENT) public static QuestHolder get() { System.out.println(Minecraft.getMinecraft().thePlayer); //Prints null return Minecraft.getMinecraft().thePlayer.getCapability(CapabilityQuestHolder.CAPABILITY_QUEST_HANDLER, null); //Crash happens here (obvious reasons) } Crashlog
-
[1.10] Best time to sync capabilites
Well. This reduced the occurency of the error but didnt removed it.. Its still there sometimes.
-
[1.10] Best time to sync capabilites
Tarded me. Thank you very much ernio
-
[1.10.2] [Solved] Get value of a TileEntity variable from TileEntitySR
You just need to increment degrees on client side. I dont know the best place to do it, but doing it every time you render it will do the trick, althought there might be better solutions
-
[1.10.2] [Solved] Get value of a TileEntity variable from TileEntitySR
- [1.10] Best time to sync capabilites
Hey everyone, I need to send data from server to client whenever the client joins (some quests) My problem is that I cant find the correct event for it. I felt like PlayerLoggedInEvent should do the job, but sometimes the packet is "so fast" it reaches before Minecraft.getMinecraft.thePlayer is populated, which I need. So what event do I use, what am I missing? SideNote: Yes I know I should replace the PacketAddQuest with one Packet to sync allquests when the player joins, but thats a task for later EventHandler @SubscribeEvent public void playerJoined(PlayerLoggedInEvent event) { QuestHolder holder =event.player.getCapability(CapabilityQuestHolder.CAPABILITY_QUEST_HANDLER, null); for (Quest quest : holder.getQuests()) { Questmod.network.sendTo(new PacketAddQuest(quest), (EntityPlayerMP) event.player); } } PacketAddQuestHandler @Override public IMessage onMessage(PacketAddQuest message, MessageContext ctx) { QuestHolder holder = QuestHolderHandler.get(); holder.addQuest(message.quest); return null; } QuestHolder#get @SideOnly(Side.CLIENT) public static QuestHolder get() { System.out.println(Minecraft.getMinecraft().thePlayer); //null sometimes return Minecraft.getMinecraft().thePlayer.getCapability(CapabilityQuestHolder.CAPABILITY_QUEST_HANDLER, null); }- Crash?
you should not be copy pasting code that a tutorial guy made.- [1.10] 1.10 Changes
Hey everyone, I was out of modding for a while and missed the jump to 1.10. So I want to catch back up and ask for a good guide of changes to 1.10. Things that went deprecated, things we should use now, new nifty stuff the forge modding team gave us etc Greetz BusyBeever- [1.8] How to spawn entities automatically?
you still need to call World#spawnEntityInWorld (I think that was the method name) on the world object where u want to spawn the entity- Any series of good 1.9.4 tutorials?
you can use 1.9 tutorials. 1.8 is also fine for most of forge, 1.8 is easy to update with solid java knowledge- [1.9] onItemRightClick getting called twice?
It gets called once for server, once for client side. makes two- [1.8] Add recipes from custom furnaces to nei
http://www.minecraftforge.net/forum/index.php?topic=12753.0- How to program in a team
use github/bitbucket (git)- [1.9.4] Checking if an item can be cooked into a food
You can check if the item has a result in furnace recipes and then do what diesieben said- [1.9] onBlockActivated cause game to crash when any block is right-clicked
So you are in 1.9 right? Then you must see that big compile error you get because you need to return an action result- Modding help?
Check out youtube, there is enough if you need detailed explanations- [1.9] getThrower() null on client
you dont need the information who is shooting the bullet on client side. applying damage should be done on server side. see ernios post..- [1.8] world.getBlockState
depende on where you need. you need it to get passed in the method where you want to use it. if you dont understand that learn java and come back- [1.9] Capability Syncing
To be honest it is okay to use it directly in netty context, because if you have a packet that you send from server to client side you always know that you are safe to use Minecraft.getMinecraft()- How do I increase and decrease a stack size
onBlockRightClick get the item in players hand, check for null, if its not null you can do stack.stacksize++- [1.9] Custom boat won't move
Don't copy paste code you don't understand - [1.10] Best time to sync capabilites
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.