I'm working on creating a "Stained Glass Block". It's going to be the same as Glass but with a colour mask added in PHotoshop to give it a coloured effect.
I've got it working in-game but the problem is it isn't transparent. I tried you're isOpaqueBlock function above but it didn't make any difference.
-- EDIT --
Got it completely working now and have altered my code below to reflect that:
I can see through the bottom of the block in to the world, instead of seeing the dirt below it though?
Thanks
Xopa.
Right now my glass block image is just a 16x16 block of pink with the opacity turned down to 60%.
BlockStainedGlass.java
package net.minecraft.src;
import java.util.Random;
public class BlockStainedGlass extends Block
{
protected BlockStainedGlass(int i, int j)
{
super (i, j, Material.glass);
}
public int quantityDropped(Random random)
{
return 0;
}
public boolean isOpaqueCube()
{
return false;
}
public int getRenderBlockPass()
{
return 1;
}
}
mod_BlockStainedGlass.java
package net.minecraft.src;
import java.util.Random;
public class mod_BlockStainedGlass extends BaseMod
{
public static final Block stainedGlass = new BlockStainedGlass(152,0).setHardness(3F).setResistance(4F).setLightValue(1F).setBlockName("Stained Glass");
public void load ()
{
//This registers our new block
ModLoader.RegisterBlock(stainedGlass);
stainedGlass.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/stainedGlass.gif");
//This adds the in game name to our block
ModLoader.AddName(stainedGlass, "Stained Glass");
//This adds a crafting recipe for the block
ModLoader.AddRecipe(
new ItemStack(stainedGlass, 10),
new Object[] {"*", Character.valueOf('*'), Block.dirt}
);
}
public String getVersion()
{
return "3.14159265";
}
}
Try getting rid of the setRenderBlockPass. If you want to keep it for some reason, set it to 0. Then put this on your public static final line in mod_
Says that the SoulReaverSword dont exist or something of the type.
Post your code please.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
public class mod_Soul extends BaseMod
{
public static final Item Soul = new ItemFood(9000, 8, 1F, false).setPotionEffect(Potion.regeneration.id, 30, 0, 1F).setItemName("soul");
public void load()
{
Soul.iconIndex = ModLoader.addOverride("/gui/items.png", "/pics/Soul.png");
ModLoader.AddName(Soul, "Soul");
ModLoader.AddRecipe(new ItemStack(Soul, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
You need to create your SoulReaverSword in the same class. You shouldn't have more than one mod_ class for a mod.
If you don't want to do that(I do recommend that you do though), the just put it in the recipe as
mod_SoulReaverSword.SoulReaverSword
(or whatever the correct names are)
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Is this later today? :laugh.gif:
But actually I have a question: Do you know how to make an item that give you a bowl back, my code:
public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
super.onFoodEaten(itemstack, world, entityplayer);
return new ItemStack(Item.bowlEmpty);
}
}
yes I got this from the soup.java, but I don't get any errors but it won't give me the bowl.
Soon. That should be working. I don't know why it isnt. Does your class that you have that in extend ItemFood? Can you post your public static final line please for the item, and the class you have the return code in please.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Soon. That should be working. I don't know why it isnt. Does your class that you have that in extend ItemFood? Can you post your public static final line please for the item, and the class you have the return code in please.
Lets see here...
my ItemoatMeal.
package net.minecraft.src;
public class ItemoatMeal extends Item
{
public ItemoatMeal(int i)
{
super(i);
maxStackSize = 64;
}
public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer
entityplayer)
{
super.onFoodEaten(itemstack, world, entityplayer);
return new
ItemStack(Item.bowlEmpty);
}
}
And if this is relevant:
mod_oatMeal
package net.minecraft.src;
public class mod_Oat extends BaseMod
{
public static final Item oatMeal = new ItemFood(134, 4, 1F, false).setItemName("oatmeal");
public void load()
{
oatMeal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Koadmod/Oatmeal.png");
ModLoader.AddName(oatMeal, "Oatmeal");
ModLoader.AddRecipe(new ItemStack(oatMeal, 1), new Object [] {"###", " # ", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.1";
}
}
And yea I guess that is doesn't extend ItemFood but when I tried that it gave me a bunch of errors that said that my 'int's were to long or something like that.
The problem lies that you are still making it a 'new ItemFood' and not a 'new ItemoatMeal'. So basically, you should have it like this:
public static final Item oatMeal = new ItemoatMeal(134, 4, false).setItemName("oatmeal");
and make the ItemoatMeal class extend ItemFood, then change the constructor around a little.
package net.minecraft.src;
public class ItemoatMeal extends ItemFood
{
public ItemoatMeal(int i, int j)
{
super(i, j, false);
maxStackSize = 64;
}
public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer
entityplayer)
{
super.onFoodEaten(itemstack, world, entityplayer);
return new
ItemStack(Item.bowlEmpty);
}
}
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Awesome looking forward to your great tuts :smile.gif:
Which generation tutorial do you need first, structures or ores? :smile.gif:
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
== MCP 5.6 (data: 5.6, client: 1.1, server: 1.1) ==
> Recompiling client...
'"C:\Program Files\Java\jdk1.7.0_01\bin\javac.exe" -g -source 1.6 -target 1.6 -c
lasspath "lib;lib\*;jars\bin\minecraft.jar;jars\bin\jinput.jar;jars\bin\lwjgl.ja
r;jars\bin\lwjgl_util.jar" -sourcepath src\minecraft -d bin\minecraft src\minecr
aft\net\minecraft\client\*.java src\minecraft\net\minecraft\isom\*.java src\mine
craft\net\minecraft\src\*.java conf\patches\ga.java conf\patches\Start.java' fai
led : 1
== ERRORS FOUND ==
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\net\minecraft\src\EntityDeath.java:37: error: cannot find symbol
return Item.Darkmatter.shiftedIndex;
^
symbol: variable Darkmatter
location: class Item
1 error
1 warning
==================
FATAL ERROR
Traceback (most recent call last):
File "runtime\recompile.py", line 31, in recompile
commands.recompile(CLIENT)
File "C:\Users\User\Desktop\Mcp 1.1\runtime\commands.py", line 736, in recompi
le
self.runcmd(forkcmd)
File "C:\Users\User\Desktop\Mcp 1.1\runtime\commands.py", line 779, in runcmd
raise CalledProcessError(returncode, forkcmd, output)
CalledProcessError: Command '"C:\Program Files\Java\jdk1.7.0_01\bin\javac.exe" -
g -source 1.6 -target 1.6 -classpath "lib;lib\*;jars\bin\minecraft.jar;jars\bin\
jinput.jar;jars\bin\lwjgl.jar;jars\bin\lwjgl_util.jar" -sourcepath src\minecraft
-d bin\minecraft src\minecraft\net\minecraft\client\*.java src\minecraft\net\mi
necraft\isom\*.java src\minecraft\net\minecraft\src\*.java conf\patches\ga.java
conf\patches\Start.java' returned non-zero exit status 1
Press any key to continue . . .
As you can see I am trying to make my mob drop my custom Item "Darkmatter" but I get this error.
Here is my code for Darkmatter mod_Darkmatter:
package net.minecraft.src;
public class mod_Darkmatter extends BaseMod
{
public static final Item Darkmatter = new ItemDarkmatter(5000).setItemName("Darkmatter");
public void load()
{
Darkmatter.iconIndex = ModLoader.addOverride("/gui/items.png", "/Skins/Darkmatter.png");
ModLoader.AddName(Darkmatter, "Darkmatter");
}
public String getVersion()
{
return "1.1";
}
}
And here is the ItemDarkmatter:
package net.minecraft.src;
public class ItemDarkmatter extends Item
{
public ItemDarkmatter(int i)
{
super(i);
maxStackSize = 64;
}
}
Please help :smile.gif:
Rollback Post to RevisionRollBack
How about you click that little + if I helped you, or you just <3 me :P.
Merge your mod_ classes. You should never have more than one mod_ class. Then put the entity drop as
mod_Namehere.Darkmatter.shiftedIndex
Where Namehere is obviously the name of the class where all your mod_ code is.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
ModLoader.AddRecipe(new ItemStack(Soul, 1), new Object [] {"#", "@", Character.valueOf('#'), SoulReaverSword, Character.valueOf('@'), Block.dirt});Says that the SoulReaverSword dont exist or something of the type.
Try getting rid of the setRenderBlockPass. If you want to keep it for some reason, set it to 0. Then put this on your public static final line in mod_
That is the same opacity as water for reference.
Post your code please.
together they are powerful beyond imagination."
If you don't want to do that(I do recommend that you do though), the just put it in the recipe as (or whatever the correct names are)
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBut actually I have a question: Do you know how to make a food item that give you a bowl back, my code:
public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { super.onFoodEaten(itemstack, world, entityplayer); return new ItemStack(Item.bowlEmpty); } }yes I got this from the soup.java, but I don't get any errors but it won't give me the bowl.
Sir you're a genius !!!!!
Soon. That should be working. I don't know why it isnt. Does your class that you have that in extend ItemFood? Can you post your public static final line please for the item, and the class you have the return code in please.
together they are powerful beyond imagination."
Thanks :smile.gif:
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumLets see here...
my ItemoatMeal.
package net.minecraft.src; public class ItemoatMeal extends Item { public ItemoatMeal(int i) { super(i); maxStackSize = 64; } public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { super.onFoodEaten(itemstack, world, entityplayer); return new ItemStack(Item.bowlEmpty); } }And if this is relevant:
mod_oatMeal
package net.minecraft.src; public class mod_Oat extends BaseMod { public static final Item oatMeal = new ItemFood(134, 4, 1F, false).setItemName("oatmeal"); public void load() { oatMeal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Koadmod/Oatmeal.png"); ModLoader.AddName(oatMeal, "Oatmeal"); ModLoader.AddRecipe(new ItemStack(oatMeal, 1), new Object [] {"###", " # ", Character.valueOf('#'), Block.dirt}); } public String getVersion() { return "1.1"; } }public static final Item oatMeal = new ItemoatMeal(134, 4, false).setItemName("oatmeal");and make the ItemoatMeal class extend ItemFood, then change the constructor around a little.
package net.minecraft.src; public class ItemoatMeal extends ItemFood { public ItemoatMeal(int i, int j) { super(i, j, false); maxStackSize = 64; } public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { super.onFoodEaten(itemstack, world, entityplayer); return new ItemStack(Item.bowlEmpty); } }Doing that should work.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThanks for clearing that up, it has worked, I await your stairs tutorial...
but it is 10:30 over here...
So I will look at it tomorrow.
Cause I really need a tut on that.
Soon, maybe tomorrow.
together they are powerful beyond imagination."
Which generation tutorial do you need first, structures or ores? :smile.gif:
together they are powerful beyond imagination."
I would also like to put chests and Mobspawners inside these houses. :smile.gif:
Here is my code mod_death:
package net.minecraft.src; import java.util.Map; public class mod_Death extends BaseMod { public void load() { ModLoader.RegisterEntityID(EntityDeath.class, "Deathman", ModLoader.getUniqueEntityId()); ModLoader.AddSpawn(EntityDeath.class, 3, 1, 4, EnumCreatureType.creature); } public void AddRenderer(Map map) { map.put(EntityDeath.class, new RenderBiped(new ModelBiped(), 0.5F)); } public String getVersion() { return "1.1"; } }And here is the EntityDeath:
package net.minecraft.src; import java.util.Random; public class EntityDeath extends EntityMob { public EntityDeath(World world) { super(world); texture = "/Skins/Death.png"; moveSpeed = 0.5F; attackStrength = 1; } public int getMaxHealth() { return 75; } protected String getLivingSound() { return "note.snare"; } protected String getHurtSound() { return "note.snare"; } protected String getDeathSound() { return "note.snare"; } protected int getDropItemId() { return Item.Darkmatter.shiftedIndex; } protected boolean canDespawn() { return false; } }The error:
== MCP 5.6 (data: 5.6, client: 1.1, server: 1.1) == > Recompiling client... '"C:\Program Files\Java\jdk1.7.0_01\bin\javac.exe" -g -source 1.6 -target 1.6 -c lasspath "lib;lib\*;jars\bin\minecraft.jar;jars\bin\jinput.jar;jars\bin\lwjgl.ja r;jars\bin\lwjgl_util.jar" -sourcepath src\minecraft -d bin\minecraft src\minecr aft\net\minecraft\client\*.java src\minecraft\net\minecraft\isom\*.java src\mine craft\net\minecraft\src\*.java conf\patches\ga.java conf\patches\Start.java' fai led : 1 == ERRORS FOUND == warning: [options] bootstrap class path not set in conjunction with -source 1.6 src\minecraft\net\minecraft\src\EntityDeath.java:37: error: cannot find symbol return Item.Darkmatter.shiftedIndex; ^ symbol: variable Darkmatter location: class Item 1 error 1 warning ================== FATAL ERROR Traceback (most recent call last): File "runtime\recompile.py", line 31, in recompile commands.recompile(CLIENT) File "C:\Users\User\Desktop\Mcp 1.1\runtime\commands.py", line 736, in recompi le self.runcmd(forkcmd) File "C:\Users\User\Desktop\Mcp 1.1\runtime\commands.py", line 779, in runcmd raise CalledProcessError(returncode, forkcmd, output) CalledProcessError: Command '"C:\Program Files\Java\jdk1.7.0_01\bin\javac.exe" - g -source 1.6 -target 1.6 -classpath "lib;lib\*;jars\bin\minecraft.jar;jars\bin\ jinput.jar;jars\bin\lwjgl.jar;jars\bin\lwjgl_util.jar" -sourcepath src\minecraft -d bin\minecraft src\minecraft\net\minecraft\client\*.java src\minecraft\net\mi necraft\isom\*.java src\minecraft\net\minecraft\src\*.java conf\patches\ga.java conf\patches\Start.java' returned non-zero exit status 1 Press any key to continue . . .As you can see I am trying to make my mob drop my custom Item "Darkmatter" but I get this error.
Here is my code for Darkmatter mod_Darkmatter:
package net.minecraft.src; public class mod_Darkmatter extends BaseMod { public static final Item Darkmatter = new ItemDarkmatter(5000).setItemName("Darkmatter"); public void load() { Darkmatter.iconIndex = ModLoader.addOverride("/gui/items.png", "/Skins/Darkmatter.png"); ModLoader.AddName(Darkmatter, "Darkmatter"); } public String getVersion() { return "1.1"; } }And here is the ItemDarkmatter:
package net.minecraft.src; public class ItemDarkmatter extends Item { public ItemDarkmatter(int i) { super(i); maxStackSize = 64; } }Please help :smile.gif:
Where Namehere is obviously the name of the class where all your mod_ code is.
together they are powerful beyond imagination."
Put them together in a mod_namehere?
(Sorry I am still new and learning :/)