For my computer science class I'm making a Fortnite Minecraft copy, I am making a gun that is pretty simple and I want the gun to destroy a certain block type which I make myself when the arrow from the gun hits the block. How would I go about doing this?
This is my code so far
GUN CODE
package tealsmc.mods.items;
import java.util.Random;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class FortnitePistol extends Item {
public FortnitePistol() {
setCreativeTab(CreativeTabs.tabTools);
this.setFull3D();
this.setMaxStackSize(1);
this.setMaxDamage(10);
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, 1.0F);
par2World.spawnEntityInWorld(var8);
return par1ItemStack;
}
}
BLOCK CODE
package tealsmc.mods.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class FortniteWood extends Block{
public FortniteWood(Material mat) {
super(mat);
setCreativeTab(CreativeTabs.tabBlock);
}
}
I am also using the TEALS educational modpack but it is just Forge, just to clear up any confusion on the package.