-
Posts
10 -
Joined
-
Last visited
Everything posted by WimpyLlama
-
I know this is a dumb question but I am making an item that is kinda like a bucket. It places water where you are looking when you right click and my problem is that right now it only places the block 1 block above where you click, and I want it to act like a bucket and place it how a bucket would. Please help me! Here is my code. package wimpyllama.wimprimstuff.items; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import wimpyllama.wimprimstuff.Reference; import wimpyllama.wimprimstuff.init.ModItems; public class ItemLavaOrb extends Item{ public ItemLavaOrb(String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); } public EnumActionResult onItemUseFirst(ItemStack itemStack, EntityPlayer entity, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { float var4 = 1.0F; int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); world.setBlockState(new BlockPos(i, j + 1, k), Blocks.FLOWING_LAVA.getDefaultState(), 3); if (entity instanceof EntityPlayer) ((EntityPlayer) entity).inventory.clearMatchingItems(ModItems.lavaOrb, -1, 1, null); return EnumActionResult.PASS; } }
-
I do know a bit of JAVA and from what other people have told me is with minecraft modding it's best to just learn how to mod not learn JAVA. And yes, I did make a block, here is my code. package wimpyllama.wimprimstuff.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import wimpyllama.wimprimstuff.Reference; public class BlockRootBlock extends Block { public BlockRootBlock(String unlocalizedName) { super(Material.GROUND); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); this.setHardness(0.5f); this.setResistance(0); this.setSoundType(SoundType.GROUND); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(this); } }
-
I am making a block called Root Block and I want it to do the same things as a dirt block, except for plating crops but I want to be able to plant saplings on it. I can't figure out how to do this. Please Help! NOTE: I am new to modding so please tell me where to put whatever code you might send and what it does, please.
-
I am learning java. I don't use mcreator anymore but it is useful for learning how to do things if you look at the code. I am still coding my mod by myself I just used a bit of mcreators code.
-
Never mind, I figured it out by opening mcreator and making the item in there then I copied some of the code and edited it to my liking.
-
I don't understand what Item::rayTrace means. All I need is to create an if statement that tests if the player is looking at a grass block. if(blockAtPlayerCross == Blocks.GRASS) is what I'm trying to do but I don't know the real statement. I have looked on youtube and google and I can't find anything.
-
I thought you did. Whatever, just if you could help me that would be nice.
-
Basically, if you could just tell me where to put the code and what it does, that would be great.
-
As I said, I am new to modding. I don't understand what this is. And I don't want to update to 1.12.2 because most modpacks, including the one I am making, are for 1.10.2 so I just rather make it for 1.10.2 for now and maybe update it in the future.
-
I am working on a 1.10.2 mod and I need help. NOTICE: I am new at modding! What I am trying to do is create an item that tests if you are looking at a grass block when you right click with it. And if you are looking at a grass block a piece of cobblestone appears. And the item only has 64 uses. I have some code for the item that I got from a tutorial on a heart that heals you. I am trying to base my code on this but I can't figure out what to do. Please help! package wimpyllama.wimprimstuff.items; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import wimpyllama.wimprimstuff.Reference; import wimpyllama.wimprimstuff.util.Utils; public class ItemSifter extends Item{ public ItemSifter(String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); } @Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { if(player.getHealth() < player.getMaxHealth()) { player.heal(4); int damageToBe = player.getHeldItem(hand).getItemDamage() + 1; if(damageToBe > 4) { player.getHeldItem(hand).stackSize--; } else { player.getHeldItem(hand).setItemDamage(player.getHeldItem(hand).getItemDamage() + 1); } } return super.onItemRightClick(stack, world, player, hand); } }