
Justin_Perry
Members-
Posts
27 -
Joined
-
Last visited
Everything posted by Justin_Perry
-
Alright, I give up on modding, thanks guys.
-
I was looking at how to use onItemUse, nothing more.
-
I was googling what other people used to execute a function when an item was right clicked. I found some old information and tried to incorporate it in 1.12. Apparently, it did not work. I found a youtube video that used the ActionResult<ItemStack> other than that, I was at a loss. I found no information that would have lead me to EnumActionResult. I have since implemented what DavidM suggested and it works.
-
Telling me I don't know how to override is a complete insult. I have at least an item that heals others. I obviously had to override to do that. The issue is mostly the lack of forge documentation for low-level modders to look into. I have learned Python, taken C++ courses, and learned a moderate amount of Java.
-
I would rather have a lesser understanding of java on my own than continue to be ridiculed. I searched high and low on information on onItemUse, while your eventual solution may have worked, you have made me really discouraged from asking for more help. I haven't learned everything in Java, no. But I do know how to make classes, variables, functions, and a bit more. Again, I appreciate your help, but you are not a nice person. Please refrain from talking to me anymore.
-
Alright, thank you for nothing. I will figure everything else I'll need to make this mod by myself or by reading. Thanks
-
Something that may be easy for you to understand and interpret can be hard for others. I have checked my parameters. public class stimSelf extends Item implements IHasModel { public stimSelf(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MISC); modItems.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } @Override public ActionResult<ItemStack> onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { if (player.getHealth() < player.getMaxHealth()) { System.out.println("We healed."); player.setHealth(player.getHealth() + 5.0F); player.getCooldownTracker().setCooldown(modItems.STIM_SELF, 300); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); }else { System.out.println("We have not healed."); return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack); } } } You tell me.
-
Not very helpful.
-
public class stimSelf extends Item implements IHasModel { public stimSelf(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MISC); modItems.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } @Override public ActionResult<ItemStack> onItemUse(ItemStack itemStack, World world, EntityPlayer player) { if (player.getHealth() < player.getMaxHealth()) { System.out.println("We healed."); player.setHealth(player.getHealth() + 5.0F); player.getCooldownTracker().setCooldown(modItems.STIM_SELF, 300); }else { System.out.println("We have not healed."); } return null; } } I have no output. Can you help? Warning: The method onItemUse(ItemStack, World, EntityPlayer) of type stimSelf must override or implement a supertype method. Thank you.
-
I am trying to have my item heal when the player right clicks with it out. How should I go about this? Thank you. I realize I know how to increase the health, add a cooldown, I'm familiar with getting health, setting health. I would use itemInteractionForEntity however, I do not know how to heal without interacting with an entity which may be compromising in an intense fight.
-
Sorry for being so vague, I am just trying to accomplish one thing with the easiest route. I think avoiding ray tracing is the way to go. I particularly like constant health bar or hearts above the entities while in range. I am looking into RenderLivingEvent. Thank you
-
Thank you for your useless comment. I am not asking for code as you can clearly see, so I will reply to whoever is attempting to assist me when I get past a certain stage asking for more clarification and guidance. I am taking guidance and putting my spin on it. I understand there are mods that do this, I am attempting to make one big mod for my friends and I, instead of downloading many mods that others have created. I have a friend who particularly does not like mods simply because they do not blend well and that is what I am here to accomplish. I appreciate your assistance, however, it is anything but. Have a great day.
-
I have created a basic gui that displays text on the screen. How should I go about getting an entities health when the player hovers over them? If not hover, how can I make health permanently show?
-
I want to create health bars and I need guidance to how I should go about this. Thank you.
-
[Solved]1.12 Creating New Harvest Levels?
Justin_Perry replied to Justin_Perry's topic in Modder Support
I corrected my issue yesterday by including the new ore blocks into the effective-on set within Minecraft and including them within the exceptions list for harvest levels. Thank you all for being helpful and not getting frustrated by my stupidity. -
Hello, I have been trying to create a healing event that heals living entities when right-clicked with a certain item. However, when the character right clicks with the item, nothing occurs, that I can see. package Justin_Perry.learningMod.EventHandlers; import Justin_Perry.learningMod.init.modItems; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.play.server.SPacketCombatEvent.Event; public class MedicEvents { public boolean onRightClickHeal(ItemStack itemStack, EntityPlayer player, EntityLivingBase target) { if (player.getHeldItemMainhand().getItem() == modItems.FAIRY_DUST && target.getHealth() < target.getMaxHealth()) { System.out.println(target.getHealth()); target.setHealth(target.getHealth() + 2.0F); System.out.println(target.getHealth()); return true; }else { return false; } } } Thank you for your time today.
-
[Solved]1.12 Creating New Harvest Levels?
Justin_Perry replied to Justin_Perry's topic in Modder Support
Alright, so I have set the materials, their harvest levels as well as the blocks and their harvest levels. However, a bronze pick can mine every block. Any suggestions? Here is some code: package Justin_Perry.learningMod.init; import java.util.ArrayList; import java.util.List; import Justin_Perry.learningMod.items.hammer; import Justin_Perry.learningMod.items.itemBase; import Justin_Perry.learningMod.items.armor.armorBase; import Justin_Perry.learningMod.items.tools.ModPickaxe; import Justin_Perry.learningMod.items.tools.ToolPickaxe; import Justin_Perry.learningMod.util.Reference; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraftforge.common.util.EnumHelper; public class modItems { public static final List<Item> ITEMS = new ArrayList<Item>(); //Materials public static final ToolMaterial MATERIAL_BRONZE = EnumHelper.addToolMaterial("material_bronze", 2, 300, 7.0F, 1.5F, 14); public static final ToolMaterial MATERIAL_FAIRY = EnumHelper.addToolMaterial ("material_fairy", 2, 325, 7.5F, 2.0F, 14); public static final ToolMaterial MATERIAL_MITHRIL = EnumHelper.addToolMaterial("material_mithril", 2, 350, 8.0F, 2.5F, 14); public static final ToolMaterial MATERIAL_ADAMANT = EnumHelper.addToolMaterial("material_adamant", 4, 2019, 8.5F, 3.0F, 10); public static final ToolMaterial MATERIAL_RUNE = EnumHelper.addToolMaterial("material_rune", 5, 2500, 9.0F, 3.5F, 10); public static final ToolMaterial MATERIAL_HERMANITE = EnumHelper.addToolMaterial("material_hermanite", 6, 3000, 9.5F, 4.0F, 12); //Items public static final Item COPPER_INGOT = new itemBase("copper_ingot"); public static final Item COPPER_DUST = new itemBase("copper_dust"); public static final Item TIN_INGOT = new itemBase("tin_ingot"); public static final Item TIN_DUST = new itemBase("tin_dust"); public static final Item BRONZE_INGOT = new itemBase("bronze_ingot"); public static final Item BRONZE_DUST = new itemBase("bronze_dust"); public static final Item FAIRY_DUST = new itemBase("fairy_dust"); public static final Item FAIRY_INGOT = new itemBase("fairy_ingot"); public static final Item MITHRIL_DUST = new itemBase("mithril_dust"); public static final Item MITHRIL_INGOT = new itemBase("mithril_ingot"); public static final Item ADAMANTITE_INGOT = new itemBase("adamantite_ingot"); public static final Item ADAMANTITE_DUST = new itemBase("adamantite_dust"); public static final Item RUNITE_INGOT = new itemBase("runite_ingot"); public static final Item RUNITE_DUST = new itemBase("runite_dust"); public static final Item HERMANITE_INGOT = new itemBase("hermanite_ingot"); public static final Item HERMANITE_DUST = new itemBase("hermanite_dust"); public static final Item HAMMER = new hammer("hammer"); //Tools public static final ModPickaxe BRONZE_PICKAXE = new ToolPickaxe("bronze_pickaxe", modItems.MATERIAL_BRONZE); public static final ModPickaxe FAIRY_PICKAXE = new ToolPickaxe("fairy_pickaxe", modItems.MATERIAL_FAIRY); public static final ModPickaxe MITHRIL_PICKAXE = new ToolPickaxe("mithril_pickaxe", modItems.MATERIAL_MITHRIL); public static final ModPickaxe ADAMANTITE_PICKAXE = new ToolPickaxe("adamantite_pickaxe", modItems.MATERIAL_ADAMANT); public static final ModPickaxe RUNITE_PICKAXE = new ToolPickaxe("runite_pickaxe", modItems.MATERIAL_RUNE); public static final ModPickaxe HERMANITE_PICKAXE = new ToolPickaxe("hermanite_pickaxe", modItems.MATERIAL_HERMANITE); //Armor } and package Justin_Perry.learningMod.blocks; import java.util.ArrayList; import Justin_Perry.learningMod.init.modBlocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class adamantiteOre extends blockBase { public adamantiteOre(String name, Material material) { super(name, material); setSoundType(SoundType.STONE); setHardness(4.0F); setResistance(5.0F); setHarvestLevel("pickaxe", 3); } @Override public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState blockstate, int fortune){ ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); drops.add(new ItemStack(modBlocks.ADAMANTITE_ORE_BLOCK, 1)); return drops; } } -
I want to create harvest levels greater than what exists and one in-between. I have added a new material, adamant. This material is supposed to be better than diamond but only minable by diamond. How can I make the adamant ore a higher harvest level than diamond? I'm sorry if this is super simple, sometimes my brain does not work right.
-
I am attempting to create copper dust with copper ore and a hammer. Yet, I cannot find anywhere that illustrates this idea. I am not concerned with the durability of the hammer. I just want to keep the hammer from being consumed in the process. Thank you.
-
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
While I appreciate the feedback on my naming, that's not what I am asking help on. The code is not fine, it does not do what I intended. I am aware of my naming and misuse of convention, but I strictly kept it that way and made myself well aware of non-capitalization and wording. Take care. -
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
After today I will be educating myself in Java. I have one last request that someone look at my code and give me some final advice. Thanks. package Justin_Perry.learningMod.gen; import java.util.Random; import Justin_Perry.learningMod.init.modBlocks; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenPumpkin; public class nestGen extends WorldGenPumpkin{ @Override public boolean generate(World worldIn, Random rand, BlockPos position) { for (int i = 0; i < 64; ++i) { BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(7), rand.nextInt(4) - rand.nextInt(3), rand.nextInt(8) - rand.nextInt(7)); if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS && modBlocks.BEE_NEST_BLOCK.canPlaceBlockAt(worldIn, blockpos)) { worldIn.setBlockState(blockpos, modBlocks.BEE_NEST_BLOCK.getDefaultState(), 2); } } return true; } } I am calling it in PreInit as @EventHandler public static void PreInit(FMLPreInitializationEvent event) { new nestGen(); } -
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
Nevermind, I found it, thank you! -
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
how do I locate the worldgenpumpkin class? -
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
I appreciate the help but by using WorldGenPumpkin I am only spawning in more pumpkins. -
Generating Block on Surface Not Working
Justin_Perry replied to Justin_Perry's topic in Modder Support
I can find no documentation on generating blocks on the surface of the overworld.