- Mr_Crayfish
- Curse Premium
-
Member for 12 years, 7 months, and 28 days
Last active Thu, Apr, 27 2017 07:17:06
- 173 Followers
- 1,325 Total Posts
- 787 Thanks
-
2
Gharik90 posted a message on When do you think the 1.2 update will come out?My bet is Two Weeks (so before Feb 20th). Any takers? I'll put 5 on the linePosted in: Discussion -
2
Spaces posted a message on Need code for a sword?I assume you are using ModLoader here is what your class should look likePosted in: Modification Development
package net.minecraft.src; public class mod_Namehere extends BaseMod { public static final Item Namehere = new ItemSword(30000, EnumToolMaterial.//Whatever tool material you want ).setItemName("Namehere"); public mod_Namehere() { Namehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/Namehere.png"); ModLoader.AddName(Namehere, "Namehere"); ModLoader.AddRecipe(new ItemStack(Namehere, 1), new Object[] { " P ", " S ", " S ", Character.valueOf('P'), Item.stick, Character.valueOf('S'), Block.dirt }); } public String Version() { return "1.1.0"; } }
-
1
Frizzil posted a message on Help with damage randomizationPosted in: Modification Developmentpackage net.minecraft.src; import java.util.Random; public class ItemLuckySword extends Item { private int weaponDamageMin, weaponDamageMax; Random random = new Random(); public ItemLuckySword(int x) { super(x); maxStackSize = 1; weaponDamageMin= 10; weaponDamageMax= 20; } public float getStrVsBlock(ItemStack itemstack, Block block) { return block.blockID != Block.web.blockID ? 1.5F : 15F; } public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) { itemstack.damageItem(1, entityliving1); return true; } public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving) { itemstack.damageItem(2, entityliving); return true; } public int getDamageVsEntity(Entity entity) { return weaponDamageMin + random.nextInt(weaponDamageMax-weaponDamageMin+1); } public boolean isFull3D() { return true; } public EnumAction getItemUseAction(ItemStack itemstack) { return EnumAction.block; } public int getMaxItemUseDuration(ItemStack itemstack) { return 0x11940; } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack)); return itemstack; } public boolean canHarvestBlock(Block block) { return block.blockID == Block.web.blockID; } }
Lemme know if you need help understanding this. Not to patronize or anything :smile.gif:
Also, lemme know if this doesn't work for some reason. -
3
Frizzil posted a message on Condense If statement method?If you can reduce the ACFs to static final ints...Posted in: Modification Development
switch (eRightFront1) { case ACF1: case ACF2: case ACF3: case ACF4: case ACF5: case ACF6: case ACF7: case ACF8: case ACF9: case ACF10: case ACF11: world.setBlockWithNotify(i + 1, j, k + 1, 0); break; }
Perhaps you could reduce it to a for loop that checks eRightFront1 against each element of an array containing the ACFs, then break if one matches, like this.
public boolean checkForMatch(int value, int[] ACFs) { for (int i = 0; i < ACFs.length; ++i) { if (value == ACFs[i]) return true; } return false; }
If you statically define whatever arrays you're passing in, this would work awesomely.
What are you trying to do? You may able to tackle the problem from more of a high level perspective. Perhaps you need to think about doing whatever it is you're doing in a different way logically, not programmatically. -
43
SillyZebra posted a message on "Happy Isles" (In Dev Game)Hi, I and a few other people are making an Indie game called Happy Isles (written in Java)Posted in: General Gaming
In the game, you customize a character, and create a massive island (which is randomly generated). The goal of the game is to take control of the island, and build your empire. At the begining, you start out with a pickaxe and an axe (sounds a lot like minecraft or terraria, but keep reading) and you collect materials, once you have enough materials, you set up the blueprints table, which shows you the recipes for buildings you can currently make (you unlock more as you level up). After you get some houses set up, NPCs will start to move in.
The NPCs can be given jobs like hunting, mining, wood cutting, etc. They can be found out and about while they're doing their jobs, and you can collect whatever they've collected themselves so far.
Each building has construction time, and different graphics for the building process. Houses can be used for NPCs to live in, and for you to take refuge in and sleep in for the night. The Forge is used to make and upgrade a piece of equipment's stats. The outhouse is used for switching classes (it can be used whenever the player desires), there are different types of each building that can be made from different materials, there are also decorative buildings, and protective buildings like watchtowers and walls.
The classes are Swordsman, Magician, Hunter, and Impacter.
Swordsman: Uses swords, can run at a fair speed using up small amounts of stamina, does an average amount of damage. Swordsmen can get better equipment through upgrading and gathering materials.
Magician: Uses magic (in the form of colored flames), can't run, but can teleport short distances using small amounts of mana for each teleport, can deal small or large amounts of damage, depending on the spell, equipment, and target. Magicians can get better equipment through enchanting, and magic research (using gems).
Hunter: Uses bows, has unlimited arrows, can run much longer than the swordsman, and can charge arrow shots for greater distance and damage. Hunters get better equipment through gathering materials and crafting with them.
Impacter: Uses a massive hammer that it swings in two different directions for each hit, can't run, each shot takes up stamina, but is evened out with massive amounts of damage, and quick stamina regeneration (from food).
Also, there are boots and gloves, I just don't wanna put them on the concept art.
I was thinking the game could be $5 on steam, with free updates. My main goal in life is to have a game on steam.
Workers-
Me- Artist, Web designer, and Publisher
JappeJJ- Music Director
here's the logo/home screen
For contact about Development:
Twitter: @Silly_Zebra
Twitter(Jappe): @JappeJJ
Twitter(Josh): @JohGoins
E-mail: [email protected]
System Requirements:
Will be posted once we actually figure them out :wink.gif:
If you wanna support Happy Isles, we made a banner :biggrin.gif:
[url=www.minecraftforum.net/topic/699319-happy-isles-in-dev-game/][img]http://oi42.tinypic.com/2vcuqfq.jpg[/img][/url]
Website:none, yet
Here's a list of planned features-
- Randomly generated islands
- Expandable territory
- Upgrading system for equipment and buildings
- Leveling system that affects what you build and fight
- Character creation
- Multiplayer
- NPCs
- Give jobs to NPCs
- Randomly generated cave systems with expanded caverns
- Beer
- Ships
- Classes that you can change whenever you want
- Randomly generated "Kingdoms"
- Combine, ignore, or destroy the territories
- Randomly picked bosses (depending on the area)
- Upgraded monsters after every few levels
- Church to teleport to the sky
- Sky islands
- Deathly forests
- Hell Hill
- Ice Caverns
- Ravines
Visit our (under construction) forum:
none, yet
Update
I'm going to code this game on my own now, and my classes won't start until hopefully the first semester of school next year (hopefully not the second semester), in the mean time there's not really anything to talk about here, so we should let this thread die for a while, I can always bump it, once I start my programming class. And remember, the game isn't dead, I'm not gonna give up. -
3
Logicx posted a message on Banned from the my networkNo offense, but it isn't hard to change/manipulate router settings. Your router homepage is made to make it easy :happy.gif:Posted in: Computer Science and TechnologyQuote from Xaanos
Hacking is unauthorized use of computer and network resources.
Hacking is a felony in the United States.
I wouldn't say he was breaking any laws, he/she didn't even "hack" at all. -
19
StarshadesJack posted a message on [Tutorial] [1.4.7+] [NBTTagCompound] Using ItemStack's stackTagCompound for Permanent Extra Data StorageUpdated 3 March 2013Posted in: Tutorials
Finally accurate and useful!
What is NBTTagCompound?
NBTTagCompound is a custom data structure used by Mojang for storing primitive data (byte, short, int, float, double, long, String [not primitive, but exceptionally considered such in Java]).
What is stackTagCompound
The ItemStack class has a public member (class-level variable) of the NBTTagCompound type called stackTagCompound. Basically, every ItemStack in the game has the potential to store unlimited amounts of arbitrary primitive data.
Mojang uses this for things such as storing the custom name of an ItemStack renamed on the Anvil. (Yes, even your solitary Diamond Sword is an ItemStack. It's just a stack of size 1.)
An ItemStack's stackTagCompound is serialized to the save data so anything you throw in here is saved forever and ever.
Quote from Important Notice »
Forge users will need to import NBT-stuffs, thanks to CPW and Lex refactoring MC:
import net.minecraft.nbt.*;
(You can import only the stuff you're using, but this is easier :P)
Storing data to stackTagCompound
In any scope where you have access to an ItemStack, you can fiddle with its stackTagCompound. For the sake of this example, we'll work with the Item class's onCreated method, which gets called whenever you take a stack of it out of the result slot of the crafting table.
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {}
The first thing you want to do is an instantiation check:
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); }
This is absolutely important. For one, the stackTagCompound is only declared by default since not every Item in the game makes use of it. Basically, Java knows an ItemStack can have a stackTagCompound but not everyone actually has one. For two, it's just good practice to make sure the object you're manipulating actually exists. Java will throw a fit if you try to manipulate a null object.
Now comes the meat and potatoes.
NBTTagCompound has a few handy methods:
setByte( String s, byte b ) setShort( String s, short sh ) setInteger( String s, int i ) setLong( String s, long l ) setFloat( String s, float f ) setDouble( String s, double d ) setString( String s, String st ) setByteArray( String s, byte[] ba ) setIntArray( String s, int[] ia ) setBoolean( String s, boolean bl )
There are some other set* methods, but those are a bit complicated and allow for literally embedding complicated groups of things into your complicated group of things.
The first String parameter is the unique key for your data. Think of it as the name you're filing it under. It's important that this key doesn't conflict with any other key (they are case-sensitive, of course)! Here's some usage examples:
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); int i = 45; int[] ia = { 1, 2, 3, 7 }; String s = "Created by Player " . par3EntityPlayer.username; par1ItemStack.stackTagCompound.setInteger( "AnInteger", i ); par1ItemStack.stackTagCompound.setIntArray( "AnIntegerArray", ia ); par1ItemStack.stackTagCompound.setString( "WhoCreated", s ); }
Getting data from a stackTagcompound
Obviously, if you're storing to it, you want to read from it at some point as well. For this example, we'll work with Item's addInformation method which lets you add custom information to the ItemStack's tooltip (like how an enchanted thing's enchantments are listed on the mouse-hover-over tooltip).
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {}
First thing's first, of course, we need our instantiation check:
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); }
Now, we have a wealth of functions to call to get data from:
getByte( String s ) getShort( String s ) getInteger( String s ) getLong( String s ) getFloat( String s ) getDouble( String s ) getString( String s ) getByteArray( String s ) getIntArray( String s ) getBoolean( String s )
Of course, there are other get methods since, as you can store complicated groups of things in your complicated group of things, you can read them back too.
Naturally, the string parameter is the key for which you'd like to get the stored value.
Let's say we'll have this ItemStack proudly display who made it:
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); par3List.add( par1ItemStack.getString( "WhoCreated" ) ); }
This is well and good. We could call it finished. But, what happens if there isn't a key in the stackTagCompound called "WhoCreated"?
Well, fortunately, these getters will return a default in such a case: 0, array of 0s, false, empty string "", etc. But, we don't always want those defaults, do we? After all, in our case here, this means the ItemStack would display an empty string!
So, that's where a little method called hasKey( String s ) comes in. It lets you check if a key exists and handle the failure situation yourself. In our case, we could do this:
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if( par1ItemStack.stackTagCompound == null ) par1ItemStack.setTagCompound( new NBTTagCompound( ) ); if( par1ItemStack.stackTagCompound.hasKey( "WhoCreated" ) ) par3List.add( par1ItemStack.getString( "WhoCreated" ) ); else par3List.add( "Created by Almighty Jeb" ); }
Now, instead of an empty line, we know that it was good ol' Jens Bergensten who made it.
Deleting Stored Info
Just as you can add data to a stackTagCompound, you can remove data from it permanently. This is accomplished through a method called removeTag( String s ). The parameter, of course, being the key that, along with its data, you wish to completely obliterate.
... You don't need an example do you? Okay, fine, fine.
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { if( par3Entity instanceof EntityPlayer ) { if( ((EntityPlayer)par3Entity).username.equalsIgnoreCase("badluckbrian") ) { if( par1ItemStack.stackTagCompound != null ) par1ItemStack.stackTagCompound.removeTag( "ench" ); } } } }
If you can't tell what this one does, it disenchants the item if placed into the inventory of a player named badluckbrian (with the actual casing of any letter ignored).
Miscellaneous Advice
Consistent NBT writing leads to wonkiness.
If you are constantly updating the stackTagCompound every tick or couple of ticks, your item will have some wonk to its rendering. It can repeatedly bob up and down or actually bob all the way down for a bit and then bob back up. This is because the NBT is being updated server-side and then the server updates the client. Because the item is "new", the client renders it as swapping to a new item.
At least, that's the best way to explain it. Your move.
Class members (class level variables) in Item-type classes are static regardless.
See this class?
public class ItemYourItem extends Item { private int foo = 0; public ItemYourItem( int id ) { super( id ); } }
Even though it's not declared static, foo is static. All instances of ItemYourItem share this same variable. That's because all instances are just pointers to one object of type ItemYourItem.
To make it clear, if this was in ItemSword, every sword in the game would share this variable foo. If it's changed anywhere in the class code, it's reflected in all swords in the game everywhere.
-
Well, that's all for now, folks! If there's anything NBT related you'd like to see added to this tutorial, let me know. If you spot any errors, let me know too.
Things I'm considering adding at a later point:
- Enchantments (removing specific enchantments, especially)
- Potions
- "Hard Mode" (How to do some things the hard way, rather than relying on MC's own getters/setters/etc)
- A better way to do timers for items that do things over a span of time. -
11
mickyboondock posted a message on [Epic] My Jungle Tree House | Survival | Update #2i couldn't figure out how to update my old thread, but ive done alot on my jungle tree house, and it has almost doubled in size in just a day. all of this is done in survival mode with no mods or cheats. hope you enjoy, and if you have any suggestions, let me know. tell me what you think.Posted in: Screenshots
top balcony, with chicken farm on the roof, the eggs drop onto the table in the kitchen
the storage room
i decided to open up the sleeping courters into a balcony to give it more of a treehouse feel, rather than an enclosed area
inside view
found a decent place to put my portal rather than the beach
here is an inside view of the kitchen
and here are some different angled views
ive managed to get to the nether and make an xp farm so i can do some nice enchanting, i currently have around 90 or so diamonds from fortune III, and i will be working on my nether base quite alot to.
i hope you all enjoy, tell me what you think along with any suggestions. -
4
SlyFoxx posted a message on can some one tell me hot to make mods?Make a mod that makes you type like an intelligent human being ಠ_ಠPosted in: Minecraft Mods -
1
Creategenuis posted a message on Made New Furnace Get Error Code While Playingyou need to register your TileEnity class to modloader:Posted in: Modification Development
ModLoader.RegisterTileEnity(TileEnityYourFurnace.class, "your tileEnity name");
- To post a comment, please login.
1
Well what do you think "This furniture has not been added yet" on a development build mean?
1
That's why I haven't added it. If someone really wants it, they can create a resource pack and override the model.
1
I'm not ignoring them because I don't like them. He quoted the OP post, and it's annoying, therefore I don't care what he has to say.
2
Ignoring all suggestions. Do not QUOTE the OP POST!
1
I've only added bare minimal food to my Furniture Mod as I'm going to be writing a separate food mod which depends on the new kitchen update. I basically didn't want to publish the kitchen update and have a toaster that does nothing until someone registers a custom recipe. The support for custom knives sounds cool and I will take it on board. The cookie jar idea was actually suggested from fans. What you see is basically my take on a cookie jar render and you can tell a big difference between my mod and bibliocraft
1
I'm currently updating the mod to 1.7.10 and 1.8 due to requests. Might add in some new features
*cough* ATM *cough*
4
2
I've always had this idea threw at me. Now that you have explained it in depth, I really like it. I will added this in a future update! Also, the inclusion of a post office to send mail to other players would be another great addition.
1
I actually found out this is a problem. The variable name for payment metadata is payment-item-metadata but I'm changing it to payment-metadata in version 3.4.6
2
Apology accept I've been planning to make the mod open source once I clean up a ton of code but I have never got around to it yet.