-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
1. You are probably Enabling some GL11 property and not disablig it, ot disabling it where you shouldn't, we need code. 2. That's how anything using GuiListExtended works - they are designed to render everything that is inside or partially-inside list, when element is out of list in 100% then the renderer stops rendering it. You would need custom implementation of GuiSlot (or maybe a bit less, like GuiListExtended) to change it, and trust me, writing good logic for this will take time. Edit: I am a LIAR! Sorry, there were changes in 1.8 regarding those lists (or maybe I just derped with names). GuiScrollingList is not an implementation of GuiListExtended. But I think they are using same logic, gotta check it
-
I knew you'd say that (you just hate Side don't you? ). That is still not the problem tho, using !world.isRemote leaves me with same console output. I might not be understaning architecture of minecraft ticking that well, but I thought idea of ticks was to run one after another, not to run them simultainiously which they seem to be doing (based on logs). Seriously what: [16:55:16] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** My guess is that there is something I don't know about logic behind "Skipping" ticks to catch up with data flow. Maybe I shouldn't be using Phases at all?
-
@SubscribeEvent public void onEntityTick(LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) System.out.println("TICK"); // Code happens } } Note: I am using LivingUpdateEvent because this will be for all entities, I just converted it to Players only for testing. @SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent event) { if (event.phase == Phase.END) { for (Object o : event.world.getLoadedEntityList()) { if (o instanceof EntityPlayer) { System.out.println("POST**********"); // Code happens } } } [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK [16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST********** This is very simplified, but still shows that sometimes there is double-ticking (I even had situation where there was 3 TICK and 3 POST) Dafuq?
-
Yeah I am pretty sure. FML is only Server side, and for Forge entity update I am checking side (server). Edit: Anyone?
-
I'd just like to add - at 30 000 000 coords there is a world-border that makes player have reddish something (by something I mean I don't know the word and mean exact same thing you want to do - I mean this red outline). You might wanna check it, maybe even use it. Also: http://minecraft.gamepedia.com/Block_models "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } Have a look at it regarding your bottle. Edit: Ah sorry, you wanted 1.7.10 rotation? You could make renderFull3D false (i think).
-
I am counting down from 10 to 0: WorldTickEvent Phase END should fire after tick (at end). LivingUpdateEvent - triggers in mid-tick. //START 10 [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 9 [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 8 [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 7 [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 6 5 [14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 4 [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 3 [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 2 [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST 1 [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST [14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:123]: REMOVE Inside LivingUpdateEvent I decrement by 1. From what I read in code Phase START and END should happen BEFORE and AFTER. worldserver.updateEntities(); Why am I getting this output in console? Note: numbers are printed by LivingUpdateEvent, "POST" are printed by WorldTickEvent. Is this bug with printing or something with threads - I can't have race conditions insie my EffectMap updating, this would break effect existance-time.
-
Uhm, Everything is inside forge. Methods are VERY self-explanatory, most even have docs. Just open IDE, then open e.g Block and see structure. There are no official JavaDocs since forge has too many updates to do that. To learn basic modding there are a LOT of tutorials (e.g: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html) Everything that is not on google is here on forum (ask).
-
[1.8][SOLVED] Where do I register my keybind handler
Ernio replied to The_Fireplace's topic in Modder Support
You do it like any other registration: FMLCommonHandler.instance().bus().register(new KeyHandler()); You just put the code in client proxy. Also note to deadrecon98: No he didn't tell him. -
Yeah... "Insert a handler". Asking "how?" would probably leave me with answer I don't understand either, so unless someone knows exacly what to do (without using ASM, which at this moment is my only idea) then I'll probably leave this for later ;p
-
1. Well-written mod will always work on both (well-written = has proxy that will make client stuff launch on client only) 2. - Server handles NBT, entities, movements, ticking, updates - everything actually. - Client has mirror of server data, e.g if you meet some player (be in visual-range), your client will receive info to construct new EntityPlayer and then will supply your client-player entity with server-player entity data. So your client actually only knows stuff that server allows it to, and everything is just a mirror. Same goes for world, mobs, other entities. 3. To simplify: CommonProxy is called always 1st, then there is check: if thread belongs to client.jar ClientProxy will be called. E.g: (simplified)
-
I'd like to know how much bytes (in packets) is vanilla sending on average per "some" time perioid. Anyone knows that and would simply give me number or maybe there is "easy" lookup on some netty tracker? (like bytes written/read in given channel) Why?
-
[1.7.10]Freeze when using custom container without any console output
Ernio replied to SuperKael's topic in Modder Support
I really hope you are familliar with breakpoints? Anyway, best way to find error is to place breakpoints in all important places and make deeper and deeper search, you should find the line that will actually stop game from working at some point. I suggest starting with constructors and main MC calls (like mc.displayGuiScreen) If you'll find something, share if there still be a problem. -
BlockState is a wrapped human-readable metadata (which is in MC since I can remember). In 1.8 you no longer check for block and its meta, you get BlockState from it. eg. Block myBlock = new someBlockWhetever(); myBlock.getDefaultState() - this will return default (probably "zero" meta if you don't have block variations); So yeah, in your world.getBlockState(??) you will need to put BlockPos(x,y,z) and then compare it to GrogsmodsBlocks.guiIDworkingStation.getDefaultBlockState(). I mean, probably You will never know
-
Well, not that this is useless (it MIGHT be useful if you want it to be), but there are some things here: 1. You don't know what given key represents (int, long, string) - So you would have to also read it and/or return e.g array of pairs <String, Object> e.g: <"someKey", Integer>, so that you can instantly know to use getInteger() - Without it, the tool is pretty very not-optimized. 2. There is a data structure that allows you to iterate: NBTTagList, yet maybe not in the way you want (reconstruction of unknown). Overall, if you want to use this tool as a clean-up device it might be useful to remove some garbage-data from e.g updating data-structure mods, otherwise - I don't like Reflection for data-reading. If you'd like to go totally hardcore you could actually take NBTTagCompound.toString() and use Matchers to get all data and even nicely return it in List of HashMaps or other stuff. Idk, it might be actually more expensive on big strings.
-
public void method(World world) { if (!world.isRemote) { //runs on server } else //runs on client } When you spawn entity (item in this case) you always do it on server only.
-
You need to do !world.isRemote check to run the code only on server side. For e.g dirt-crash. You need to check if item can be smelted (has smelting result) obviously
-
Glad you fixed it ;p Am I that bad at explaining :C
-
From my 1.7.10 IItemRenderer: Is this possible in 1.8? How? Where? Example? Does it have "nice" system or still in dev? If not - are there some works on this as for now? Idk, maybe they are planning to add "world" or "entity" to display type in json file? (you know: thirdperson, firstperson, gui or head).
-
Why would you... I alredy told you Guis are constructed when you call: mc.displayGuiScreen(new GuiScreen()); To understand this better: @Override public void finalize() { System.out.println("THIS GUI FINALIZED"); } Put this inside you GuiScreen class. Now - here's how thing happen: (let's call you gui "MyGui.class" - extending GuiScreen) 1. You open gui - MyGui.constructor 2. initGui() is called, you add buttons and task lists. 3. You press button to add/remove SOME task from some entity. 4. Server gets you "button clicked" and if can, adds some task to server-side task list of entity. 5. You should have some wrapper method like onTaskAdded() which you call after you add task to entity list and after that send apcket to client. 6. Client receives packet and inside onMessage you simply do MyGui.getCurrentlyViewedEntity().addTaskFromId(message.taskID). 7. Then (still inside onMessage) you call MyGui.getInstance().initGui(); Now, to have instance you can simply add field in MyGui.class: static MyGui instance, and inside constructor set it to this. I belive there is also minecraft method to get currendly displayed screen. Try something like: Minecraft.getMinecraft().***** - there should be method proposed that will return currentScreen. Provide new code, or better - github.
-
I literally was in it today. Seems like when you want to add #inventory renderer to item that is not dependend to its meta, it must have same name.json as unlocalized name. Idk, but that worked for me: Block: - Unlocalized name: connected_polished_granite assets.mod.blockstates/connected_polished_granite.json - must be with name of block. assets.mod.models.block/connected_polished_granite_model.json - refered from blockstates assets.mod.models.item/connected_polished_granite.json - must be with the name of block. For convinience: (assets.mod.models.item/connected_polished_granite.json) { "parent": "mod:block/connected_polished_granite_model", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } Seems like it has something to do with Model Maps (you have to put your item's model with same name as unlocalizedName for that item to actually use that model). Idk, never looked into that. Also note: adding model to block's item must be in load() (or at least after block are done registering I think, i am doing in load)
-
Client has only one instance of gui - well, not one, but you don't really care if there is one or more, depends on routine (it can be even static). As long as you keep that instance you can even call inti() from outside. I wouldn't use tick because that's next thing that will need coding not-readable stuff, also, you don't know when packets arrive, it can be 10 ticks or even 100 (if you have lags). Make a method inside you GUI that will look: (I mean, not exacly like it, but you get the idea - call initGui() after you put your task in list) public void refresh(List<task> list) { this.taskList = list; this.initGui(); } ...and call it from packet receiver.
-
Well, obviously toBytes writed data to byte stream (buffer) and fromBytes reads it. Sender writes, receiver reads.
-
[1.7.10] Send the updated player inventory contents to the client?
Ernio replied to Eternaldoom's topic in Modder Support
What kind of inventory? You own implementation or vanilla? In any case - you will need to send packet and write ItemStack to buffer (there is method for it). Packet should be sent whenever slot changes on server. If you are implementing IInventory you can simply add Packet.sendTo(packetItemStack, playerOwner) whenever you call setInventorySlotCOntents and some other methods in IInventory that are applying changes to inv. Note: You will even want to sendToAllAround to update other's player view. -
Let's say: - Server has 10 orders on given entity - Client has none (need to be updated) What happens in your code: Server: 1. You write int (entityID) 2. You write 10x ints (order Id's) Client: 1. You read 1st int (entityID) 2. Checking if orders aren't null (they most likely are, if you didn't init them) 3. You attempt to read as many int's fromreceived message as your client-side order list, which at that very momeny is EQUAL TO 0. 4. Nothing is read, because loop has (j = 0) < (size = 0). What you need: After writing entityID, write one more int - number of id's sent. Read that int and put it as j < size in reader. Overall note: If client has 5 orders and server has 10, client will receive 10 orders, no matter if you alredy have them on client. So most likely you will end up with duplicates. Fix: Send all Id's when one is changed and on client-side clear order list and set to received one OR send only lacking orders (harder, more efficient).
-
1.7.10: If you are referring to vanilla mobs, that is quite not possible. For custom mobs there is onSpawnWithEgg(). 1.8: onSpawnWithEgg doesn't exist anymore (I think) Overall - there is no event/variable for it. You COULD make request, I guess. ;p If only you could do ASM... (if you can, you simply edit onSpawnWithEgg(), but again - it won't be there on 1.8, so with ASM you could go even further and implement your own event in entity spawning code. Note: I might be aswell totally wrong writing this. (searched code and can't find shit).