Jump to content

xxWhatsherfacex

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by xxWhatsherfacex

  1. Ah! thank you so much! That makes a lot of sense. For anyone in a similar situation, I changed it to this and it works beautifully.
  2. Hello everyone! I'm trying to implement an event where players receive an item upon eating an apple. My code works fine unless there is only one apple in hand, then It doesn't work at all. I have a feeling it's detecting the item in the player's hand after it's been eaten, and not the item being eaten itself... I've also tried: But this doesn't give the second message or the item at all. I really appreciate any help I can get on this. Sorry if this is an easy fix and I didn't catch it. Cheers!
  3. Alright! Thanks so much! I managed to successfully check the biome and detect if the player is trying to collect water with their bucket. public class BucketFillHandler { @SubscribeEvent public void onBucketFill(FillBucketEvent event) { EntityPlayer player = Minecraft.getMinecraft().player; BlockPos pos = new BlockPos(player.getPositionVector()); if (event.getWorld().getBiome(pos) == Biomes.BEACH || event.getWorld().getBiome(pos) == Biomes.OCEAN || event.getWorld().getBiome(pos) == Biomes.DEEP_OCEAN || event.getWorld().getBiome(pos) == Biomes.COLD_BEACH || event.getWorld().getBiome(pos) == Biomes.FROZEN_OCEAN || event.getWorld().getBiome(pos) == Biomes.STONE_BEACH) { if(event.getEntityPlayer() != null && !event.getWorld().isRemote) { RayTraceResult target = event.getTarget(); if(target != null && target.typeOfHit == RayTraceResult.Type.BLOCK) { if(target.getBlockPos() != null) { IBlockState state = event.getWorld().getBlockState(target.getBlockPos()); Material material = state.getMaterial(); if(material == Material.WATER && ((Integer)state.getValue(BlockLiquid.LEVEL)).intValue() == 0) { //Give the player ModItems.SALTWATER_BUCKET } } } } } } I'm a little stumped on how to give the player the bucket now. I tried using event.setFilledBucket(new ItemStack(ModItems.SALTWATER_BUCKET, 1)); where the comment is but it isn't doing anything but giving the regular bucket of water.
  4. I'm trying to make it so when a player stands in an ocean or beach biome and tries to fill a bucket with water, it instead gives a different item (SaltwaterBucket). I think I have to do this in an event handler class and the FullBucketEvent? Or would I accomplish this in my Item class? I'm a little stumped on what to do specifically though. Any pointers would be really appreciated! public class BucketFillHandler { @SubscribeEvent public void onBucketFill(FillBucketEvent event) { //Check for Ocean Biome and give player either saltwaterbucket or regular bucket. } }
  5. Oh wow! I think I implemented all those changes correctly. Here is the updated code. Things seem a lot simpler now, thanks! It seems pretty silly for people to teach it the other way. Haha. Using the Item to place the block seems to be working well now too!
  6. Oof. I'm real sorry. My Github was a mess. (I'd just uploaded those two files to an outdated version of my code.) It's up to date now. I think I've fixed one problem and caused another... I started from scratch again and it seems like the model is working. But when I try to place it with the Item. I get a CTD, with the error:
  7. I removed it but nothing seems to have changed.
  8. I've scoured my console and couldn't find anything relating to textures or models, unfortunately.
  9. Hello there! I'm messing around with how to make a double block, and I've gotten to the point where the model isn't showing up correctly. I've been looking this over for about an hour trying to figure it out. I ran my blockstate JSON through a validator and it came back okay...Is there a glaringly obvious issue that I missed here? Thanks! doubleblock.json (Located in assets/yummy/blockstates) { "variants": { "facing=east,half=lower": { "model": "yummy:PresserModelLower", "y": 90 }, "facing=south,half=lower": { "model": "yummy:PresserModelLower", "y": 180 }, "facing=west,half=lower": { "model": "yummy:PresserModelLower", "y": 270 }, "facing=north,half=lower": { "model": "yummy:PresserModelLower" }, "facing=east,half=upper": { "model": "yummy:PresserModelUpper", "y": 90 }, "facing=south,half=upper": { "model": "yummy:PresserModelUpper", "y": 180 }, "facing=west,half=upper": { "model": "yummy:PresserModelUpper", "y": 270 }, "facing=north,half=upper": { "model": "yummy:PresserModelUpper" } } } Here are the PresserModelUpper and PresserModelLower.
  10. I'm having some trouble with a custom block model I made using Ichun's Tabula. As per the screenshot included, the block is offset. I'm not exactly sure what the fix is, but I've narrowed it down to the .json file...(I think?) Any help would be greatly appreciated. I'm pretty stumped right now. Thanks! ❤️
  11. I was following a tutorial and I understand the content of it I'm just getting different results then shown. I'm trying to learn what it does, the best way I know is by trial and error. I can only figure out so much by myself, so that's why I ask questions like this.
  12. Oops! Sorry i knew i was forgetting something. i'll add it to the top right now.
  13. When I enter the creative tab the game crashes. CrashReport package com.rnh.Yummy.Trees.Logs; import java.util.List; import com.rnh.Yummy.Yummy; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; public class Log extends BlockLog{ public static final String[] logs = new String[] { "Apple", "banana"}; @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tabs, List list){ for (int i = 0; i < logs.length; i++) { list.add(new ItemStack( item ,1 ,i)); } } @SideOnly(Side.CLIENT) public void registerBLockIcons ( IIconRegister icon){ this.field_150167_a = new IIcon[logs.length]; this.field_150166_b = new IIcon[logs.length]; for (int i = 0; i < this.field_150167_a.length; i++){ this.field_150167_a[i] =icon.registerIcon(Yummy.MODID + this.getTextureName() + logs[i]); this.field_150166_b[i] =icon.registerIcon(Yummy.MODID + this.getTextureName() + logs[i] + "top"); } } } and heres my ItemBlock Class package com.rnh.Yummy.ItemBlocks; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemLogBlocks extends ItemBlock { public static final String[] logs = new String[]{"Apple","Banana"}; public ItemLogBlocks(Block block) { super(block); this.setHasSubtypes(true); } public String getUnlocalizedName(ItemStack itemstack) { int i = itemstack.getItemDamage(); if ( i < 0 || i >= logs.length){ i = 0; } return super.getUnlocalizedName() + "." + logs[i]; } public int getMetadata (int meta){ return meta; } } I would really appreciate is someone explained what went wrong here, and taught me the right way to do it. Please forgive me if I seem incompetent. I'm still learning. Thank you. <3
  14. Is there a way to prevent crafting with a milk bucket giving you back a bucket? my code is GameRegistry.addShapelessRecipe(new ItemStack(YummyChocolateStuff.milkchocolatebucket), new Object[]{Items.sugar, Items.milk_bucket, YummyChocolateStuff.CocoaLiquor, YummyChocolateStuff.cocoabutter.setContainerItem(Items.bowl)});
  15. I got it to work! Thank you so much for your help. public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { player.dropPlayerItemWithRandomChoice(new ItemStack(Items.apple, 1, 0), true); return new ItemStack(Items.Stick); }
  16. with something like this? (!player.inventory.addItemStackToInventory(new ItemStack(Items.apple)))
  17. I am trying to make it so when you right click with a certain Item it removes said item and replaces it with two others. I've only been able to make it return one item, I would be very grateful if someone explained how I can make it work if possible, or help me figure out an alternative. Thank you! Example public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { return new ItemStack(Items.Stick); }
  18. I'm trying to fit the .onEaten and returnItemstack between the "YellowApple= new ItemFood()" and the Gameregistry. Sorry I misunderstood.
  19. Well I got it to work using the minecraft ItemSoup class as a model. I am just wondering if there's a way to do that without having the item as its own class. is that even possible or am I wasting my time trying to do something silly?
  20. With the way I have my code set up, I have all of my items in one class. public class YummyItems { public static Item redappleslice; public static Item redapplecore; public static Item YellowApple; public static Item yellowappleslice; public static Item yellowapplecore; public static Item greenapple; public static Item greenappleslice; public static Item greenapplecore; public static final void init() { redappleslice = new ItemFood(1, 0.3f, false) .setUnlocalizedName("RedAppleSlice") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "appleslice"); GameRegistry.registerItem(redappleslice, "redappleslice"); redapplecore = new Item() .setUnlocalizedName("RedAppleCore") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "applecore"); GameRegistry.registerItem(redapplecore, "redapplecore"); YellowApple= new ItemFood(4, 0.3f, false) .setUnlocalizedName("YellowApple") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "YellowApple"); GameRegistry.registerItem(YellowApple,"YellowApple"); yellowappleslice = new ItemFood(1, 0.3f, false) .setUnlocalizedName("YellowAppleSlice") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "yellowappleslice"); GameRegistry.registerItem(yellowappleslice, "YellowAppleSlice"); yellowapplecore = new Item() .setUnlocalizedName("YellowAppleCore") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "yellowapplecore"); GameRegistry.registerItem(yellowapplecore, "YellowAppleCore"); greenapple = new ItemFood(4, 0.3f, false) .setUnlocalizedName("GreenApple") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "greenapple"); GameRegistry.registerItem(greenapple,"GreenApple"); greenappleslice = new ItemFood(1, 0.3f, false) .setUnlocalizedName("GreenAppleSlice") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "greenappleslice"); GameRegistry.registerItem(greenappleslice, "GreenAppleSlice"); greenapplecore = new Item() .setUnlocalizedName("GreenAppleCore") .setCreativeTab(Yummy.tabYummyIngredients) .setTextureName(Yummy.MODID + ":" + "applecore"); It it possible with my setup to give the player an item on eaten without creating a new class specifically for each item?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.