[1.8.1 Mod Making] Creating a new torch!
+5
MrCreeper07
PureTryOut
lcass
the undecided t
austin56101
9 posters
Page 1 of 1
[1.8.1 Mod Making] Creating a new torch!
This is what ill tell you how to make!
ok this will go into your mod_BlockElectricTorch.java
And this will go into BlockElectricTorch.java
ok this will go into your mod_BlockElectricTorch.java
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_BlockElectricTorch extends BaseMod
{
public static final Block blockElectricTorch =
new BlockElectricTorch(127,0).setHardness(0.0F).setResistance(5.0F).setLightValue(1.0F).setBlockName("BlockElectricTorch");
public mod_BlockElectricTorch()
{
ModLoader.RegisterBlock(blockElectricTorch);
blockElectricTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/blockElectricTorch.png");
ModLoader.AddName(blockElectricTorch, "blockElectricTorch");
ModLoader.AddRecipe(new ItemStack(blockElectricTorch, 10), new Object[] {
" * ", Character.valueOf('*'), Block.dirt
});
}
And this will go into BlockElectricTorch.java
- Code:
//THIS CODE GOES INTO YOUR BlockElectricTorch.java FILE! (or whatever you called your block class)
package net.minecraft.src;
import java.util.Random;
public class BlockElectricTorch extends Block
{
protected BlockElectricTorch(int i, int j)
{
super(i, j, Material.circuits);
setTickOnLoad(true);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 2;
}
private boolean func_31032_h(World world, int i, int j, int k)
{
return world.isBlockNormalCube(i, j, k) || world.getBlockId(i, j, k) == Block.fence.blockID;
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
if(world.isBlockNormalCube(i - 1, j, k))
{
return true;
}
if(world.isBlockNormalCube(i + 1, j, k))
{
return true;
}
if(world.isBlockNormalCube(i, j, k - 1))
{
return true;
}
if(world.isBlockNormalCube(i, j, k + 1))
{
return true;
}
return func_31032_h(world, i, j - 1, k);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
if(l == 1 && func_31032_h(world, i, j - 1, k))
{
i1 = 5;
}
if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
{
i1 = 4;
}
if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
{
i1 = 3;
}
if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
{
i1 = 2;
}
if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
{
i1 = 1;
}
world.setBlockMetadataWithNotify(i, j, k, i1);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockMetadata(i, j, k) == 0)
{
onBlockAdded(world, i, j, k);
}
}
public void onBlockAdded(World world, int i, int j, int k)
{
if(world.isBlockNormalCube(i - 1, j, k))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
} else
if(world.isBlockNormalCube(i + 1, j, k))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
} else
if(world.isBlockNormalCube(i, j, k - 1))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
} else
if(world.isBlockNormalCube(i, j, k + 1))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
} else
if(func_31032_h(world, i, j - 1, k))
{
world.setBlockMetadataWithNotify(i, j, k, 5);
}
dropTorchIfCantStay(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
if(dropTorchIfCantStay(world, i, j, k))
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
{
flag = true;
}
if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
{
flag = true;
}
if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
{
flag = true;
}
if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
{
flag = true;
}
if(!func_31032_h(world, i, j - 1, k) && i1 == 5)
{
flag = true;
}
if(flag)
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
}
}
}
private boolean dropTorchIfCantStay(World world, int i, int j, int k)
{
if(!canPlaceBlockAt(world, i, j, k))
{
dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k));
world.setBlockWithNotify(i, j, k, 0);
return false;
} else
{
return true;
}
}
public MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1)
{
int l = world.getBlockMetadata(i, j, k) & 7;
float f = 0.15F;
if(l == 1)
{
setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
} else
if(l == 2)
{
setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
} else
if(l == 3)
{
setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
} else
if(l == 4)
{
setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
} else
{
float f1 = 0.1F;
setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1);
}
return super.collisionRayTrace(world, i, j, k, vec3d, vec3d1);
}
public void randomDisplayTick(World world, int i, int j, int k, Random random)
{
int l = world.getBlockMetadata(i, j, k);
double d = (float)i + 0.5F;
double d1 = (float)j + 0.85F;
double d2 = (float)k + 0.5F;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
if(l == 1)
{
world.spawnParticle("smoke", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
} else
if(l == 2)
{
world.spawnParticle("smoke", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
} else
if(l == 3)
{
world.spawnParticle("smoke", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
} else
if(l == 4)
{
world.spawnParticle("smoke", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
} else
{
world.spawnParticle("smoke", d, d1, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1, d2, 0.0D, 0.0D, 0.0D);
}
}
public int idDropped(int i, Random random)
{
return mod_BlockElectricTorch.blockElectricTorch.blockID;
}
public int quantityDropped(Random random)
{
return 4;
}
}
- Code:
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1 Mod Making] Creating a new torch!
the undecided t wrote:how would you change the particles?
in the blockelectrictorch:
- Code:
public void randomDisplayTick(World world, int i, int j, int k, Random random)
{
int l = world.getBlockMetadata(i, j, k);
double d = (float)i + 0.5F;
double d1 = (float)j + 0.85F;
double d2 = (float)k + 0.5F;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
if(l == 1)
{
world.spawnParticle("smoke", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
} else
if(l == 2)
{
world.spawnParticle("smoke", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
} else
if(l == 3)
{
world.spawnParticle("smoke", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
} else
if(l == 4)
{
world.spawnParticle("smoke", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
} else
{
world.spawnParticle("smoke", d, d1, d2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", d, d1, d2, 0.0D, 0.0D, 0.0D);
}
}
this is were you change the x y z (aka i j k):
- Code:
double d = (float)i + 0.5F;
double d1 = (float)j + 0.85F;
double d2 = (float)k + 0.5F;
also were ever it says flame/smoke, you can add other type of particles!
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1 Mod Making] Creating a new torch!
ok cool thats what i was looking for... where would i put the particle .pngs?
Re: [1.8.1 Mod Making] Creating a new torch!
theres like several places
but were i put it is
MpcFOLDER>bin>minecraft>here:)
but were i put it is
MpcFOLDER>bin>minecraft>here:)
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1 Mod Making] Creating a new torch!
If you are going to change that you will need to then do for the particles create a new texture for them if your not going ot be using the standard flames and smoke
Re: [1.8.1 Mod Making] Creating a new torch!
I now have BlockElectricTorchOn and BlockElectricTorchOff. So I don't want the ElectricTorchOff to spawn particles.
How can I do that?
How can I do that?
PureTryOut- Member
- Posts : 4
Join date : 2011-10-29
Re: [1.8.1 Mod Making] Creating a new torch!
hey i got this error just renaming electric in BlockElectricTorch to BlockJiffyTorch on every one of those lines and changed the recipe and got this error
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:21: reached end of file while parsing
}
^
1 error
==================
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
MrCreeper07 wrote:hey i got this error just renaming electric in BlockElectricTorch to BlockJiffyTorch on every one of those lines and changed the recipe and got this error
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:21: reached end of file while parsing
}
^
1 error
==================
That means you forgot to place a bracket at the end of the file. Check the last part of the file and place a bracket and it should hopefully work.
PureTryOut- Member
- Posts : 4
Join date : 2011-10-29
Re: [1.8.1 Mod Making] Creating a new torch!
BTW to do this you will need to copy and invert the code from redstone torch and itemredstone torch (if there is one) it should function properlyPureTryOut wrote:I now have BlockElectricTorchOn and BlockElectricTorchOff. So I don't want the ElectricTorchOff to spawn particles.
How can I do that?
Re: [1.8.1 Mod Making] Creating a new torch!
MrCreeper07 wrote:hey i got this error just renaming electric in BlockElectricTorch to BlockJiffyTorch on every one of those lines and changed the recipe and got this error
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:21: reached end of file while parsing
}
^
1 error
==================
please post your code
austin56101- Moderator
- Posts : 85
Join date : 2011-10-22
Age : 28
Location : Cali!
Re: [1.8.1 Mod Making] Creating a new torch!
ok here is the mod_BlockJiffyTorch.
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_BlockJiffyTorch extends BaseMod
{
public static final Block blockJiffyTorch =
new BlockJiffyTorch(236,0).setHardness(0.0F).setResistance(5.0F).setLightValue(1.0F).setBlockName("BlockJiffyTorch");
public mod_BlockJiffyTorch()
{
ModLoader.RegisterBlock(blockJiffyTorch);
blockJiffyTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/blockJiffyTorch.png");
ModLoader.AddName(blockJiffyTorch, "blockJiffyTorch");
ModLoader.AddRecipe(new ItemStack(blockJiffyTorch, 10), new Object[] {
" * ", Character.valueOf('*'), Block.torchWood
});
}
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
MrCreeper07 wrote:ok here is the mod_BlockJiffyTorch.
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_BlockJiffyTorch extends BaseMod
{
public static final Block blockJiffyTorch =
new BlockJiffyTorch(236,0).setHardness(0.0F).setResistance(5.0F).setLightValue(1.0F).setBlockName("BlockJiffyTorch");
public mod_BlockJiffyTorch()
{
ModLoader.RegisterBlock(blockJiffyTorch);
blockJiffyTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/blockJiffyTorch.png");
ModLoader.AddName(blockJiffyTorch, "blockJiffyTorch");
ModLoader.AddRecipe(new ItemStack(blockJiffyTorch, 10), new Object[] {
" * ", Character.valueOf('*'), Block.torchWood
});
}
Like I said... You're missing a bracket at the end.
Make it this:
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_BlockJiffyTorch extends BaseMod
{
public static final Block blockJiffyTorch =
new BlockJiffyTorch(236,0).setHardness(0.0F).setResistance(5.0F).setLightValue(1.0F).setBlockName("BlockJiffyTorch");
public mod_BlockJiffyTorch()
{
ModLoader.RegisterBlock(blockJiffyTorch);
blockJiffyTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/blockJiffyTorch.png");
ModLoader.AddName(blockJiffyTorch, "blockJiffyTorch");
ModLoader.AddRecipe(new ItemStack(blockJiffyTorch, 10), new Object[] {
" * ", Character.valueOf('*'), Block.torchWood
});
}
}
PureTryOut- Member
- Posts : 4
Join date : 2011-10-29
Re: [1.8.1 Mod Making] Creating a new torch!
oh thanks didn't see your post before! Thank you so much!!!
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
also got this error and you already know the code because PureTryOut has it.
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:4: net.minecraft.src.mod_BlockJiffyTorch is not abstract and does not override abstract method Version() in net.minecraft.src.BaseMod
public class mod_BlockJiffyTorch extends BaseMod
^
1 error
==================
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
I believe it has to be this:MrCreeper07 wrote:also got this error and you already know the code because PureTryOut has it.I know that it extends the wrong thing because this has happened before but what does it extend to?
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:4: net.minecraft.src.mod_BlockJiffyTorch is not abstract and does not override abstract method Version() in net.minecraft.src.BaseMod
public class mod_BlockJiffyTorch extends BaseMod
^
1 error
==================
- Code:
public class mod_BlockJiffyTorch extends Block
PureTryOut- Member
- Posts : 4
Join date : 2011-10-29
Re: [1.8.1 Mod Making] Creating a new torch!
then i got this error
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:13: cannot find symbol
symbol : constructor Block()
location: class net.minecraft.src.Block
{
^
1 error
==================
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
OH MY GOSH CAN SOMEONE HELP ME!!!!!! LOOK RIGHT ABOVE THIS!!! HAS THE WORLD STOPED MOVING???
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
you have to add: public String Version()
{
return "1.7.3";
}
{
return "1.7.3";
}
TheFatOne- Member
- Posts : 2
Join date : 2011-11-05
Re: [1.8.1 Mod Making] Creating a new torch!
btw can someone help me with the texture it is like derping up itself
TheFatOne- Member
- Posts : 2
Join date : 2011-11-05
Re: [1.8.1 Mod Making] Creating a new torch!
how do you make your own particle effects. if i want a blue flame how would i go about making it? in the code it just had "flame"?
cosbraa- Member
- Posts : 2
Join date : 2011-11-06
Re: [1.8.1 Mod Making] Creating a new torch!
When i craft the torch it looks like a gray square but when i place it down it's fine....?
Minecraftn00b123- Member
- Posts : 7
Join date : 2011-11-08
Re: [1.8.1 Mod Making] Creating a new torch!
yeah I got this too. He needs to add more code to it and he hasn't yetMinecraftn00b123 wrote:When i craft the torch it looks like a gray square but when i place it down it's fine....?
MrCreeper07- Member
- Posts : 18
Join date : 2011-10-23
Re: [1.8.1 Mod Making] Creating a new torch!
MrCreeper07 wrote:also got this error and you already know the code because PureTryOut has it.I know that it extends the wrong thing because this has happened before but what does it extend to?
- Code:
== ERRORS FOUND ==
src/minecraft/net/minecraft/src/mod_BlockJiffyTorch.java:4: net.minecraft.src.mod_BlockJiffyTorch is not abstract and does not override abstract method Version() in net.minecraft.src.BaseMod
public class mod_BlockJiffyTorch extends BaseMod
^
1 error
==================
oh ya dude i also got this error. it's not the jiffyTorch code thats wrong it the mod_* thats wrong! it's cause you are trying to make a 1.0/1.1 mod then you have to change the
- Code:
public string Version()
{
return "1.8.1"
}
to
- Code:
public string getVersion()
{
return "1.0/1.1"
}
pv9avenger- Member
- Posts : 8
Join date : 2012-01-31
Age : 25
Location : Iceland
Similar topics
» creating a new type of tool
» Creating your first java program!
» [1.2.3]making new tool types (example paxel)
» [CREATING MODS] Block Manipulation
» Making a Furnace-like Block
» Creating your first java program!
» [1.2.3]making new tool types (example paxel)
» [CREATING MODS] Block Manipulation
» Making a Furnace-like Block
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum