-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
[1.7.10] changing button texture - solved but have questions
Ernio replied to Thornack's topic in Modder Support
public static ResourceLocation buttonTexture = new ResourceLocation("custommod:textures/gui/" + buttonTextureName); Check what static means - it is static for this class. Also, how do you even expect it to work? ResourceLocation is an object like any other. When you want to change it, you have to reinitialize it. public ResourceLocation buttonTexture; public CustomGuiButton(int id, int width, int height, String displayString, String textureName) { super(id, width, height, displayString); buttonTexture = new ResourceLocation("custommod:textures/gui/" + textureName); } If any. EDIT I accidentaly put "static" before ResourceLocation (copy/paste), don't do that, it will cause this resource to be shared between all buttons (this is what static does). -
[1.8] [SOLVED]Custom mob - how to use a RenderManager
Ernio replied to Brickfix's topic in Modder Support
Minecraft.getMinecraft().getRenderManager() It's a global manager that handles stuff, doesn't really matter. -
If you could provide code, it would be nice. As to stuff - there are several events that would allow you do thing you are doing. Problem is that Minecraft won't (not full clean). ServerConfigurationManager#recreatePlayerEntity - recreates EntityPlayer after death, there are also set all positions bed spawns, everything. Sadly - there are no hooks that are launched before server sends data packets about new EntityPlayer (look code). Your best shot is to go with: @SubscribeEvent public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { event.player.setPositionAndUpdate(100, 100, 100); // And use values from IEEP. } This event is launched from FML only on server, after reconstrucing and entity joining world - you are safe to use IEEP and any kind of new data. This is for respawn ofc., For normal spawning (joining) you can use bunch of other events: PlayerEvent.PlayerLoggedInEvent PlayerEvent.PlayerChangedDimensionEvent etc. Disclaimer - I might have totally missed the point of what are you doing. I was more or less basing on thread title. EDIT Btw. if you really would like to go hardcore - you can make "nice" trick with data-swapping. Bed-spawn position is accessible and changeable - the moment of player's death you can check if he should use your respawn system, if yes, copy position from your IEEP and swap bed-spawn loaction with it, that way the vanilla code will actually do everything on it's own, but using your swapped data. Then, again in PlayerRespawnEvent, you can swap data back to make it "normal". This will save you bunch of (internal) packets and fix the problem with loading unnecessary chunks.
-
In WorldTIckEvent you don't need any of that. This event is launched ONLY ON SERVER SIDE for EVERY world there is. event.world - will give you direct access. Edit: Just a note: "event is launched ONLY ON SERVER SIDE" might have changed lately, just make sure. (I don't know really, it might also work for client)
-
[1.7.10]Item disappears when removing it from slot. (SlotFurnace)
Ernio replied to dude22072's topic in Modder Support
That is obviously the problem. Gui's are client-side, server doesn't know about them. You will need to send packet from client to server on button click that will tell server to change your eq. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with -
Forge will never have good docs, but it's alredy well-documented in-code so I don't think it's needed. Why? Because it changes like - all the time and noone has time to follow this. Anything out of basics I linked you (which should get you out of noob-coding) can be found here (ask), on forums. This is also pretty useful: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html Have a nice coding.
-
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
Read my last post AGAIN, I literally gave you working code 3 times. Hover over red code and import your shit. Other way is to use key-combo (in Eclipse): ctrl+shift+o -
http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Best starter you will find if you know at least basics of object-coding (Java).
-
Okay, so basically - this code will crash on Dedicated server. You can't access Minecraft.class inside ANY server methods, including ticks. You are accesting MC.theWorld - this is single, one and only client-sided world (the one your client player is in). Server has x worlds. You need to pick one or use WorldTickEvent to launch tick for all worlds (every world ticks separately). Note: TickEvents have Phases - START and END! Pick one or code will run twice.
-
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
http://img-9gag-lol.9cache.com/photo/a9MYVrj_460sa_v1.gif[/img] -
[1.7.10] NBT persistent saving issue - adding additional player data
Ernio replied to Thornack's topic in Modder Support
From write code: properties.setTag("Slot "+ i, partyNbt); From load code: partyNbt = properties.getCompoundTag("Slot"+i); Notice SPACE (" ") -
[1.7.10]Item disappears when removing it from slot. (SlotFurnace)
Ernio replied to dude22072's topic in Modder Support
Where are you calling your changes? That is the key. -
You will need to implement your own IRecipe - search google or other mod's sources on how. EDIT I read 'shaped' recipes (I don't even know why, don't ask).
-
[1.7.10]Item disappears when removing it from slot. (SlotFurnace)
Ernio replied to dude22072's topic in Modder Support
You are chainging slot contents client-side. Make sure to do that on server, it's the server that holds data, client is only a vessel. -
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
Everything that involves rendering goes to Load (init), move your rendering code (from preInit) there. And god help me - fix this code with Snowball. RenderingRegistry.registerEntityRenderingHandler(EntityGreekFire.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), ModItems.GreekFire, Minecraft.getMinecraft().getRenderItem()); -
There is no way, that using ServerTickEvent, this is causing problems. Show your code.
-
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
I gave you code. new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), YourItem, Minecraft.getMinecraft().getRenderItem()) Why did you changed it? On this forum - always post your error log. What is the problem now? -
[1.7.10] NBT persistent saving issue - adding additional player data
Ernio replied to Thornack's topic in Modder Support
By fixing it, I THINK he ment that he followed my post and actually made it work on server side. Just a thought. Thornack, hint for you - NBT can be printed using Syso (System.out.println). Put Syso on start and end of write and read NBT. Basically - debug as long as you understand it (Draco's right). If you won't find it on your own - does your readNBT actually have some NBT (in Syso)? -
1. If your TileEntity's values are set only once you shouldn't create relation Entity-TileEntity, this is not a smart design. Correct me if I am wrong - what you want: You spawn cart into world, cart pulls values from some TileEntity (values are not changed), then based on those values you make movement - do those values EVER change? 2. Yes, I alredy told you 3 ways to send data (previous post). Here is long tut: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with 3. Sorry, it's IEntityAdditionalSpawnData, you implement it to Entity and write stuff straight into spawn packet. Spawn packet is one that is sent from server to client when server tells client to spawn entity that will be mirror of server's entity.
-
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
Could you learn Java? ... RenderSnowball(RenderManager p_i46137_1_, Item p_i46137_2_, RenderItem p_i46137_3_) new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), YourItem, Minecraft.getMinecraft().getRenderItem()) -
[1.7.10] Explosion needs to created in the server PLS HELP
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
Dude ;p -
Your problem is actually your lack of knowledge about java, cmon man - learn something, don't code blindly. As to problem: 1. Your enchantment can't be saved in bow instance, there is only one item instance per game so making boolean inside bow class will cause it to be shared between all bows. What you need to use is NBT in ItemStack. http://www.minecraftforge.net/wiki/Creating_NBT_for_items 2. When you shoot arrow you need to read enchantment value from bow's NBT and pass it into arrow entity. Pseudocode: ArrowEntity arrow = new arrow.... bla bla arrow.setMyEnch(getBooleanFromMyBowsNBT) // which will set it to true/false arrow.spawnEntityInWorld... 3. When you are extending some class, you don't need to copy everything what is inside, that's why there is inheritance (extends).
-
How could I not think of this Thanks m8, as always.
-
Network might have been bad naming here. Even if network would be the actual network, it wouldn't matter - integrated server won't even use what I am doing (it's being developed as dedicated server feature - server sends and makes client load classes, don't ask , and yes, it's secured). EDIT Basically - is there a way to make instance of class that is @SideOnly without reflection?
-
Yes, yes, I know this "if you don't know what are you doing, don't do it" and "you shouldn't use it" arguments. But I am simply experimenting with classLoaders. Common Proxy (when you launch server): public void initNetwork() { try { theNetwork = ServerNetwork.class.newInstance(); } catch (Exception e) { RoAMain.log.log(Level.FATAL, "Could not initialize server network! A lot of errors can be expected."); } } ClientProxy (for clients): @Override public void initNetwork() { theNetwork = new ClientNetwork(); } theNetwork is AbstractNetwork ServerNetwork extends AbstractNetwork is @SideOnly(Side.SERVER) ClientNetwork extends AbstractNetwork is @SideOnly(Side.CLIENT) Question is quite simple: Is what I done above (#newInstance()) only way of avoiding NoClassDefFound? Obviously when you use theNetwork = new ServerNetwork(); It will crash, and above is only thing I could think of. Reflection is evil in my case (above is not it, above is an example). Thanks. EDIT Oh and before someone asks - the @SideOnly is not used because I want it to be there, it is there because I want to simulate classes not being there in my dev env (because they are not there in real-life).