Help for Java 1.8 Modding

Status
This thread has been locked.

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
I am Requesting help for java 1.8 modding. I am currently trying to make a pickaxe break a 3x3 area but i can not seem to find the code. If you have ideas or suggestions PM me or reply!

--
Thanks,
Charles (Java Town Owner)
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
package com.idtech.item;

import com.idtech.BaseMod;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

public class ItemGelPickaxe extends ItemPickaxe {

public static final String name = "GelPickaxe";


protected ItemGelPickaxe() {
super(ItemMod.toolMaterialGel);
// TODO Auto-generated constructor stub
setUnlocalizedName(BaseMod.MODID + "_" + name);
this.setCreativeTab(CreativeTabs.tabTools);
}

}
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
}

/* public boolean onBlockDestroyed(ItemStack stack, World w, int id, int x, int y, int z, EntityLiving entity){
super.onBlockDestroyed(stack, w, null, null, entity);
for( i in range(-1,2))
for j in range(-1,2) w.destroyBlock(x+i,y,z+j,true);
return true;
}*/
[DOUBLEPOST=1467322309][/DOUBLEPOST]
package com.idtech.item;

import com.idtech.BaseMod;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

public class ItemGelPickaxe extends ItemPickaxe {

public static final String name = "GelPickaxe";


protected ItemGelPickaxe() {
super(ItemMod.toolMaterialGel);
// TODO Auto-generated constructor stub
setUnlocalizedName(BaseMod.MODID + "_" + name);
this.setCreativeTab(CreativeTabs.tabTools);
}

}
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
}

/* public boolean onBlockDestroyed(ItemStack stack, World w, int id, int x, int y, int z, EntityLiving entity){
super.onBlockDestroyed(stack, w, null, null, entity);
for( i in range(-1,2))
for j in range(-1,2) w.destroyBlock(x+i,y,z+j,true);
return true;
}*/
Show your current code?
 

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
Code:
for( int x = -1 ; x<= 1 ; ++x) {
    for( int y = -2 ; y <= 0 ; ++ y) {
        for( int z = -1 ; z <= 1 ; ++ z ) {
       //continue
This gets a 3x3x3 area.
Where would this go in the code? sorry still new at this codding stuff. :-( If It works ill give a vouch!
 

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
That'd go where you want to call the action of breaking the blocks, replace the "//continue" with the actual action. The "X","Y","Z" would be the location of each block within the 3x3 area. I may have explained the beginning in a bad way, if you do not understand I'll try to re-explain
Here is my code now where do the code go? and what exactly do?
package com.idtech.item;

import com.idtech.BaseMod;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

public class ItemGelPickaxe extends ItemPickaxe {

public static final String name = "GelPickaxe";


protected ItemGelPickaxe() {
super(ItemMod.toolMaterialGel);
// TODO Auto-generated constructor stub
setUnlocalizedName(BaseMod.MODID + "_" + name);
this.setCreativeTab(CreativeTabs.tabTools);
}


}




}
 

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
I agree with the above statement, I won't tell you exactly where, you'll have to figure that part out yourself. Goodluck let me know if you need anything else to be explained.
i dont understand "That'd go where you want to call the action of breaking the blocks, replace the "//continue" with the actual action. The "X","Y","Z" would be"
 

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
Since this is not Spigot, but MC-Market. Ignore what Mat said about spoonfeeding, it's allowed here.

In order to break a 3x3x3 area, I suppose you want a 3x3x3 area (x y z, if not just remove a value) you would have to go with something like the following;

Code:
public boolean onBlockDestroyed(ItemStack stack, World w, int id, int x, int y, int z, EntityLiving entity) {
for(x = -1; x<= 1;++x) {
for(y = -2;y<=0;++y) {
  for(z=-1;z<=1;++z) {
   w.destroyBlock..
  }
}
}

Done without iDE.

I remember that in forge there is something called BreakEvent. Why don't you just use that, then check if the item is a 'GelPickaxe' and then break the 3x3 area?
Thanks ill let you know if it works!
 

Gamerframed

Feedback score
0
Posts
52
Reactions
3
Resources
0
In 1.8 the onBlockDestroyed method has changed to:
Code:
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
return false;
}

Make sure to add an '@Override' tag to the method, in the end it should look like this:
Code:
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
return false;
}
still not working here is my new file
package com.idtech.item;

import com.idtech.BaseMod;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

public class ItemGelPickaxe extends ItemPickaxe {

public static final String name = "GelPickaxe";



protected ItemGelPickaxe() {
super(ItemMod.toolMaterialGel);
// TODO Auto-generated constructor stub
setUnlocalizedName(BaseMod.MODID + "_" + name);
this.setCreativeTab(CreativeTabs.tabTools);

}

@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
return false;
}



}
[DOUBLEPOST=1467387045][/DOUBLEPOST]
In 1.8 the onBlockDestroyed method has changed to:
Code:
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
return false;
}

Make sure to add an '@Override' tag to the method, in the end it should look like this:
Code:
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
return false;
}
any ideas?[DOUBLEPOST=1467388005][/DOUBLEPOST]Any help? Bump
 
Last edited:

Skionz

ogminecraft.com
Premium
Feedback score
1
Posts
1,544
Reactions
1,527
Resources
0
Since this is not Spigot, but MC-Market. Ignore what Mat said about spoonfeeding, it's allowed here
In order to break a 3x3x3 area, I suppose you want a 3x3x3 area (x y z, if not just remove a value) you would have to go with something like the following;

Code:
public boolean onBlockDestroyed(ItemStack stack, World w, int id, int x, int y, int z, EntityLiving entity) {
for(x = -1; x<= 1;++x) {
for(y = -2;y<=0;++y) {
  for(z=-1;z<=1;++z) {
   w.destroyBlock..
  }
}
}

Done without iDE.

I remember that in forge there is something called BreakEvent. Why don't you just use that, then check if the item is a 'GelPickaxe' and then break the 3x3 area?
Spoonfeeding is allowed on Spigot as well it is just frowned upon for good reason too. You aren't teaching him anything when you write code for him.
 
Status
This thread has been locked.
Top