-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
1. Please update to 1.7.10+, 1.6.x is almost ancient. (PlayerAPI is updated) 2. On PlayerAPI main forum thread there is literally everything you need to hook you mod into it. 3. If there is no error log, I can only ask for full source (gitHub). 4. You are probably registering it wrong. Read "Step by Step" http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1277996-1-8-api-player-api
-
World.createExplosion(Entity, posX, posY, posZ, power, someBoolean); Basically what this does is spawn an explosion: Entity = exploder (will not get damaged, he's the "owner" of explosion) X/Y/Z - coords power - size of explosion in meters (blocks) someBoolean - irrelevant for you. What you are doing is declaring player who destroyed block as owner world.getClosestPlayer(x, y, z, meta), therefore he won't be damaged (actually if you would go deeper in code there is some system that gets capabilities like explosionResistance and stuff, I have no idea how it works as for now). I suggest trying to put null into Entity field - methods seems like it allows exploder to be null (has null-checks).
-
Since this is client-only I assume you want to display something (as you told few posts before). What exacly do you want to do with what data that should be in your customHook? EntityFishHook is an Entity, that means you can use IExtendedEntityProperties to store additional info. To render ANY kind of stuff that would be inside either EntityFishHook or IEEP you can use RenderWorldLastEvent to find hook in world and even render labels with info above it. You can also use RenderGameOverlayEvent to add custom info on your game screen when fishEntity field in player is not null. Possibilities = endless. Also - yes, this can be done for client-only, as long as you won't be keeping any data that should be shared with server. Now what exacly is that you want?
-
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
If by Custom NPC you mean EntityPlayer then yeah, that's what I'll do. "Im pretty sure the mod Sync uses this aswell" Love you, checking out Repo right now I'll just experiment a bit and post solutions/questions later Thanks all. -
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
@diesieben07 "You won't get around making a new entity most likely. In that entity..." So either I missunderstood or you ment "will" not "won't", doesn't matter - I'll probably get around faking player anyway. @delpi Problem here is not with loading/saving even not copying data and keeping it. Main thing I am worried is one you didn't place in you post - how to fake EntityPlayer. Ofc thanks for your post Spawning an EntityPlayer and putting data from EntityPlayer (clonning) that logged out brought me questions about how it will be handled by game. EntityPlayer is quite an unique object (one per session) which left me with questions about what happens to stuff like playerUUIDs (which is held not-in EntityPlayer) or playerIP. In the end I'll probably just get it done like in "idea 2." and see what happens. If I can't save that data I'll probably use some caching that will be read on rejoin like diesieben suggested. Any further knowledge ofc always appreciated. -
[1.7.10+][SOLVED-Using tracker] Player view-distance for Entities.
Ernio replied to Ernio's topic in Modder Support
As always, diesieben to the rescue! Nice to learn this stuff exists. Thread marked SOLVED. Thanks. -
[1.7.10+][SOLVED-Using tracker] Player view-distance for Entities.
Ernio replied to Ernio's topic in Modder Support
I tried, but: Packet != IMessage :C public void func_151247_a(Entity p_151247_1_, Packet p_151247_2_) public void func_151248_b(Entity p_151248_1_, Packet p_151248_2_) And they seem like they are literally doing same stuff (iterating). Unless I will start extending Packet for that ;p -
[1.7.10+][SOLVED-Using tracker] Player view-distance for Entities.
Ernio replied to Ernio's topic in Modder Support
Thanks, that probably just saved me from literally writing my own tracker. //Server-side public void onAttributeModified(AttributeKeys key, AttributeSources source) // this.player is player owning attribute { EntityTracker entitytracker = ((WorldServer)this.player.worldObj).getEntityTracker(); for (EntityPlayer p : entitytracker.getTrackingPlayers(this.player)) { PacketDispatcher.sendTo(new PacketUpdateAttribute(this.getAttribute(key, source)), p); } } So this is how I do it? (can't even launch MC now because of tons of other errors - WIP stuff) Also: Is the player being tracked also in tracking set? (you know logically - client tracks its entityPlayer) Again - thanks Thread is most-likely resolved -
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
That's Client-side, I need server-side solution. You can close game without pressing "Quit Game" button. If you do that client will never send disconnect info, therefore player will still be logged on server and server will throw UnexpectedConnection error and kick player after short while. But that's not what I want. I need player to presist as long as I need him too (not too long ofc, few, maybe dozen of seconds). To post above - he posed to right topic (i mean, hopefully), just from different point of view (client). -
What's the range player sees Entities? (other PlayerEntity most important) Is it same for all? Is it constraint? Server has "view-distance=10" to max 15, this is only for world-sending or also Entities? If for Both - how do I get that range? (probably somewhere in MinecraftServer). When player logs in, other clients generate their EntityPlayer (I belive so), do they know (client-side) other player coordinates when thay are NOT in view range? Looking on my own (it's pain in the ass to test it with 2 clients, running around on server map checking Syso), might aswell get some of answers faster here. Thanks Reason: Sending packet to all around. (should be in visible-range)
-
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
Damn, I felt like I am kinda of charging here after re-reading, but that wasn't my intention. Sry to offended. Anyway, any further help still appreciated. -
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
Dude, there is NO "better" way to do this. I need EntityPlayer to be IN WORLD and be treaten like you never logged out (killable, movable) after session is ended. That is literally what it means to have "ani-logout system", you can't run from combat, can't logout if threatened, can't logout with poison on you (to escape some player that want to loot you). I'd like straight from-experience answers to this thread, or idea other than mine, or why mine wouldn't work. Thanks for help -
[1.7.10+] Keeping player (or his clone) after he logs out.
Ernio replied to Ernio's topic in Modder Support
Read again, you will know, literally 1st sentence. Anyone has something? -
Basically ani-logout system. I want that if ExtendedPlayer.get(player).canLogOut() is false, player will be locked for let's say 10sec after he disconnects. I mean: client can disconnect in any way - exiting game or closing it, but server will spawn some fake player and keep it for 10sec. Critical points: I have 3 ideas: 1. - How to not-remove EntityPlayer from entity list? - If i could do this, whole problem becomes very easy to resolve. 2. (If I can't keep real player, like in 1.) - Should I spawn new EntityPlayer and clone() data from old one via PlayerLoggedOutEvent and operate on new entity. - In this case - since they are clons, will this give me ability to edit "real" player's .dat file? (I mean, when I remove new clonned EntityPlayer, will it call saveNBT() like "real" one would - keeping the player/session UUID)? - If I remove clonned EntityPlayer - will it call PlayerLoggedOutEvent and make finite loop (until player#canLogOut()), OR PlayerLoggedOutEvent is only called on disconnect? 3. Use some kind of Abstract/Fake Player, I heard Forge has some class with this name, I have no idea what's the use of it. Okay so, please post you knowledge/ideas/critical-points. Thanks all
-
Idk why you are trying to simulate breaking block by using onBlockActivated, but that's not my concern. Yeah, in theory (even practice) that should work. Remember to always check if slot in not null before you try to get item from it. Also use instanceof instead of "==". (Unless you want a direct to-class comprasion). Finally - to break block you can setBlock to air (depending on which version you use 1.7 or 1.8 methods are different) or simulate BlockBreak by simply telling block to insta-break. In any case - to drop items you should use: BlockFurnace#breakBlock(), code starting with EntityItem entityitem = new EntityItem....
-
Because I have almost no idea what you want to archieve I'll just ask: 1. "If I took a block" Vanilla or custom? 2. "onBlockActivated method" Should it be block activation, break or right-click? 3. "check the tool that click the block" Again - which click? Left, right? Only click or break? 4 "drop the block" Well, dropping need breaking, so are you activating block, breaking it or clicking? 5. "block requires a special tool" How can block "require" special tool? Then again - speacial tool to break it, or to activate it? Last, but not least - are you high? http://i.memeful.com/media/post/1d4BJDM_700wa_0.gif[/img] You are probably looking for BlockBreakEvent or PlayerInteractEvent (or something like it) for Vanilla, and for custom, probably: on BlockDestroyedByPlayer maybe. Anyway - events mentioned 1st can be cancelled to no break block, or you can modify their loot to loot other stuff depending on tool used.
-
SOLVED - Quick Question - 1.8 - saving client side data
Ernio replied to BioAndy's topic in Modder Support
I'd say big NOPE to NBT here. First of all - NBT is a compression tool designed to save "data" not configuration, ESPECIALLY not Client configs (World saving, player saving, it's all server-side). If you are planning on doing this all on Client I'd suggest using Forge Configuration. It's not just for blocks and items as you read. You can have there pretty much everything. Calling "save" can be done pretty much everywhere. Just keep in mind that is Client config - you should load it from client proxy, what use would it be on server. ;p Anyway, if you would use e.g GuiScreen you will probably want to call config.save() from ActionPerformed (just don't do it per-render, that would be as much as your FPS) of some kind, that I'll leave to you. Here's example of not-block-or-item config: public class ConfigGeneral { public static Configuration config; public static void init(File file) { config = new Configuration(file, true); try { config.load(); config.setCategoryComment("General", ServerReference.GENERAL_CONFIG_COMMENT); Registry.setPointsPerLevel(config.get("General", "PointsPerLevel", 10).getInt()); for (String attribute : config.get("General", "BaseAttributes", new String[] {"B10.0", "A10.0", "I10.0", "V10.0", "T10.0"}, "Shared player basic attributes.").getStringList()) { Registry.appendBaseAttribute(Attribute.decode(attribute)); } } catch (Exception e) { Main.log.log(Level.ERROR, "Could not properly load General config file!"); } finally { if (config.hasChanged()) config.save(); } } } This one is actually server-side, loads some values which are then used in construction of player or leveling. Whole Configuration is pretty well documented. Second idea would to totally leave forge for a while and use custom system, or as suggested NBT, but on client side. Your choice. -
MaxStackSize will always be honoured. It is set inside Item instance and you can't do much to just change it (only for custom items). If you set stackSize of itemStack to above MaxStackSize it will be auto-corrected and lowered to max. I've been doing similar thing some time ago, I didn't really used stackSize. What I did was create arrays in TE - one list of ItemStacks (stackSize = 1), other sizeOfStack, and 3rd is a ItemStackBackup. Then I've overriden every method that uses ItemStack (merge, drop, everything) to use sizeOfStack for given slot instead of normal stackSize. Worked pretty well. You'd have to ofc add custom renderer to client Gui (which is easy - read size and render string) There might be some new methods to archieve this since i was coding it before 1.6 Edit: If you haven't gotten the idea - that also solves problem of drag-and-drop with mouse / anything else. Since it is TE you can always restore previous state of ItemStack (using ItemStackBackup) when you drag ItemStack it will be set to null in normal ItemStack array, but you always have backup array and size of stack saved separately, you can re-set it in onUpdate().
-
http://nooooooooooooooo.com/ I don't know what I expected.
-
Simple question: Is there some tool that allows you to render smaller (scaled) letters (with fontRenderer ofc)? Yes, I know I can do it with GL but then width and height values are also changed and i have to scale literally every value. No/Yes(where?) Thanks.
-
onUpdate() is an inside method for Entities, Tiles and Items. What you are looking for is a PlayerTickEvent or more globally TickEvent (Server and/or Client). Look them up and learn how to use events. (google) In your case is will be Client side PlayerTickEvent that will check for KeyBinding.isPressed(). Remember bindings are CLIENT ONLY, you will need packets to interact with any kind of server side data.
-
That is exacly what onUpdate() is for. You override it in your sub-class put whatever relevant code you want (that will launch every tick) and ofc call super.onUpdate() to execute normal Entity lifespan-actions. Maybe you mistaken it with something else (item methods? maybe events?). What are you trying to do?
-
That's why i wrote "Also - use Syso to check if your code is even called.", but since you asked me directly I feel obliged to answer:
-
I am almost 100% sure your code (armour - break) is run on CLIENT. Anything that edits anything (entities, inventory, itemStacks) should be done always on SERVER. You can use world.isRemote to check sides. Also - use Syso to check if your code is even called.
-
[SOLVED][1.7.10] Detect if event.entity is mc.thePlayer?
Ernio replied to Ernio's topic in Modder Support
Well, I was testing different ways of doing it: PlayerLoggedInEvent is ONLY called server side and ONLY when player enstablishes connection, never after Clonning (respawn). EntityJoinWorldEvent will basically do same damn thing, maybe more "safe" since it's not in constructor. Note that (i pointed it out in thread linked in my last post) this is how things happen: [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityConstructing:33]: CONSTRUCTING [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onPlayerClonning:42]: COPYING [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:11] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityConstructing:33]: CONSTRUCTING [20:01:11] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED If I am sending request packet from client to server it doesnt really matter if i use constructing or joined event - server-side has alredy constructed and has stable EntityPlayer object and will receive that packet. As to safety - request packet happens (see code in last post) after player gets his IEEP, so the response packet from server will not cause null pointer in any way. For convinience I guess i could use Joined, I just used Constructing because that saves me subscribing to Joined and again checking if eneity is Player and stuff (2 times same shit). You gotta do, what you gotta do (tricks and stuff), some things just don't want to work like I want I was even considering kicking player after death... and just use PlayerLoggedInEvent, but nah... that's it the easy way. Thanks all, I think the thread is solved (until my entire code will stop working and crash shit out of me) lel.