An alchemy mod was already made, just so you know. You need GuiYOURBLOCK, ContainerYOURBLOCK, SlotYOURBLOCK, and if you want your workbench to only be able to craft your recipies, RecipiesYOURBLOCK (the names don't need to be exactly that, this is just so you know what files yours should look like). Also, instead of
entityplayer.displayWorkbenchGUI(i, j, k)
use
ModLoader.OpenGUI(entityplayer, new GuiYOURBlOCK(entityplayer.inventory, world, i , j , k));
(if you are going to use ModLoader, which I recommend).
If I'm not mistaken the reason why its coming to XBLA and not to PSN is because, XBLA has freedom for ANY user to submit an arcade game, indie game, etc. However, PSN does not have as much freedom in Indie games, which is the category Minecraft fits into. I could be wrong, however my friend has both 360 and PS3, and I was told PSN doesn't have free indie game submission.
[quote=simo_415;/comments/19274881] Customising a block class
In this tutorial I will explain how to create custom block behavior rather than the default behavior. It all basically comes down to overwriting methods in Block.class. This can create blocks which when clicked - exhibit some behavior (see example below), having the block be a redstone power source, explode well... basically anything is possible..
Deployable House Example
So below I am going to provide an example of adding to our Example block class a feature that when the block is clicked it will create a basic house - this allows a simple way of creating a deployable house.
This code will need to be added to the BlockExample class.
[code] public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
// Basic Building
int block = Block.wood.blockID;
int size = 5;
for (int i1 = 0; i1 < size; i1++)
{
for (int j1 = 0; j1 < size; j1++)
{
//Walls
// i == ++ k == 0
world.setBlockWithNotify(i+i1,j+j1,k,block);
// i == ++ k == 4
world.setBlockWithNotify(i+i1,j+j1,k+(size-1),block);
// i == 0 k == ++
world.setBlockWithNotify(i,j+j1,k+i1,block);
// i == 4 k == ++
world.setBlockWithNotify(i+(size-1),j+j1,k+i1,block);
//Roof
world.setBlockWithNotify(i+i1,j+(size-1),k+j1,block);
//Floor
world.setBlockWithNotify(i+i1,j,k+j1,block);
}
}
//Door
world.setBlockWithNotify(i+1,j+2,k,0);
world.setBlockWithNotify(i+1,j+1,k,0);
//Windows
int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2);
world.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID);
world.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID);
//Utilities
world.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID);
}
[quote
This is what i have in BlockExample.java
[code]package net.minecraft.src;
import java.util.Random;
public class BlockExample extends Block
{
public BlockExample(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random)
{
return 0;
}
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
// Basic Building
int block = Block.wood.blockID;
int size = 5;
for (int i1 = 0; i1 < size; i1++)
{
for (int j1 = 0; j1 < size; j1++)
{
//Walls
// i == ++ k == 0
world.setBlockWithNotify(i+i1,j+j1,k,block);
// i == ++ k == 4
world.setBlockWithNotify(i+i1,j+j1,k+(size-1),block);
// i == 0 k == ++
world.setBlockWithNotify(i,j+j1,k+i1,block);
// i == 4 k == ++
world.setBlockWithNotify(i+(size-1),j+j1,k+i1,block);
//Roof
world.setBlockWithNotify(i+i1,j+(size-1),k+j1,block);
//Floor
world.setBlockWithNotify(i+i1,j,k+j1,block);
}
}
//Door
world.setBlockWithNotify(i+1,j+2,k,0);
world.setBlockWithNotify(i+1,j+1,k,0);
//Windows
int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2);
world.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID);
world.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID);
world.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID);
//Utilities
world.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID);
world.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID);
}[/code]
This was in Block.java
[code] public static final Block example;[/code]
and
[code]example = (new BlockExample(92, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep);[/code]
This was in CraftingManager.java
[code] addRecipe(new ItemStack(Block.example, 1), new Object[] {
"##", "##", Character.valueOf('#'), Block.dirt
});[/code]
This was the error i got. :dry.gif:
[/code]
*** Minecraft Coder Pack Version 2.12 ***
MCP 2.12 running in C:\MCP
Compiling Minecraft
sources\minecraft\net\minecraft\src\BlockExample.java:17: 'class' or 'interface'
expected
public void onBlockClicked(World world, int i, int j, int k, EntityPlaye
r entityplayer)
^
1 error
Compiling Minecraft Server
[/code]
Please help. I dont think i forgot anything. Oh and your next tut, in my opinion, should be on common errors. :smile.gif:
Thx in advance.
0
0
thank you
0
This is what i call BlockAlchemyStation
In block i have this
I also have this in CraftingManager
I tried to compile with just this and i got this:
I need help what do i need to edit and what else?
0
what is an indie game?
0
if cant be both ps3!
0
Looks much better i did include it in the 2nd update in the last 10 mins.
0
sure
0
The netherrack tools work also but i forgot to make a icon for the ingot. Im doing that now.
0
then how do you add pictures?
wont let me do them all
0
0
Anymore it is startclient.bat
0
By put in a class u mean what? Oh and good tut. You aught to make a tut on java scripting lingo. :smile.gif:
0
Customising a block class
In this tutorial I will explain how to create custom block behavior rather than the default behavior. It all basically comes down to overwriting methods in Block.class. This can create blocks which when clicked - exhibit some behavior (see example below), having the block be a redstone power source, explode well... basically anything is possible..
Deployable House Example
So below I am going to provide an example of adding to our Example block class a feature that when the block is clicked it will create a basic house - this allows a simple way of creating a deployable house.
This code will need to be added to the BlockExample class.
[code] public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer) { // Basic Building int block = Block.wood.blockID; int size = 5; for (int i1 = 0; i1 < size; i1++) { for (int j1 = 0; j1 < size; j1++) { //Walls // i == ++ k == 0 world.setBlockWithNotify(i+i1,j+j1,k,block); // i == ++ k == 4 world.setBlockWithNotify(i+i1,j+j1,k+(size-1),block); // i == 0 k == ++ world.setBlockWithNotify(i,j+j1,k+i1,block); // i == 4 k == ++ world.setBlockWithNotify(i+(size-1),j+j1,k+i1,block); //Roof world.setBlockWithNotify(i+i1,j+(size-1),k+j1,block); //Floor world.setBlockWithNotify(i+i1,j,k+j1,block); } } //Door world.setBlockWithNotify(i+1,j+2,k,0); world.setBlockWithNotify(i+1,j+1,k,0); //Windows int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2); world.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID); world.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID); world.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID); world.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID); //Utilities world.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID); world.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID); world.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID); } [quote This is what i have in BlockExample.java [code]package net.minecraft.src; import java.util.Random; public class BlockExample extends Block { public BlockExample(int i, int j) { super(i, j, Material.rock); } public int idDropped(int i, Random random) { return 0; } } public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer) { // Basic Building int block = Block.wood.blockID; int size = 5; for (int i1 = 0; i1 < size; i1++) { for (int j1 = 0; j1 < size; j1++) { //Walls // i == ++ k == 0 world.setBlockWithNotify(i+i1,j+j1,k,block); // i == ++ k == 4 world.setBlockWithNotify(i+i1,j+j1,k+(size-1),block); // i == 0 k == ++ world.setBlockWithNotify(i,j+j1,k+i1,block); // i == 4 k == ++ world.setBlockWithNotify(i+(size-1),j+j1,k+i1,block); //Roof world.setBlockWithNotify(i+i1,j+(size-1),k+j1,block); //Floor world.setBlockWithNotify(i+i1,j,k+j1,block); } } //Door world.setBlockWithNotify(i+1,j+2,k,0); world.setBlockWithNotify(i+1,j+1,k,0); //Windows int offset = size % 2 == 0 ? (size / 2) - 1 : (size / 2); world.setBlockWithNotify(i,j+offset,k+offset,Block.glass.blockID); world.setBlockWithNotify(i+offset,j+offset,k,Block.glass.blockID); world.setBlockWithNotify(i+(size-1),j+offset,k+offset,Block.glass.blockID); world.setBlockWithNotify(i+offset,j+offset,k+(size-1),Block.glass.blockID); //Utilities world.setBlockWithNotify(i+1,j+1,k+(size-2),Block.crate.blockID); world.setBlockWithNotify(i+(size-2),j+1,k+1,Block.workbench.blockID); world.setBlockWithNotify(i+(size-2),j+1,k+(size-2),Block.stoneOvenIdle.blockID); }[/code]
This was in Block.java
[code] public static final Block example;[/code]
and
[code]example = (new BlockExample(92, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep);[/code]
This was in CraftingManager.java
[code] addRecipe(new ItemStack(Block.example, 1), new Object[] { "##", "##", Character.valueOf('#'), Block.dirt });[/code]
This was the error i got. :dry.gif:
[/code]
*** Minecraft Coder Pack Version 2.12 ***
MCP 2.12 running in C:\MCP
Compiling Minecraft
sources\minecraft\net\minecraft\src\BlockExample.java:17: 'class' or 'interface'
expected
public void onBlockClicked(World world, int i, int j, int k, EntityPlaye
r entityplayer)
^
1 error
Compiling Minecraft Server
[/code]
Please help. I dont think i forgot anything. Oh and your next tut, in my opinion, should be on common errors. :smile.gif:
Thx in advance.