Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Ernio

    .

    //block public static Block darkblock; // = what? //items public static Item darkgem; // = what? You need to init them: = new Item(...) or = new Block(...) Do you even java?
  2. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with Short: (simple) http://www.minecraftforge.net/forum/index.php/topic,20135.0.html How does one use this packet system? - Above. What can't be done without packets? - Anything that requires you to exhange data between client and server (not talking about stuff that is alredy handled by MC, like block updates and stuff), mostly when you press Key or Button and want server to do stuff with it (Keys and Buttons are only client so you have to send packet to server). Same goes for almost anything that is not generic minecraft - custom Entity Properties, special attributes, shared data, anything. Must one use this? - Yes if you want anything above basic "How to make block or Item" How does one create a basic/advanced packet hanlder? - Look 1st.
  3. *sighs* I found "something". GuiSelectStringEntries ex GuiListExtended ex GuiSlot Used in GuiSelectString ex GuiScreen Hopefully it is what i think it is ;o
  4. I am looking for some tools that would allow me do something like this: #MadSkillz What we have here are 3 scroll-lists that I want to pull elements from some List in my gui. Important thing - those elements are NOT buttons, whole thig is supposed to be a choosing (you click one, it highlights and if you would click another one, previous one turns off and new one highlights, ofc separately in each list - there are 3). Any help would be cool, I am currently "scanning" vanilla server list and had look at creative inventory. Also: anyone knows some example codes?
  5. 1. Provide code 2. Server has no rendering, Minecraft and many other classes. 3. You need to use proxy and Side.CLIENT or world.isRemote (depends)
  6. I don't think you will find much support for anything lower than 1.7.10 here. Edit: I just gave it second glance - you mean "beta" BETA? Like when 1st mods started coming out? In that case forget it, support for those is long lost. API is much worse, much harder (limited), it's basically unused game (MC was totally different game in those times). Please update to 1.7.10 or 1.8.
  7. Could you please tell what EXACLY this tracking will be used for (what you want to archieve)? There are few ways to do few things that come to my mind, you pointed out "Note 2" so i assume you want to store some data, but what exacly? Maybe you don't even need to track that stuff, but just use save methods present in ExtendedProps writeNBT(). I have literally no idea what else than saving you could do "right before entity is nulled" because everything that happens next is literally non-existent for this entity (you know... it doesn't exist). Some stuff could be easily done with simple tricks instead of making very generalized handling (wide-reach events).
  8. If you are looking for straight load into memory then EntityEvent.EntityConstructing This event should be used if you want to assign some extra values (ExtendedProps) to entity when it's loaded to game. Then the entity will join the world and you can use anything added in constructing event. EDIT: About "removing from memory" Inside Entity there is: /** * Will get destroyed next tick. */ public void setDead() { this.isDead = true; } /** * Checks whether target entity is alive. */ public boolean isEntityAlive() { return !this.isDead; } This is probably what you are looking for. You can check every tick (using events ofc.) if given isEntityAlive() and once it returns it's not you could run one last living-code, next tick poof, everything is removed (object is nulled). Note: Second part (removing) has never been tested personally, but LOOKS like it's what you want. Note 2: If you are trying to attempt any data-saving stuff before entity is removed, there are special events for this, just sayin.
  9. You have to make KeyHandler with subscription to Forge Tick Event (client side) and make KeyBinding. Look for KeyBinding tutorials. Alredy gave some example in other thread, link: http://www.minecraftforge.net/forum/index.php/topic,25751.msg131395.html#msg131395
  10. It's not like I can't deal with it, just wondering if the code is 100% not called somewhere where I don't want it to. So this part: instance.registerMessage(PacketOpenIntroductionGui.class, PacketOpenIntroductionGui.class, 100, Side.CLIENT); Specifically defines (concluded from documentation) that RECEIVER IS CLIENT. Why does this: public class PacketOpenIntroductionGui implements IMessage, IMessageHandler<PacketOpenIntroductionGui, IMessage> { ...whole this "needed" stuff. @Override public IMessage onMessage(PacketOpenIntroductionGui message, MessageContext ctx) { System.out.println("RECEIVED"); Minecraft.getMinecraft().displayGuiScreen(new GuiIntroduction()); return null; } } Crash when I run dedicated server pointing out NoClassDef? (There is no Minecraft on sever, i know that) Note: On dedic there is NO print "RECEIVED" so I assumed it's not called. What am I missing? EDIT: Turns out I can't deal with it: Side side = FMLCommonHandler.instance().getEffectiveSide(); if (side == Side.CLIENT) { System.out.println("INTRODUCTION"); Minecraft.getMinecraft().displayGuiScreen(new GuiIntroduction()); } Still gives me crash NoClassDef.
  11. Straight from documentation: * This event is fired on the {@link MinecraftForge#EVENT_BUS}. You have to have FMLEvents.class and ForgeEvents.class registered both with different BUSses.
  12. Did you register the event in event bus? MinecraftForge.EVENT_BUS.register(new EventClass()); or FMLCommonHandler.instance().bus().register(new EventClass()); Depending on which BUS handles the event you should use one somewhere in mod init(). EDIT: There is also similar server-side event. PlayerEvents.PlayerLoggedInEvent Keep in mind that this one is called ONLY on Side.Server, so in integrated on SP or Dedicated on MP, client won't know anything.
  13. Before I start coding it from scraps, is there anything inside vanilla/forge that would allow me to deactivate all player actions or at least part of them? Goal: When player joins game for the 1st time (or his data is corrupted) he receives packet that opens Gui (which cannot be closed until all tasks are finished). During this time I need player to be literally non-existent (can't be moved, attacked, pushed, fell, etc.).
  14. The book is probably or will be outdated soon, the idea of book for minecraft modding is plain useless due to tons of API updates (unless its a web-access book with updates). Have glance on this: http://www.minecraftforge.net/forum/index.php?topic=14048.0#post_update_forge You've probably set it up wrong.
  15. public class KeyHandler { public static KeyBinding pawnItem = new KeyBinding("Pawn Item", Keyboard.KEY_K, "key.categories.hud"); public KeyHandler() { ClientRegistry.registerKeyBinding(awnItem); } @SideOnly(Side.CLIENT) @SubscribeEvent public void playerTick(PlayerTickEvent event) { if (event.side == Side.SERVER) return; if (event.phase == Phase.START) { Minecraft mc = Minecraft.getMinecraft(); if (pawnItem.getIsKeyPressed()) { //send packet to server, on receiver side (server) you can get sender (player) and modify his inventory } } } }
  16. "You can create a keyhandler." And that is only the beginning... You will need your KeyBinding to sent Packet to server (Bindings are client-side). The server will have to operate with data sent, which is sender. You will have to pull inventory from sender (player) and set current slot to different item (current = in hand). player.inventory.currentItem; Remember to 1st check if slot is not null. To override slot simply use something like setInventorySlotContents() (Idk if it's exact name) Packet tutorials: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with Shorter: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html
  17. Well, only problem here would be handling dealing effect and rendering. Make item have look at rightclicking and use methods. (I've never used this one but looks promising: onUsingTick()) In your ItemStack you will have to store ammo (power) that would decrement with rightclick/using. Then you will need to use some GL and math (vectors and shit) to make a beam with limited range (that's just visual effect, client-side) And ofc. to apply your actual effect you will need to use raytracing (have look at MovingObjectPosition.class, server-side) Problem could be making limited range - don't make it too far, most of code for getting player's eyes direction are in vanilla so that should save time (you know, cross-hair?) If you would have any actual code that would be nice.
  18. Thats not quite what I had in mind. You see, as told in 1st post - there is .common package that handles everything related DIRECTLY to forge (just like any other forge mod), so packets, IEEP, GameRegistry are still on both sides. The case here is about further related code (quests, classes, lore). Goal is to make client.jar unable to work for dedicated server. So if the client connects to dedicated server it will receive data (from packets) and save it to its virtual storage and use it, but if you would just go to singleplayer then the client will only use some static values, a "demo gameplay". On the server.jar there will be config-loader, that can load custom stuff that will be later sent to connected clients. EDIT: (I was wrong about java imports crashing after class removal) Oh. My. God... I mixed up two different languages... nevermind, it can be done *.*
  19. The lords calling (request for "code safety" - you know, so the client can't make server using his client.jar). I personally don't care.
  20. Goal is simple: I want to have non-universal mod (client and server has other jars but they are one mod). Purpose: Private server request I haven't done much research yet so any info on doing it simply would be nice. Main questions are: To connect to server you need to have mods required - how does Forge compare them, can names or versions be different (there will be more server-side updates than client ones, thus versions will differ)? Good thing would be nice workspace - the goal here is to have: mypackage.server //Everything that loads custom configurations (where classes or quests are created) mypackage.client //Data storage for data received from server IF playing on server, if NOT then some basic "demo" stuff (client won't have its own configuration to create e.g. quests which are on servers config side) mypackage.common //all the common files, block registration and basic forge stuff that is shared Basically after obfuscation I'd just need to remove either client or server package and .jar is ready. To go with said above - I need to have 2 @Mod annotations, one in .server one in .client and when launched inside eclipse: If launching client - start ONLY @Mod from .client and other way around with server - is there some tool for writing this-kind-of-sided-mods? P.S - I know about proxies (and I could do it all in one @Mod and then do shitload of Side-checks), but I want something even before that, the moment of adding mod to container. If not, well, prixy it is.
  21. Nah, am cool with diesieben answer, simply discovered that I can use "." for server.
  22. For client we have: Minecraft.getMinecraft().mcDataDir; Where is same stuff for server or some universal directory if exists?
  23. Are we talking per dimension effect (your new dimension) or overall? In any case (with some changes) I'd use: public void populateChunk(PopulateChunkEvent.Pre event) { Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ); for (ExtendedBlockStorage storage : chunk.getBlockStorageArray()) //then you scan 16x16x16 areas make if block is stone then change it to my block This is NOT very optimal, but since population happens only once... well, screw that. You could go with ASM for better performance, but that would get you shitty, unclear code.
  24. So in 1.7.10 I did this while registering some item in method that had IIcon reference in it. I simply put x number of IIcons into HashMap and then pulled them from there by name. How can I have something like it in 1.8 (there are no IIcon methods that can be overriden). Goal: My Items textures are pulled from NBT, let's take longsword: blade: "name" guard: "name" grip: "name" Normally those would be from my HashMap, now - I need ideas.
  25. You will certainly have to use some storage type - either choose NBT per ItemStack (state of knife) or IExtendedEntityProps and hold boolean value for rotation. IEEP will be better ofc. (one per player). Then in your renderer you will have to operate on literally basic java/GL. Make If for your rotation boolean and then just try using: GL11.glRotatef(0.0F, 0.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, 0.0F); Translatef moves center of item by some value (in item I think center is some corner, idk). Rotatef - obviously rotates. I am too lazy to come up with right values so hit: Launch MC in debug mode get you item to hand and start having fun with those 2 lines.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.