
BusyBeever
Members-
Posts
201 -
Joined
-
Last visited
Everything posted by BusyBeever
-
My mistake was the wrong ElementType for the event. ElementType.Experience works fine
-
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
-
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; } } } }
-
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..
-
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
-
Well. This reduced the occurency of the error but didnt removed it.. Its still there sometimes.
-
Tarded me. Thank you very much ernio
-
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); }
-
you should not be copy pasting code that a tutorial guy made.
-
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
-
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
-
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?
BusyBeever replied to NotoriusAnimeDude's topic in Modder Support
It gets called once for server, once for client side. makes two -
[1.8] Add recipes from custom furnaces to nei
BusyBeever replied to skyfir3's topic in Modder Support
http://www.minecraftforge.net/forum/index.php?topic=12753.0 -
use github/bitbucket (git)
-
[1.9.4] Checking if an item can be cooked into a food
BusyBeever replied to squirrel_killer's topic in Modder Support
You can check if the item has a result in furnace recipes and then do what diesieben said -
Check out youtube, there is enough if you need detailed explanations
-
you dont need the information who is shooting the bullet on client side. applying damage should be done on server side. see ernios post..
-
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
-
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
BusyBeever replied to Hurricane996's topic in Modder Support
onBlockRightClick get the item in players hand, check for null, if its not null you can do stack.stacksize++ -
Don't copy paste code you don't understand