Hey everyone, been making an electric fence mod, and had to fix at least 20 errors so far. finally fixing them all, The block FINALLY shows up as a fence in the inventory. All damage is set (by copying cactus damage and setting a source for damage in DamageSource as well as BlockeFence.java (selfmade). Also, sometimes I accidentally navigated and changed the minecraft_server src instead. but i fixed it. This MAY have something to do with it?
I placed the electric fence block, and everything crashes. heres the crash report:
java.lang.ClassCastException: net.minecraft.src.BlockeFence cannot be cast to net.minecraft.src.BlockFence
at net.minecraft.src.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:181)
at net.minecraft.src.WorldRenderer.updateRenderer(WorldRenderer.java:152)
at net.minecraft.src.RenderGlobal.updateRenderers(RenderGlobal.java:1125)
at net.minecraft.src.EntityRenderer.renderWorld(EntityRenderer.java:779)
at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:653)
at net.minecraft.client.Minecraft.run(Minecraft.java:517)
at java.lang.Thread.run(Unknown Source)
Here is all my coding for each java file:
BlockeFence.java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
public class BlockeFence extends Block
{
public BlockeFence(int i, int j)
{
super(i, j, Material.wood);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
if(world.getBlockId(i, j - 1, k) == blockID)
{
return true;
}
if(!world.getBlockMaterial(i, j - 1, k).isSolid())
{
return false;
} else
{
return super.canPlaceBlockAt(world, i, j, k);
}
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return AxisAlignedBB.getBoundingBoxFromPool(i, j, k, i + 1, (float)j + 1.5F, k + 1);
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 11;
}
public boolean iseFenceAt(IBlockAccess iblockaccess, int i, int j, int k)
{
int l = iblockaccess.getBlockId(i, j, k);
return l == blockID || l == Block.fenceGate.blockID;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
{
entity.attackEntityFrom(DamageSource.efence, 2);
}
}
The two sections in Block.java:
public static final Block efence;
efence = (new BlockeFence(126, 1)).setHardness(2.0F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("eFence");
Then the line entered in on DamageSource.java
public static DamageSource efence = new DamageSource("efence");
And finally CraftingManager (where most of my problems are from?)
But, there should be a way to do it without that. All I'm trying to do is make a damaging block and that is not working. Do you know any way to fix it?
public boolean iseFenceAt(IBlockAccess iblockaccess, int i, int j, int k)
{
int l = iblockaccess.getBlockId(i, j, k);
return l == blockID || l == Block.fenceGate.blockID;
}
could be this code messing everything up.
I actually did get rid of that, but that didn't help. i also actually just reamed everything with the name of BlockeFence to Blockefence, and eFence to efence. Stll gettnig everything normal, but Perhaps I should change it back to normal, so no confusion happens. I think i know what the problem is. This is probably what:
I am at the moment. Taking a peek in World, WorldRender, Render, BlockFence, Block, Entity, EntityList, and some stuff. Any suggestions on where to look? by the way, thanks so much for your help already.
I FOUND IT! YAY! Now i need to decompile and test, and cross my fingers and hope. :3
EDIT: Aw man, didn't work. Its because i forgot a whole other half. lol. Copy-pasted the fence's other half, and renamed all BlockFence to BlockeFence and Blockfence to Blockefence.
should work now. Now, I SHALL REPEAT.
EDIT2: I repeated, fixed, as it didn't work, all because i forgot one 'e', AND SHALL REPEAT AGAIN!
EDIT3: Repeated again, ALSO didn't work. Starting to get annoyed.
Now i have to replace all iseFence at with isFence at like it used to be. Says, unknowsn symbol. :sad.gif:
EDIT4: finished that, now hoping that this will FINALLY be done with. I SHALL repeat again...
EDIT5: didnt work AGAIN. *sigh* im going to leave it alone for a while.
It is purposefully BlockeFence, because eFence is the name of my block.
I know how to spell. :tongue.gif: most important part of modding.
Anyone have any more ideas?
I placed the electric fence block, and everything crashes. heres the crash report:
Here is all my coding for each java file:
BlockeFence.java
The two sections in Block.java:
Then the line entered in on DamageSource.java
And finally CraftingManager (where most of my problems are from?)
I think i MAY have accidentally edited the BlockFence.java. I'll check.
NOPE
In my mod, I have a couple of recipes that don't use all three ""'s, and I'm fine.
That's where the problem is, according to the error message.
It has something to do with BlockeFence extending BlockFence, I think
I actually did get rid of that, but that didn't help. i also actually just reamed everything with the name of BlockeFence to Blockefence, and eFence to efence. Stll gettnig everything normal, but Perhaps I should change it back to normal, so no confusion happens. I think i know what the problem is. This is probably what:
EDIT: Aw man, didn't work. Its because i forgot a whole other half. lol. Copy-pasted the fence's other half, and renamed all BlockFence to BlockeFence and Blockfence to Blockefence.
should work now. Now, I SHALL REPEAT.
EDIT2: I repeated, fixed, as it didn't work, all because i forgot one 'e', AND SHALL REPEAT AGAIN!
EDIT3: Repeated again, ALSO didn't work. Starting to get annoyed.
Now i have to replace all iseFence at with isFence at like it used to be. Says, unknowsn symbol. :sad.gif:
EDIT4: finished that, now hoping that this will FINALLY be done with. I SHALL repeat again...
EDIT5: didnt work AGAIN. *sigh* im going to leave it alone for a while.
Blocke != Block
Blocke
Somewhere you are casting incorrectly, you typed BlokeFence instead of BlockFence. Your original source should work otherwise.
I know how to spell. :tongue.gif: most important part of modding.
Anyone have any more ideas?