-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
VBA Programmer trying to get into modding for Forge
Ernio replied to Phicksur's topic in Modder Support
Basically the answer is "You can't change anthing in base classes of MC", but to extend that I will add: "You can only manipulate bytecode if you know how to ASM". You probably can't do that yet (as you've came from VBA), so for now stay with 1st answer. I alredy pointed out - what you are trying to do is just a goal, fist you have to learn how to use API. Forge is a layer over vanilla mc that hooks itself into several methods. You (and any other mod) can use those hooks - events to execute your own code when vanilla methods are called. For now - learn how to setup basic mod and how to subscribe to events. Next goal is to understand the TickEvent and create one that will check if 'time == day' every tick: What I want to do Every 10 ticks (so as not to be checked EVERY tick to reduce lag) Check time of day If Time of Day is between 13188 and 22810 do nothing else change time of day to 13188 And from there you can set it to set again to start of the day when night starts. Note: for this 'default light level = 7' - quite impossible without ASM (OR IS IT :OO ?!?!?) -
VBA Programmer trying to get into modding for Forge
Ernio replied to Phicksur's topic in Modder Support
Well, 1st thing after this basic stuff are events - http://www.minecraftforge.net/wiki/Event_Reference Using those you can probably archieve most of what you desire. About daytime checks - if you want it to act globally (not via block or command) you will probably want to use: cpw.mods.fml.common.gameevent.TickEvent Ofc. use server side one and check daytime every whetever ticks you want, note that checking daytime every tick (not every 10) is not that bad... it's all very cheap on resources. Other Tickers on the other hand shouldn't be abused - try to avoid using them, for player you can for example use PlayerEvent. -
You can't JUST do that. Base Attribute is a generic value for entity. When you assign it to entity all entities (in this case players) will have this attribute. If you want to edit whole base for all player instances you can do that, some method with "register" word or something, i don't remeber (idk if it will work because they are being registered in constructor). What you need to use is AttributeModifier, there are 3 operation there, you can make entity go faster, similar to potion effect (that's what potions use). And this will work per-player.
-
[1.7.10] Need help finding code responsible for updating screen.
Ernio replied to Ernio's topic in Modder Support
http://img-9gag-lol.9cache.com/photo/a9MYVrj_460sa_v1.gif[/img] This is me right now: http://img-9gag-ftw.9cache.com/photo/a1ZNggP_460sv_v1.mp4 Checked everything, for about 2 years was SURE as hell that init is called only once (after constructor) or when you recall it on your own, but NO! THANK YOU! (That also means that MC code is once again VERY (not) optimised... but what did I expect. Oh and why it didn't work for me: (in initGui()) if (this.myList == null) //init list So basically I did something MC doesn't. -
[1.7.10] Need help finding code responsible for updating screen.
Ernio replied to Ernio's topic in Modder Support
So anyone looked/will look into that? I was searching (also debugging) code with 2 other ppl alredy and we can't find anything inside those classes, there must be something working (influencing those values) from the outside or something VERY small that we missed it. -
Okay so we all know how ResourcePack GUI look like (yeah, this list). Now: If you would try to resize MC window the list-boxes will stay aligned to center and top/bottom. Since I am basing on code provided by Vanilla: GuiListExtended (extending it) I would like to know wth GuiResourcePackList updates it's alignment without calling ANYTHING inside drawScreen(). For whole code: I am using exact same practice based on provided interfaces. Exact parts: Note: To help me here you would actually have to look deeper in code (or know your shit better than me)
-
This is probably what you are looking for, BUT note that this will cause your world generation to go probably 2 times slower. @SubscribeEvent public void populateChunk(PopulateChunkEvent.Pre event) { Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ); for (ExtendedBlockStorage storage : chunk.getBlockStorageArray()) {} } Null checks and iteration through all blocks in chunk. Note: There is Pre and Post.
-
*Generally speaking - linux is simply better for almost any kind of server stuff. *Question is - are you talking about professional server of just "I am wondering if I can get 5% better results if I use Linux..." *If you are just looking to have some local server (up to dozen, maybe more ppl) there is not really any specific recommendation. *If you want so for eg. start server network - then yes, Linux has Apache, SSH, allows to make very useful tunnnels, is (I think) better when it comes to CMD and most importantly - everything for Linux is free, when for Windows you would soon find out that there is a lot of licensed stuff if you want to run good programs - but that ONLY if you are planning on doing professinal stuff (global). *As for more technical stuff - Linux uses less resources and runs faster in most cases (depends), because of it's quite clear structure. *Best? Either Debian or Ubuntu - that can ONLY depend on you and your skills/preferences. I was, am and probably will use Debian-Wheezy for all my dedics until I eventually stop working with server, thats because I've been using it for years. What are the differences? Debian compared to Ubuntu - faster and reliable (uncrashable, probably at all - years of dev, I never crashed Debian in like... 6 years), better support, more tutorials, less programms, but thye are still mostly shared between two, also it's less friendly to new users. *Does anyone run forge and a server on linux? 6 servers, in elder times about 15 ;p It's way better if you alredy have experience (in using its CMD), but if you are new - windows could be better with it's every-day-UI-screen (you can literally do stuff on shared screen - that is if it's not on your computer but dedic) *How does it work?? buggy at all? Best OS to maintain any larger than local server. Never buggy, always fast, no anomalies. *Yes, Linux is more secure if you know HOW to make it secure. All systems are still DDoS-able, but certainly Linux is harder to pawn with normal viruses and stuff (everything requires human-only input, so nothing you don't want can't really do anything to you)
-
Drawing is step-by-step procedure, it's literally like placing layer over layer - 1st one executed will be on bottom, second on top of it. Where and how are you calling this renderer?
-
Minecraft forge mod: Remove a block and place a new block
Ernio replied to halmi4's topic in Modder Support
If the item is custom (yours): Look at the ItemHoe#onItemUse(); You can literally copy that code and change stuff you need. Note: you will use different methods for left or rightclick. If item is vanilla: 1. Subscribe to PlayerInteractEvent, do needed checks (for nulls and item held) and do your stuff. OR 2. Subscribe to PlayerUseItemEvent and do same as above - note: there are sub-events there. Or find other events, there are probably few more that would allow it. -
I think there is more problem with: "I want to add a slot somewhere in the player's inventory" I'd like to hook into question author had in mind: How can one add slot to EXISTING container? Now I am cancelling normal container opening and opening my own instead - which loads both: slots from normal one and my slots from ExtendedProps. Is there other way of doing this? (forge-like - compatible with other mods)
-
I'm just gonna ask - were you (then) and are you now using normal server? (clean forge with just your mod, counting dev. env.) Judging from output 1st picture looks like cauldron which had support for colored console msgs.
-
He wants to deal damage over time (during hitting), not on start or break - that would be easy. And here is the problem - there are no (I belive so) events that support this kind of actions. From docs: The Minecraft#func_147121_ag() is responsible for sending updatePacket, sadly this is a one-time action, so there is no way to make something like you want. I've been trying to figure out some other way - If you can track start, you just need to track stop to know when to deal damage, but then again - there is no event (couldn't find) that tells you that the action has been halted - the PlayerInteractEvent is sent from client to server, and client doesn't get any feedback regarding what happens with certain action next. It's being handled by code that has no event hooks. This is probably possible (somehow), at this moment I am thinking of 2 tickers - one server side, one client side, both start with interactionEvent. Server side deals damage over ticks, problem is you will have to stop this ticker - that would require you to know when player stops hitting particular block. Idk if server knows if you stopped hitting, but client certainly does: PlayerControllerMP.isHittingBlock; It's private so you will have to unlock it with reflection. So the ticker on client side would be checking (client-side) if this field is still true, if not, it woudl send packet to server that player stopped hitting and therefore the server-side ticker could be stopped. This is literally ridiculus (might be buggy, would need some checks and is unsafe), but should work. HOPEFULLY there is other way around that i don't know #ForgeMastersAssemble (diesieben probably knows better answer- always does, I am just idea-dropper) P.S - As I am reading code, this idea (above) looks almost exacly like the thing mc itself is doing, notice: PlayerControllerMP#clickBlock() Edit: Again, digging deeper: (looks kinda useful, I am just pointing random stuff to help searching) /** * Processes the player initiating/stopping digging on a particular spot, as well as a player dropping items?. (0: * initiated, 1: reinitiated, 2? , 3-4 drop item (respectively without or with player control), 5: stopped; x,y,z, * side clicked on;) */ void processPlayerDigging(C07PacketPlayerDigging p_147345_1_);
-
[1.7.2] Custom Crafting Table Crash on Right-Click
Ernio replied to hodge247hd's topic in Modder Support
I'm just gonna ask - do you know the difference between Container and Gui? 1st of all - you don't have Gui or you didn't provided one (code). 2nd - Where is your GuiHandler? 3rd - Gui is for client, container is for server, GuiHandler is the thing that points out which one minecraft shoud use (container on server and gui on client). -
You could literally extend BlockCauldron and edit it a bit, as for milk - just make new fluid ;p Those tasks are quite easy, you could google some tuts on fluids, blocks and stuff. There is not much to be said if you don't write any question. (you literally didn't use ANY question mark).
-
Anyway, to sum up everything - as always, it just needed few hours of researches, testing and deciphering a lot of obfuscated fields. Solution: In my GuiCustom ex GuiScreen inside initGui() I am creating List which i then transfer to new GuiElementList ex GuiListExtended. Additionally there is need to make element implementing GuiListExtended.IGuiListEntry which will display objects inside your list inside GuiElementList that is being drawn by GuiCustom. All that will give nice effect showed in 1st post. Note: There is A LOT of unobfuscated stuff there, mostly positioning and sizes, takes a while to decode it all (partially possible by looking into GuiResourcePackList and it's child classes/displayers.
-
I doubt there are any dimension tutorials for 1.8 yet, but they are probably same as 1.7.10 (excluding new block and item registration - rendering). Just use google man - "Dimensions tutorial" 1st thing: https://github.com/Jimmy04Creeper http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571576-1-5-2-1-7-10-forge-dimension-tutorial-multi-biome Seems like fully working code ;p Yes you can write in java 1.8, but I DON'T recommend it. Some ppl are still running 1.6... (Take me: I really wanted to use new Java 8 Streaming but decided not to, for sake of those outdated...). Corrected by diesieben07. (Didn't know that ;O I was probably compiling in 1.7) Finally #EclipseMasterRace
-
Well yeah, it's not hard to just make any kind of list, what I have problem with is scrolling - anyone knows where I could find some implementation of scrolling that supports/uses GuiScreen so I could use it myself? I guess I could use: protected void mouseClickMove(int p_146273_1_, int p_146273_2_, int p_146273_3_, long p_146273_4_) {} to make whole thing on my own, but... "don't reinvent the wheel"
-
So I know that I can send reply, but what if I want to send few replies? Just wanna know if using PacketHandler.dispatcher.send... //to someone inside onMessage() of some of my message handler (receiver) is safe and won't cause some receive-packet lags (in case of huge code in onMessage())? Client ---(sends one packet to server)---> Server (reads) ---(inside onMessage() creates 5 different packets and sends them somewhere)---> Clients that should receive packets. Asking because, well - return message inside onMessage exists for some reason - but is it just wrapper (you have sender there and all stuff) that will simply send back message just like normal PacketHandler.dispatcher.send... or there is something more in that? To be even more clear - is there an actual difference in those codes: @Override public IMessage onMessage(...cut...) { //data is a NBTTag. Inside PacketReplyMessage it's being unpdacked analysed and send back to client. return new PacketReplyMessage((NBT)data); } and @Override public IMessage onMessage(...cut...) { //Shitload of getting and comparing from some string arrays, putting up data and then sending it in (String)data. //In previous example everything above happens inside new reply packet instead of here in onMessage(). PacketHandler.dispatcher.sendTo(new PacketReplyMessage((String)data), player); return null; }
-
Renderers should't be called on common proxy, never ever. It should look like this: (notice that i am refering to Item object registered by your mod, not a new one like you did in proxy) public class CommonProxy { public void registerRenderers(){} } public class ClientProxy extends CommonProxy { @Override public void registerRenderers(){ MinecraftForgeClient.registerItemRenderer(ModItems.ItemSoulJar, (IItemRenderer)new RenderSoulJar()); } } Is your renderer ever called? (I only took a glance on code, so if it still won't work I ll check it in eclipse)
-
How is a mod like JourneyMap able to load in multiplayer?
Ernio replied to roperson's topic in Modder Support
You can't without outside listenears. Simple as that. Server will not pass any data that it can't read (receive in packet). JourneyMap is probably using its own local host engine of some kind, you would have to code it yourself - google how to use LAN connection and http access. -
How is a mod like JourneyMap able to load in multiplayer?
Ernio replied to roperson's topic in Modder Support
Following diesieben: When on singleplayer you are really connected to integrated server running along with your client. It's the server that is responsible for sending messages so if you connect to dedicated one (you don't have integrated with your client) then mod that is only on your client and not on server will not send anything because it is only handled on server side. Clear enough? Following that - if you want to make a Client-Side mod you can ONLY (and only) use client-side methods and events. anything else will not work when connected to dedicated server. -
I don't know much about 1,8 but isn't BlockPos a wrapped (x,y,z)? From JavaDocs: BlockPos(double x, double y, double z)
-
So basically dedicated server loads whole game from very bulky config, puts that together into objects and loads textures (e.g 32x32 image for "warrior" class) then sends it to client that connects (once per session, on login). Note: By "loads whole game" I only mean my stuff far-related to normal MC (so no block and stuff that has to be initialized on mod startup). Till now I was doing it by simpy sending huge-ass packet cargo containing NBTTags and decoded it on client. Problem is that it may take some time (sometimes even few sec in which case it spams in terminal) Question: Is there a way to send data (that is not referenced to EntityPlayer) using packets? I mean before EntityPlayer constructing so basically somewhere near client-server handshake? OR Maybe it could be sent inside constructor (as if entityToBeConstructed == you), so in that case question - how would sending bunch of packets affect player constructing? Problem is - I want Client to be able to use loaded data right after you log in, so it must be done loading before "player logged in".
-
Dude! Could you please google SOME tutorial on basic modding? I have no idea what is crashing but by looking at your code I can tell you few bad things: 1. Fix your EventHandler names. You name method preInit() and use FMLInitializationEvent event You name method init() and use FMLPreInitializationEvent event Then again you call FMLInitializationEvent event with some load() Decide... 2. Fix your design - everything is everywhere it's not very readable. Fields 1st, methods after. 3. You are initializing new item: public static Item itemDarkGem = new Item(); And then re-initializing it: itemDarkGem = new Item().setCreativeTab(CreativeTabs.tabMaterials).setUnlocalizedName("itemgarkgem").setTextureName(mainClass.MODID + ":" + "dark_gem"); Fix it. 4. public static CreativeTabs tabBlocks = new CreativeTabs("Remastered Blocks"){ public Item getTabIconItem(){ return new Item(); } }; What in the world?! You can't just return new Item() and expect it to work, my guess is that is why game crashes on rendering (or not, didn't really looked and have no idea what else might be, because of your poor code design) Fix everything, or go see some tutorial It would be much simplier. P.S - to fix 4. - you need to return actual item from Items.class, example: return Items.apple;