Jump to content

wuppy29

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by wuppy29

  1. For a mod I'm making I want the player to spawn an EntityThrowable when the player right clicks and has a full set of a certain type of armor on. I've tried using PlayerInteractEvent, but the RIGHT_CLICK_AIR action, which is the one I mostly need to use, only runs on the client and not on the server. An EntityThrowable will only work normally when it's spawned on the server though so PlayerInteractEvent doesn't seem to work for me. Another Event I found is InputEvent.MouseInputEvent. However, there doesn't seem to be any way to figure out which kind of mouse input (right click) it is nor do I see a way to find out which player right clicked. Is there some kind of method in EntityPlayer I could use to record right clicks or is there an event I'm missing?
  2. In this modding series I will cover anything from not even having JDK and knowing no code at all to being able to create new blocks, entities etc. in minutes. Before asking questions For a while now I have been getting the same questions over and over again. I do like helping you guys, but explaining the same thing 50 times is a bit annoying. Another big problem is that people say things like "my item isn't working" which is very hard to fix, because I don't see any files nor do I know what is the problem. That is why from now on you will have to do this before asking for fixes: 1. Read through the TroubleShooter to see if it's a common problem. 2. If your problem is not on the TroubleShooter read through the error log if you have one. In the error log you should see some helpfull information. When I have problems in my mod I can fix them 50% of the time with the error log. 3. Take some time between having a problem and asking the question. If I have a problem in my mod and the error log doesn't help me I just quit and start doing something else for a while. There is a big chance you will think of a way to fix it. 4. If you really can't figure it out on your own you should locate the problem. Simply do this by commenting out (using // for one line or /* */ for everything in between those things) to see what is causing the problem. 5. Now you will have to start writing something on this page. The first thing you do is paste in all the code I will need, which is the erroring code. For example if you have an item which doesn't work I need the item file, but also the mod file. Paste the code on here by using the blue <> tags. Also make sure the code is in spoilers by using 6. If you get an error log add the full thing in there. Make sure you do 7. Next up explain what it is doing right now and what you want it to do. 8. Check to make sure your post looks something like this. " I have got a problem with my mod. This is the code I have. This is the error log I got (if you actually got one) Right now it is doing: ..... I want it to do: ...... " Donations If you like these tutorials please consider donating by clicking the image below. https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif[/img] Minecraft 1.7 Get more tutorials out by supporting me on Patreon: http://www.patreon.com/wuppy29 Video Tutorials - Basic Set up - Basic File - Creating your own mod: Basic Setup - Creating your own mod: Advanced Setup - Updating 1.6 to 1.7 Part 1: Blocks and Items - Updating 1.6 to 1.7 Part 2: Generation, Recipes and Names Livestream videos - Setup and Basic File - Blocks - Items - Block Customization - Tools Part 1: Pickaxe and ToolMaterial - Recipes - Tools Part 2: Adding additional tools - Armor Part 1 - Armor Part 2 - Code organization + Finishing it up Text Tutorials - Updating 1.6 to 1.7 Part 1: Modfile and Recipes - Updating 1.6 to 1.7 Part 2: Names - Updating 1.6 to 1.7 Part 3: Blocks - Updating 1.6 to 1.7 Part 4: Items - Updating 1.6 to 1.7 Part 5: World Generation Basics - Set up Part 1: JDK & Eclipse - Set up Part 2: Forge Setup - Basic File Part 1: Package and Import - Basic File Part 2: @Mod - Basic File Part 3: Classes and Keywords - Basic File Part 4: @EventHandler and more - Creating your own mod - Crafting recipes Other - Updating Forge - Releasing your own Mod - IRC #minecraftforge tutorial Eclipse tricks - Line numbers - Auto Complete - Code Formatting - Importing - Navigation - Renaming variables Other languages German Tutorials (Thanks to HyCraftHD) - Set up - Basic File - Crafting Recipes - Shapeless Recipes and Smelting - Items - Blocks - Creative Tabs - OnItemRightClick - Achievements - Releasing your mod - Welt Generation - Eigene Brennstoffe - Farbgestaltung - Drops & Harvestlevel Spanish Tutorials (Thanks to Periyo) - Actualizar a la version 1.7 desde la 1.6 Parte 1 : Archivo principal del mod (Modfile) Portuguese Tutorials (Thanks to Luke) - CONFIGURAÇÃO PARTE 1: JDK & Eclipse Traditional Chinese Tutorials (Thanks to GKB) - 設置篇 Part 1: JDK 和 Eclipse - 設定 Part 2a: Forge基本設定 - 設置篇 Part 2b: Forge進階設 - 基本文件設置 Part 1: Package 和 Import - 基本文件設置 Part 2: @mod - 基本文件設置 Part 3: Class 和 關鍵字 Minecraft 1.6 Minecraft 1.5 Minecraft 1.4 Minecraft 1.3.2 If you want me to create a tutorial on something that I haven't done yet, have suggestions for my tutorials or if you can't figure something out just leave a message here.
  3. Thanks for that boolean "first" thing. I have changed that but it still crashes. Here is the full forge log.
  4. One of the mods I have requires me to edit the FoodStats and EntityPlayer file. In 1.5 I did that the simple way by overriding the files, but for 1.6 that doesn't work anymore. I have decided to recode the mod and make it a core mod that edits the right method in those 2 files through ASM. This is the source code I use for the mod: https://github.com/wuppy29/WuppyMods/tree/master/harderpeaceful When I run this code in Eclipse using this dummy jar file in the mods folder: https://github.com/wuppy29/WuppyMods/tree/master/mods it works just fine. The problem is that when I export it and add it to the mods folder the whole game crashes. What I do is: 1. recompile source code 2. reobfuscate_srg the code 3. Copy the code somewhere where I also have a META-INF folder which contains a MANIFEST.MF file that looks like this: 4. I make a .zip of those 2 folders 5. I change the .zip into a .jar by changing the extension name 6. Paste the .jar into the mods folder Then when MC starts I get this error log: http://pastebin.com/eiursWXb So the mod works in Eclipse, but is broken when I try to use it in MC. Is there anything wrong with the code or have I released it the wrong way? Edit. Could it be that this code runs before the runtime deobf making it change the ue.class (obfuscated EntityPlayer) and then not deobfuscating it, because it has changed or the deobf is actually done while this code runs?
  5. Minecraft mods have always been really popular and a big part of why Minecraft is so big. That is why I created an application for it. In the app you will find a mod list that contains all kinds of information about almost all of the mods out there right now. If the mod you like isn't in the list you can easily add it. If you can't find the mod you are looking for and it doesn't exist at all you can go to the other big part of the app, which is modding tutorials. Those tutorials are written (and recorded) by wuppy29 (which is me) and they are one of the most popular modding tutorials for Forge out there right now. The list of mods comes from: http://modlist.mcf.li/list/1.5/1.5.1.php. And the tutorials: http://www.minecraftforum.net/topic/1431137-152-forge-smp-modding-tutorials-updated-20-5-2013-now-also-on-android/. If you want to see what the app looks like you can watch this video: And if you want to get the app after watching that you can buy it here: https://play.google.com/store/apps/details?id=com.wuppy.minecraftmodpremium Or get the free version over here: https://play.google.com/store/apps/details?id=com.wuppy.minecraftmod
  6. Before I have been working with the dimension api, but in the next update for my mod I wanted to drop the api and use just forge. I have taken out all the dimension api code and everything works except for the teleportation code. This is the code I have right now. BlockGoblinPortal [hide] package GoblinsGiants.common; import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.server.MinecraftServer; import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.BlockPortal; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Entity; import net.minecraft.src.EntityList; import net.minecraft.src.EntityPlayerMP; import net.minecraft.src.EntityPlayerSP; import net.minecraft.src.IBlockAccess; import net.minecraft.src.Material; import net.minecraft.src.ModLoader; import net.minecraft.src.Teleporter; import net.minecraft.src.World; import net.minecraft.src.WorldProvider; import net.minecraft.src.WorldServer; public class BlockGoblinPortal extends BlockPortal { public TeleporterGoblinsGiants teleporter = new TeleporterGoblinsGiants(); public BlockGoblinPortal(int i, int j) { super(i, j); this.setCreativeTab(CreativeTabs.tabBlock); } public String getTextureFile() { return "/GoblinGiant/BlockGoblinGiant.png"; } public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { float var5; float var6; if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) != this.blockID && par1IBlockAccess.getBlockId(par2 + 1, par3, par4) != this.blockID) { var5 = 0.125F; var6 = 0.5F; this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); } else { var5 = 0.5F; var6 = 0.125F; this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); } } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if (!par5Entity.worldObj.isRemote && !par5Entity.isDead) { MinecraftServer var2 = MinecraftServer.getServer(); int var3 = par5Entity.dimension; WorldServer var4 = var2.worldServerForDimension(var3); WorldServer var5 = var2.worldServerForDimension(12); par5Entity.dimension = 12; par5Entity.worldObj.setEntityDead(par5Entity); par5Entity.isDead = false; var2.getConfigurationManager().func_82448_a(par5Entity, var3, var4, var5); Entity var6 = EntityList.createEntityByName(EntityList.getEntityString(par5Entity), var5); if (var6 != null) { var6.func_82141_a(par5Entity, true); var5.spawnEntityInWorld(var6); } par5Entity.isDead = true; var4.func_82742_i(); var5.func_82742_i(); } /*if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null) { if(ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal == 0) { if(ModLoader.getMinecraftInstance().thePlayer.dimension != 12) { ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10; MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)par5Entity, 12, new TeleporterGoblinsGiants()); } else { ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10; MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)par5Entity, 1, new TeleporterGoblinsGiants()); } } else { ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10; } }*/ } public WorldProvider getDimension() { return new WorldProviderGoblinsGiants(); } public Teleporter getTeleporter() { return new TeleporterGoblinsGiants(); } public List canTeleportFromDimension() { ArrayList list = new ArrayList(); list.add(0); list.add(-1); return list; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public boolean displayPortalOverlay() { return true; } public int getOverlayTexture() { return blockIndexInTexture; } public String getEnteringMessage() { return "Entering The Savannah."; } public String getLeavingMessage() { return "Leaving The Savannah."; } public int quantityDropped(Random par1Random) { return 1; } } [/hide] TeleporterGoblinsGiants [hide] package GoblinsGiants.common; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.Direction; import net.minecraft.src.Entity; import net.minecraft.src.MathHelper; import net.minecraft.src.Teleporter; import net.minecraft.src.World; public class TeleporterGoblinsGiants extends Teleporter { /** A private Random() function in Teleporter */ private Random random = new Random(); /** * Place an entity in a nearby portal, creating one if necessary. */ public void placeInPortal(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9) { if (par1World.provider.dimensionId != 1) { if (!this.placeInExistingPortal(par1World, par2Entity, par3, par5, par7, par9)) { this.createPortal(par1World, par2Entity); this.placeInExistingPortal(par1World, par2Entity, par3, par5, par7, par9); } } else { int var10 = MathHelper.floor_double(par2Entity.posX); int var11 = MathHelper.floor_double(par2Entity.posY) - 1; int var12 = MathHelper.floor_double(par2Entity.posZ); byte var13 = 1; byte var14 = 0; for (int var15 = -2; var15 <= 2; ++var15) { for (int var16 = -2; var16 <= 2; ++var16) { for (int var17 = -1; var17 < 3; ++var17) { int var18 = var10 + var16 * var13 + var15 * var14; int var19 = var11 + var17; int var20 = var12 + var16 * var14 - var15 * var13; boolean var21 = var17 < 0; par1World.setBlockWithNotify(var18, var19, var20, var21 ? Block.obsidian.blockID : 0); } } } par2Entity.setLocationAndAngles((double)var10, (double)var11, (double)var12, par2Entity.rotationYaw, 0.0F); par2Entity.motionX = par2Entity.motionY = par2Entity.motionZ = 0.0D; } } /** * Place an entity in a nearby portal which already exists. */ public boolean placeInExistingPortal(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9) { short var10 = 128; double var11 = -1.0D; int var13 = 0; int var14 = 0; int var15 = 0; int var16 = MathHelper.floor_double(par2Entity.posX); int var17 = MathHelper.floor_double(par2Entity.posZ); int var18; double var25; for (var18 = var16 - var10; var18 <= var16 + var10; ++var18) { double var19 = (double)var18 + 0.5D - par2Entity.posX; for (int var21 = var17 - var10; var21 <= var17 + var10; ++var21) { double var22 = (double)var21 + 0.5D - par2Entity.posZ; for (int var24 = par1World.getActualHeight() - 1; var24 >= 0; --var24) { if (par1World.getBlockId(var18, var24, var21) == Block.portal.blockID) { while (par1World.getBlockId(var18, var24 - 1, var21) == Block.portal.blockID) { --var24; } var25 = (double)var24 + 0.5D - par2Entity.posY; double var27 = var19 * var19 + var25 * var25 + var22 * var22; if (var11 < 0.0D || var27 < var11) { var11 = var27; var13 = var18; var14 = var24; var15 = var21; } } } } } if (var11 < 0.0D) { return false; } else { double var46 = (double)var13 + 0.5D; double var23 = (double)var14 + 0.5D; var25 = (double)var15 + 0.5D; int var47 = -1; if (par1World.getBlockId(var13 - 1, var14, var15) == Block.portal.blockID) { var47 = 2; } if (par1World.getBlockId(var13 + 1, var14, var15) == Block.portal.blockID) { var47 = 0; } if (par1World.getBlockId(var13, var14, var15 - 1) == Block.portal.blockID) { var47 = 3; } if (par1World.getBlockId(var13, var14, var15 + 1) == Block.portal.blockID) { var47 = 1; } int var28 = par2Entity.func_82148_at(); if (var47 > -1) { int var29 = Direction.field_71578_g[var47]; int var30 = Direction.offsetX[var47]; int var31 = Direction.offsetZ[var47]; int var32 = Direction.offsetX[var29]; int var33 = Direction.offsetZ[var29]; boolean var34 = !par1World.isAirBlock(var13 + var30 + var32, var14, var15 + var31 + var33) || !par1World.isAirBlock(var13 + var30 + var32, var14 + 1, var15 + var31 + var33); boolean var35 = !par1World.isAirBlock(var13 + var30, var14, var15 + var31) || !par1World.isAirBlock(var13 + var30, var14 + 1, var15 + var31); if (var34 && var35) { var47 = Direction.footInvisibleFaceRemap[var47]; var29 = Direction.footInvisibleFaceRemap[var29]; var30 = Direction.offsetX[var47]; var31 = Direction.offsetZ[var47]; var32 = Direction.offsetX[var29]; var33 = Direction.offsetZ[var29]; var18 = var13 - var32; var46 -= (double)var32; int var20 = var15 - var33; var25 -= (double)var33; var34 = !par1World.isAirBlock(var18 + var30 + var32, var14, var20 + var31 + var33) || !par1World.isAirBlock(var18 + var30 + var32, var14 + 1, var20 + var31 + var33); var35 = !par1World.isAirBlock(var18 + var30, var14, var20 + var31) || !par1World.isAirBlock(var18 + var30, var14 + 1, var20 + var31); } float var36 = 0.5F; float var37 = 0.5F; if (!var34 && var35) { var36 = 1.0F; } else if (var34 && !var35) { var36 = 0.0F; } else if (var34 && var35) { var37 = 0.0F; } var46 += (double)((float)var32 * var36 + var37 * (float)var30); var25 += (double)((float)var33 * var36 + var37 * (float)var31); float var38 = 0.0F; float var39 = 0.0F; float var40 = 0.0F; float var41 = 0.0F; if (var47 == var28) { var38 = 1.0F; var39 = 1.0F; } else if (var47 == Direction.footInvisibleFaceRemap[var28]) { var38 = -1.0F; var39 = -1.0F; } else if (var47 == Direction.enderEyeMetaToDirection[var28]) { var40 = 1.0F; var41 = -1.0F; } else { var40 = -1.0F; var41 = 1.0F; } double var42 = par2Entity.motionX; double var44 = par2Entity.motionZ; par2Entity.motionX = var42 * (double)var38 + var44 * (double)var41; par2Entity.motionZ = var42 * (double)var40 + var44 * (double)var39; par2Entity.rotationYaw = par9 - (float)(var28 * 90) + (float)(var47 * 90); } else { par2Entity.motionX = par2Entity.motionY = par2Entity.motionZ = 0.0D; } par2Entity.setLocationAndAngles(var46, var23, var25, par2Entity.rotationYaw, par2Entity.rotationPitch); return true; } } /** * Create a new portal near an entity. */ public boolean createPortal(World par1World, Entity par2Entity) { byte var3 = 16; double var4 = -1.0D; int var6 = MathHelper.floor_double(par2Entity.posX); int var7 = MathHelper.floor_double(par2Entity.posY); int var8 = MathHelper.floor_double(par2Entity.posZ); int var9 = var6; int var10 = var7; int var11 = var8; int var12 = 0; int var13 = this.random.nextInt(4); int var14; double var15; int var17; double var18; int var21; int var20; int var23; int var22; int var25; int var24; int var27; int var26; int var28; double var34; double var32; for (var14 = var6 - var3; var14 <= var6 + var3; ++var14) { var15 = (double)var14 + 0.5D - par2Entity.posX; for (var17 = var8 - var3; var17 <= var8 + var3; ++var17) { var18 = (double)var17 + 0.5D - par2Entity.posZ; label274: for (var20 = par1World.getActualHeight() - 1; var20 >= 0; --var20) { if (par1World.isAirBlock(var14, var20, var17)) { while (var20 > 0 && par1World.isAirBlock(var14, var20 - 1, var17)) { --var20; } for (var21 = var13; var21 < var13 + 4; ++var21) { var22 = var21 % 2; var23 = 1 - var22; if (var21 % 4 >= 2) { var22 = -var22; var23 = -var23; } for (var24 = 0; var24 < 3; ++var24) { for (var25 = 0; var25 < 4; ++var25) { for (var26 = -1; var26 < 4; ++var26) { var27 = var14 + (var25 - 1) * var22 + var24 * var23; var28 = var20 + var26; int var29 = var17 + (var25 - 1) * var23 - var24 * var22; if (var26 < 0 && !par1World.getBlockMaterial(var27, var28, var29).isSolid() || var26 >= 0 && !par1World.isAirBlock(var27, var28, var29)) { continue label274; } } } } var32 = (double)var20 + 0.5D - par2Entity.posY; var34 = var15 * var15 + var32 * var32 + var18 * var18; if (var4 < 0.0D || var34 < var4) { var4 = var34; var9 = var14; var10 = var20; var11 = var17; var12 = var21 % 4; } } } } } } if (var4 < 0.0D) { for (var14 = var6 - var3; var14 <= var6 + var3; ++var14) { var15 = (double)var14 + 0.5D - par2Entity.posX; for (var17 = var8 - var3; var17 <= var8 + var3; ++var17) { var18 = (double)var17 + 0.5D - par2Entity.posZ; label222: for (var20 = par1World.getActualHeight() - 1; var20 >= 0; --var20) { if (par1World.isAirBlock(var14, var20, var17)) { while (var20 > 0 && par1World.isAirBlock(var14, var20 - 1, var17)) { --var20; } for (var21 = var13; var21 < var13 + 2; ++var21) { var22 = var21 % 2; var23 = 1 - var22; for (var24 = 0; var24 < 4; ++var24) { for (var25 = -1; var25 < 4; ++var25) { var26 = var14 + (var24 - 1) * var22; var27 = var20 + var25; var28 = var17 + (var24 - 1) * var23; if (var25 < 0 && !par1World.getBlockMaterial(var26, var27, var28).isSolid() || var25 >= 0 && !par1World.isAirBlock(var26, var27, var28)) { continue label222; } } } var32 = (double)var20 + 0.5D - par2Entity.posY; var34 = var15 * var15 + var32 * var32 + var18 * var18; if (var4 < 0.0D || var34 < var4) { var4 = var34; var9 = var14; var10 = var20; var11 = var17; var12 = var21 % 2; } } } } } } } int var30 = var9; int var16 = var10; var17 = var11; int var31 = var12 % 2; int var19 = 1 - var31; if (var12 % 4 >= 2) { var31 = -var31; var19 = -var19; } boolean var33; if (var4 < 0.0D) { if (var10 < 70) { var10 = 70; } if (var10 > par1World.getActualHeight() - 10) { var10 = par1World.getActualHeight() - 10; } var16 = var10; for (var20 = -1; var20 <= 1; ++var20) { for (var21 = 1; var21 < 3; ++var21) { for (var22 = -1; var22 < 3; ++var22) { var23 = var30 + (var21 - 1) * var31 + var20 * var19; var24 = var16 + var22; var25 = var17 + (var21 - 1) * var19 - var20 * var31; var33 = var22 < 0; par1World.setBlockWithNotify(var23, var24, var25, var33 ? Block.obsidian.blockID : 0); } } } } for (var20 = 0; var20 < 4; ++var20) { par1World.editingBlocks = true; for (var21 = 0; var21 < 4; ++var21) { for (var22 = -1; var22 < 4; ++var22) { var23 = var30 + (var21 - 1) * var31; var24 = var16 + var22; var25 = var17 + (var21 - 1) * var19; var33 = var21 == 0 || var21 == 3 || var22 == -1 || var22 == 3; par1World.setBlockWithNotify(var23, var24, var25, var33 ? Block.obsidian.blockID : Block.portal.blockID); } } par1World.editingBlocks = false; for (var21 = 0; var21 < 4; ++var21) { for (var22 = -1; var22 < 4; ++var22) { var23 = var30 + (var21 - 1) * var31; var24 = var16 + var22; var25 = var17 + (var21 - 1) * var19; par1World.notifyBlocksOfNeighborChange(var23, var24, var25, par1World.getBlockId(var23, var24, var25)); } } } return true; } } [/hide] When I use the par5Entity.usePortal() the portal block works and teleports me to the nether, but if I use the code in the onEntityCollide that is not commented out nothing happens and if I use the commented out code it will crash. What is the teleportation code for 1.4.2?
  7. Title said it all. How do I make a .info file for my mod? And how do I make a mod a child mod and what does it do? (any reason why I should do that)
  8. Thanks a lot. You are awesome.
  9. I'm trying to make a new type of dungeon to generate in Minecraft, but the spawner isn't generating the way it should. How do I make a spawner generate with a custom mob?
  10. I agree that promoting is very hard. However, I got lucky and got a mod spotlight from Ipodmail
  11. First of very nice forums. Before I have made the Peacefulpack compatible with forge and used the 256x256 texture files to only use 2 files, so I know how to do that. Right now I'm working on getting another mod forge compatible. I have already placed all the pictures into 2 256x256 files, but there is 1 difference between the mod I'm changing now and the peacefulpack. In this mod I have throwable entities that are textured with RenderSnowball. Right now I have this code for 1 of the items (there are 4 in total that have this): mod_Magicalexperience @MLProp public static int ClusterBottleID = 520; public static Item clusterbottle; public void load() { clusterbottle = new ItemClusterBottle(ClusterBottleID).setIconIndex(11).setItemName("clusterbottle"); ModLoader.addName(clusterbottle, "Cluster Bottle"); MinecraftForgeClient.preloadTexture("/MagicalExp/Items.png"); } public void addRenderer(Map map) { map.put(EntityClusterBottle.class, new RenderSnowball(mod_Magicalexperience.clusterbottle.iconIndex)); } ItemClusterBottle package net.minecraft.src; import net.minecraft.src.forge.*; public class ItemClusterBottle extends Item implements ITextureProvider { public ItemClusterBottle(int i) { super(i); maxStackSize = 64; } public String getTextureFile() { return "/MagicalExp/Items.png"; } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { par1ItemStack.stackSize--; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityClusterBottle(par2World, par3EntityPlayer)); } return par1ItemStack; } } And EntityClusterbottle package net.minecraft.src; import java.util.Random; public class EntityClusterBottle extends EntityThrowable { public EntityClusterBottle(World par1World) { super(par1World); } public EntityClusterBottle(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityClusterBottle(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } protected float func_40075_e() { return 0.07F; } protected float func_40077_c() { return 0.7F; } protected float func_40074_d() { return -20F; } /** * Called when the throwable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (!worldObj.isRemote) { worldObj.playAuxSFX(2002, (int)Math.round(posX), (int)Math.round(posY), (int)Math.round(posZ), 0); for (int i = 3 + worldObj.rand.nextInt(5) + worldObj.rand.nextInt(5); i > 0;) { int j = EntityXPOrb.getXPSplit(i); i -= j; worldObj.createExplosion(null, posX, posY, posZ, rand.nextInt(4)); worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX + rand.nextInt(5), posY, posZ + rand.nextInt(5))); worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX - rand.nextInt(5), posY, posZ + rand.nextInt(5))); worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX + rand.nextInt(5), posY, posZ - rand.nextInt(5))); worldObj.spawnEntityInWorld(new EntityTntbottle(worldObj, posX - rand.nextInt(5), posY, posZ - rand.nextInt(5))); } setDead(); } } } In the inventory all the items look the way they should, but when I throw one of those entities it will show the texture from the vanillan items.png making this bottle a golden apple in the air. How do I get it to load the texture from my items.png? Found out how to fix it. Just copy RenderSnowball, make a new Renderfile and change: this.loadTexture("/gui/items.png"); into this.loadTexture("/MagicalExp/Items.png"); Derp
×
×
  • Create New...

Important Information

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