-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
@thebest108 - bro, you know you should not use thousands of entities just to make one entity have multiple hitBoxes. From your previous posts I can tell this goes under bad design. You have entites assigned to one entity and you make server not even update those sub-entities, that is literally missing the point of making entities. Making multipart entity is not that hard Why you choose such workaround?
-
[1.7.10] How to get list of connected players in a LAN world?
Ernio replied to Geforce's topic in Modder Support
Right now I can't tell exacly (not in IDE), but: In LAN - one player is holding Server thread, rest of them have only client thread. Client thread can't access server directly (MinecraftServer) and doesn't always know about all EntityPlayers (knows only about ones the server send to him). To obtain loaded Player on client you go with world.playerList (or something like it) - from Minecraft.getMinecraft.theWorld. When player is not visible for given client you can ONLY retrieve his game profile (example of vanilla usage of this feature is PLAYER_LIST in GuiIngame which displayes all online players). Look in GuiIngameForge#renderPlayerList (not sure of name). Should be helpful. -
[1.8] [Solved] Translate and scale a BakedQuad
Ernio replied to SnowyEgret's topic in Modder Support
Was looking for same thing - ended up operating on vertexes. Here just to say - there is nothing bad in it. Just note - getGeneralQuads() in your model is a mutable list of quads. You need to generate new Quads based on old ones and cache them in smart way (if possible). There might be better solutoin tho. -
How to prevent server from sending entity position packets to client
Ernio replied to thebest108's topic in Modder Support
Look at: EntityRegistry.registerModEntity(...) You can set update freq to very high. You might also want to look into PlayerEvent.StartTracking - might help somehow, but doubt it. EDIT Other than that - EntityTracker is the thing that handles tracking if given player needs to get entity's data. You can alter it with asm (might be possible wiht reflection - replace object). -
Reflection used in minecraft modding orbits around basics and obfuscation helper. For basics - look into java docs, rly - 1st link on google probably. For rest - ObfuscationReflectionHelper.class Used to make reflection work with de- and compiler mods.
-
How to prevent server from sending entity position packets to client
Ernio replied to thebest108's topic in Modder Support
What does entity actually do? It is impossible that is can in any way "handle itself" - The rule says: "Client always lies!" - you can't expect for few clients to be handling their own entities without server. Only one option is that the entities in question are PARTICLES, and particles and CLIENT SIDE - and yes - you spawn them on client, they can handle themselves and don't need server. -
Whaaaaaat. Skins for players can be accessed via AbstractClientPlayer. If you look deep enough you can find skin cache that is being filled with skins from mojang's skin base. You can alter rendering skins on at least 2 levels - either by replacing cached skins for given player with your own (which you would download on your own) or on more "shallow" level - by replacing player renderer and providing your own skins from outside skin cache. Both are hard enough (1st one will require at least reflection) to be considered advanced modding, so without java skills - don't even try, bruh (do something simpler).
-
Forge Minecraft- Single World- Exception ticking world error.
Ernio replied to NewbieMCGirl's topic in Support & Bug Reports
Yes, indeed - after you track down erroring mod (try to replicate error by playing with only one mod to be sure it's the one) report this to author. He hopefully should know where to look for his mistake. -
http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and 2nd post.
-
Is there a good mod replacement for LogBlock in Forge for 1.8
Ernio replied to needoriginalname's topic in General Discussion
Seriously bro, 1st page in google: "block logger for forge" Probably your best shot: http://forgeessentials.com/ Something else: http://www.curse.com/mc-mods/minecraft/forgeservertools Looking at it - ForgeEssentials looks much better. (And before you ask - yes, there is 1.8 version of it). -
[1.8] Receiving weird packet when joining LAN world
Ernio replied to Bedrock_Miner's topic in Modder Support
Sorry, but I have literally no idea what's up with this "-97". As to whole system, you are doing a lot of stuff bad and oldschool (outdated). The design itself if so far from common ones that it is almost a blind search, but 1st things 1st: 1. You made hella lot wrapping around your packets, yet you didn't do simplest thing: You can hold: private byte nextPacketId; In your PacketHandler class and in registerMessage do this.nextPacketId++; Make internals be internal. ------------------------------------------- 2. I alredy mentioned that Message and Handler should be separated into 2 classes or class + nested handler. Why? Because directly from doing stuff like you just did you will get errors that are IMPOSSIBLE to track without previous knowledge. Lets take this example: public class Test implements IMessage, IMessageHandler<Test, IMessage> { public Test() {System.out.println("CONS: " + this);} @Override public IMessage onMessage(Test message, MessageContext ctx) { System.out.println("THIS: " + this); System.out.println("MSG: " + message); return null; } @Override public void fromBytes(ByteBuf buf) {System.out.println("READ: " + this);} @Override public void toBytes(ByteBuf buf) {System.out.println("SEND: " + this);} } And register it as something like this: registerMessage(Test.class, Test.class, Side.CLIENT) // packet, handler, side We will be sending packet from server. This is the output: [server thread/INFO] [.network.Test:<init>:13]: CONS: .network.Test@197fd644 [server thread/INFO] [.network.Test:toBytes:29]: SEND: .network.Test@197fd644 [Netty Local Client IO #0/INFO] [.network.Test:<init>:13]: CONS: .network.Test@6dca2193 [Netty Local Client IO #0/INFO] [.network.Test:fromBytes:25]: READ: .network.Test@6dca2193 [Netty Local Client IO #0/INFO] [.network.Test:onMessage:18]: THIS: .network.Test@4546c234 [Netty Local Client IO #0/INFO] [.network.Test:onMessage:19]: MSG:.network.Test@6dca2193 BOOOOOOOM If you look closely - your data received is TOTALLY false (null?). So yeah... Drop your design, bro. Edit (if you don't see it): * "THIS: .network.Test@4546c234" is a handler that receives message, but handler != packetReceived so you cannot use this.field directly inside it, as you are doing in your handlers. Ah, missed that one "message.handle..." ---------------------------------------------------- Anway, here comes 3rd thing!!! 3. http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html Notice (in point 2) thread prints - yeah, you should NEVER have Netty thread doing stuff for Minecraft, NEVER EVER. I strongly suggest rewriting your system, good one (but can be better): http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with I am wondering how the hell it works for you without losing packets over thread-unsafety and all that stuff you are doing (Disclaimer: Maybe I missed something). -
[1.8] Receiving weird packet when joining LAN world
Ernio replied to Bedrock_Miner's topic in Modder Support
1. Need more code (packet example, registration of packets, idk, events maybe, login etc.) My 1st though was bad int->byte casting, but you say it works for server, so nope. 2. My humble criticism: Ofc. that is a humble opinion, so don't mind me. Trying to find something that might help, but for now, feed us with more code, error might somwehere else. -
Actually, from what I remember - it is the client that tracks hits, isn't it? Two different clients might be in "slight" different delay which would create situation where both of clients might relatively hit different x/y/z place in dimension, but still hit the same target - since it's their client that handles tracking if thing was hit. The server only decides if such action was possible (distance). I mean, unless I got that wrong, I've been looking there just a tiny bit for now. Also - that is the reason why hacks can easily make kill aura and server usually have plugins (ani-cheats) with additional attack packet checking such as player rotation (you can only hit what's before you) and attack mini-cooldown. For throwables (arrows) it is not client's concern, arrows travel/damage on server (I think). What is actually critical here is the fact that for lagged players it will be just annoying (sometimes impossible) to keep targeting e.g neck or knee. Just note: As stated before - it is not FACT, but code observation. Not 100% sure, but pretty much.
-
Actually, it is very much possible to have multiple hitBoxes assigned to one entity. It is just very damn long job to make it look nice (abstraction). BUT, for modders that are not super experienced or don't have time to do this on their own - there is API: LLibrary which (supposedly) allows to have entities with multi-boxes Idk if its updated to 1.8 tho. Might be worth checking (I personally had enough time to make my own system, so don't ask me).
-
registerMessage of SimpleNetworkWrapper is designed for IMessages. You are not supposed to use 250th packet (which I am assuming you do, from you post) - it's old vanilla technique http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with http://www.minecraftforge.net/forum/index.php/topic,20135.0.html
-
properties.getInteger("Research"); VVV properties.setInteger("Research", this.researchState);
-
IBakedModel is a combination of BakedQuads which can be obtained using getGeneralQuads(). You can collect (from model registry) any number of IBakedModels and get their general quads and then inside your smart model - return them all in one list (list returned by getGeneralQuads()). Note that you should not manipulate list directly as it is mutable! You need to make new list and addAll from all other IBakedModel you want. To actually get IBakedModel instances into getGeneralQuads() method you can use handleItemState() in which you will read Stack's NBT and retrieve, for example via names, models from model registry and put them in some local field which you can later use in getGeneralQuads(). ModelManager modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(); ModelResourceLocation resource = new ModelResourceLocation(InitUtil.ModID + ":some_resource, "inventory"); IBakedModel ibm = modelManager.getModel(resource); Note that for ModelManager to actually return an IBakedModel - it needs to be there, read: It need to be "baked" 1st. For model to be baked and put in registry you can simply make some item register variants with different textures - for each variant vanilla will generate model which can be later obtained. I don't remember how to bake model on your own - I recommend looking into model bakery (look into places where json is read and bakes models). I remmeber that you might wanna use ModelBakeEvent to add your own stuff to be baked.
-
For per-item effect - indeed - store coolown in NBT and decrement it every tick. Only problem with this design that cooldown will pass only when item is in player's inventory (and maybe some other situation). If per-player - use IEED to store cooldown for item. + of this design is that cooldown is for all items of same type for given player and is always passing (even if you don't have item). It also removes NBT usage and overally is better in most cases. For wands (skills/spells) I recommend IEEP, depends on design really.
-
@delpi Damn, it is hard to even read your code. It seems like you have some leftover bad habits from Bukkit coding, also there are (at least) 3 mistakes: 1. Tracking events are server side ONLY - you don't need additional checks. 2. Either I don't understand your design, or it is bad: * You should NOT manipulate NBT of IEEP on your own. * IEEP can hold fields and fields > NBT (yes I know NBT is a field, you know what I ment) 3. You should NEVER every store Entities in your own list - let World/ForgeEvents take care of everything. EDIT Delpi, bruh - you edited post (pasted wrong class before, my comments are regarding that one). This one:
-
[1.8] Craft a certain item with any sword/pickaxe/etc
Ernio replied to SuperSaltyGamer's topic in Modder Support
Can you post the stacktrace so we can see what line is causing the NullPointerException? I'm going to assume however that this line is going to cause problems: for (int i = 0; i < 8; i++) { if (inv.getStackInSlot(i).getUnlocalizedName().contains("sword")) { ... } } inv.getStackInSlot(i) may return null there, and then you're calling null.getUnlocalizedName(). This may be causing your exception. you should add another null check there. Lemme just add that this is NOT how you check for items. for (ItemStack stack : stacks) { if (stack != null) { Item item = stack.getItem() if (item instanceof ItemSword) { } //OR if (item == Items.apple) { } } } -
http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html If you implement this, it MUST work. StartTracking is fired when server's EntityPlayer starts being in range to other entity. It will get called server side and if you ensure thread safety it WILL be handled on client after spawn packet is sent (spawn packet will arrive 1st, then yours will update additional data). If it doesn't - post full code (packets/handlers/event and any other utils) - in new thread.
-
Add: acceptableRemoteVersions = "*" In @Mod annotation.
-
If u wnt cll me Skype: ernio333 My kb dn wrk.
-
[PLEASE HELP] Masive Packet Handling Problems[1.8]
Ernio replied to ItsAMysteriousYT's topic in Modder Support
Read again. He didn't say it can't have 2 constructors. Empty one is for internals.