Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

BusyBeever

Members
  • Posts

    201
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

BusyBeever's Achievements

Creeper Killer

Creeper Killer (4/8)

26

Reputation

  1. My mistake was the wrong ElementType for the event. ElementType.Experience works fine
  2. 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
  3. 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; } } } }
  4. 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..
  5. 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
  6. Well. This reduced the occurency of the error but didnt removed it.. Its still there sometimes.
  7. 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
  8. 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); }
  9. you should not be copy pasting code that a tutorial guy made.
  10. 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
  11. 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
  12. 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
  13. It gets called once for server, once for client side. makes two
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.