
Kwibble
Forge Modder-
Posts
340 -
Joined
-
Last visited
Everything posted by Kwibble
-
[1.6.4] Tile Entity NBT not saving on exit
Kwibble replied to TheMoleTractor's topic in Modder Support
It all depends on how you make those calls really. And where from. But the main reason TheMoleTractor needs a packet is because he is calling methods from client only: A renderer. Whereas you are interacting with an item, which exists both client and server side. Is the difference a little clearer now? -
[1.6.4] Tile Entity NBT not saving on exit
Kwibble replied to TheMoleTractor's topic in Modder Support
Check out the two good SimpleNetworkWrapper tutorials in the tutorials section of Modder Support. That's where I learnt packet handling for 1.7.2 -
[1.6.4] Tile Entity NBT not saving on exit
Kwibble replied to TheMoleTractor's topic in Modder Support
MoxEmerald, have you heard of this thing called clue t and this thing called server? No? Okay. That explains everything. As I was saying before, this is a client/server syncing issue. You need to sync the servers data to the client via a packet (tile entities have built in packet stuff, but i have no clue how that works. I suggest making your own packet). So MoxEmerald, please, learn. And always remember that data will ALWAYS need to be synced between the client and server. Or else you get these problems. -
Well its all good then. They way you said it made it sound as if it was a static method.
-
Okay, first thins first. NONE OF YOUR INITLIAZATION EVENTS (PRE, POST, OR OTHERWISE) SHOULD BE STATIC. Now that that is taken care of... Always register your blocks/items in the PRE initialization event, unless they are reliant on another mods items/blocks. @OP I also forgot to mention, you don't need a constructor in your mod class. At all. Forge "constructs" your class via the initialization methods, so a constructor is not needed (at least to my knowledge).
-
Here is an example modfile: package com.kwibble.mod; // imports. I can't remember what they are @Mod(modid = "dummymod", name = "Dummy Mod", version = "1.0.0") public class ModDummy { @Mod.Instance("dummymod") public static ModDummy instance; public static Block dummy_block; @EventHandler public void preInit(FMLPreInitializationEvent event) { dummy_block = ( new BlockDummy()).setCreativeTab(CreativeTabs.tabBlock); } } Here is BlockDummy: package com.kwibble.mod.block; // imports public class BlockDummy extends Block { public BlockDummy() { this.setBlockName("dummy_block"); this.setTextureName("dummy_block"); // Other stuff you/need to make this block. Or you could chain them when you instantiate the dummy_block variable GameRegistry.registerBlock(this, "block_dummy_block"); } // Other block stuff if you want it } This is basically the setup that I use (aside from the bad coding practise shown in that example... Bad Kwibble) and it works perfectly fine for me.
-
NBT can be used to store an entire class worth of information. I can say that because in a mod I am working on some of my Entities are pretty much pure NBT tags... Its all about how you are trying to store the information. NBT supports all the primitive type data (at least, it should) so you can save everything you need. What you will want to do, is create a NBTTagList that is filled with NBTTagCompounds. Each NBTTagCompound will represent whatever you want. Then, you just attach all the variables of the class you need saved. So for example, my entities need their health, owner, maxHealth, position, and more. These are just stored using nbtTagCompoundInstance.set***("identifier", variable); Where *** is the variable type you want to save, identifier is the string you use to identify that saved variable, and variable is the variable you want to save. Did that make sense at all?
-
First things first: You should be checking things on the server, not the client.All the client is supposed to do is send user input, and receive what the client should do based on said user input. So I push a the spacebar: Client is told that the spacebar has been pushed, and then notifies the server. The server then checks to see what is supposed to happen when the spacebar is pushed. The character is supposed to jump so the server checks to see if the character can jump. It can. The server then makes the character jump and tells the client that the character has jumped. The client then makes the character jump visually.
-
[1.6.4] Tile Entity NBT not saving on exit
Kwibble replied to TheMoleTractor's topic in Modder Support
You may have to sync your NBT data between the client and the server... That is pretty much all I got. To test this theory, in the block's onBlockActivated method, put a System.out.println(bAmt); // bAmt is your berry amount. Get that however you need to inside an if statement checking if the world is server side. If the server side world has the correct berry amount, then it's a syncing issue. If not... Well. We shall keep digging. -
[1.6.4] Draw texture in x,y,z point relative to my 3D-item model
Kwibble replied to BlackCrafer666's topic in Modder Support
That is NOT how OpenGL works... Please go learn Personally, I use the tessellator to draw things in GUI's... So... -
[SOLVED] TESR's Acting as One instead of Individually
Kwibble replied to TheMoleTractor's topic in Modder Support
Ah, good point. I hadn't realized that a tile entity was passed into the method >.> so.... Yeah. Thanks for that diesieben07 -
[1.7.2] Grabbing information from the scoreboard
Kwibble replied to NomNuggetNom's topic in Modder Support
Congratulations! I dub you Forge Forums Modder of the Week. You solved it all on your own -
[SOLVED] TESR's Acting as One instead of Individually
Kwibble replied to TheMoleTractor's topic in Modder Support
It was called twice because it was being called once server side, then once client side. To fix this, surround your code inside onBlockActivated with a check against !world.isRemote (server side). This stops you from having to sync the data. -
Making a Mod, MC, crashing every time i try and load
Kwibble replied to Phyyrus's topic in Modder Support
That may be true, but the error is due to FML not being able to find the class com.phyyrus.ds.proxy.ClientProxy. So... move the class to said external class. -
[SOLVED] TESR's Acting as One instead of Individually
Kwibble replied to TheMoleTractor's topic in Modder Support
First, you would get the tile entity at the given coordinates. Then you would check to see if the tile entity retrieved is an instance of your tile entity, and also not equal to null. Then you would cast the tile entity to your tile entity. Next you would retrieve your berry amount from the caster tile entity. Do all your rendering. -
[SOLVED] TESR's Acting as One instead of Individually
Kwibble replied to TheMoleTractor's topic in Modder Support
Please show your updated code? You have got me a tad confused. -
I'm sorry, bur you had me laughing for a full ten minutes! This was due to: "I am trying to make a nodded pack" And Minecraft crash report: "// Don't do that" But anyway. Please use paste in or minecraftforge.nets version. So much easier to read...
-
Well, what you have said is doable in a from scratch Java project. So... Why don't you try and get the concept working in a little pure Java (no minecraft) project? That way, you can port it to work with Minecraft and you will learn a lot and have fun as well (even if it will only be console based for ease of use/pure easiness.
-
[SOLVED] TESR's Acting as One instead of Individually
Kwibble replied to TheMoleTractor's topic in Modder Support
As diesieben07, you are using a static modifier incorrectly. See how your calling BlockSaphireCrop.getBerryAmount()? That should really be in your tile entity and not static. You can get access to a tile entity via the world and coords params that are passed in. THEN you can get the correct berry amount. -
Please post your relevant stack trace... It might help us a lot. [EDIT] That code would be nice
-
Its all good I take it you have solved it then. Don't worry about this: I do it all the time... Like right now. I am browsing the forums instead of modding. How silly of me.
-
[SOLVED] getLocalizedName() - How do I call this properly?
Kwibble replied to Kimpton's topic in Modder Support
@jabelar If you read what I said you would understand. Kimpton here seems insistent on having a static method blockName(). And so I was giving him the means to actually do that... -
[SOLVED] getLocalizedName() - How do I call this properly?
Kwibble replied to Kimpton's topic in Modder Support
Also: With the way that resource location is now - that is pointing to /assets/[YOUR MOD ID]/collumstone (if the CollumStone's name is collum stone). -
[SOLVED] getLocalizedName() - How do I call this properly?
Kwibble replied to Kimpton's topic in Modder Support
Umm... Did you actually TRY what I said? The private static String blockName? Because I am sorry to tell you, but I know Java. And I also tested it. You can't call a non static method from a static method. You can make a static variable equal a non static variable though. Please, learn Java if you haven't already! And if you have, please do some more learning! You have had a great misconception, I am sorry to say. -
Your passing in a tile entity that has not been instantiated yet... >.> And your passing in a tile entity - Slot takes an inventory. It seems you have missed some basic principles of Java, so please, go learn the basics of Java and then come back to modding. It will make your life so much easier and you will spot problems before they happen