Jump to content

general3214

Forge Modder
  • Posts

    27
  • Joined

  • Last visited

Everything posted by general3214

  1. Since Forge 1.5.2 wouldn't work, I had to use MCP. The code in BlockFurnace that relates to your problem is pretty much the same in 1.6.4, but try putting this code in your block class: /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } /** * set a blocks direction */ private void setDefaultDirection(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { int var5 = par1World.getBlockId(par2, par3, par4 - 1); int var6 = par1World.getBlockId(par2, par3, par4 + 1); int var7 = par1World.getBlockId(par2 - 1, par3, par4); int var8 = par1World.getBlockId(par2 + 1, par3, par4); byte var9 = 3; if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) { var9 = 3; } if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) { var9 = 2; } if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) { var9 = 5; } if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) { var9 = 4; } par1World.setBlockMetadataWithNotify(par2, par3, par4, var9, 2); } } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) { int var7 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (var7 == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } if (var7 == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); } if (var7 == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } if (var7 == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } }
  2. In the model class, take out the following code: this.bipedHead.addChild(Base); this.bipedHead.addChild(Base2); this.bipedHead.addChild(Shape1); this.bipedHead.addChild(Shape1b); this.bipedHead.addChild(Shape2); this.bipedHead.addChild(Shape3); this.bipedHead.addChild(Shape3b); this.bipedHead.addChild(Shape4); this.bipedHead.addChild(Shape5); this.bipedHead.addChild(Shape5b); this.bipedHead.addChild(Shape6); this.bipedHead.addChild(Shape6b); this.bipedHead.addChild(Shape7); this.bipedHead.addChild(Shape7b); this.bipedHead.addChild(Shape8); this.bipedHead.addChild(Shape9); this.bipedHead.addChild(Shape10); this.bipedHead.addChild(Shape11); this.bipedHead.addChild(Shape12); this.bipedHead.addChild(Shape12b); this.bipedHead.addChild(Shape13); this.bipedHead.addChild(Shape13b); If that doesn't work, take out this: this.bipedHeadwear.addChild(Base); this.bipedHeadwear.addChild(Base2); this.bipedHeadwear.addChild(Shape1); this.bipedHeadwear.addChild(Shape1b); this.bipedHeadwear.addChild(Shape2); this.bipedHeadwear.addChild(Shape3); this.bipedHeadwear.addChild(Shape3b); this.bipedHeadwear.addChild(Shape4); this.bipedHeadwear.addChild(Shape5); this.bipedHeadwear.addChild(Shape5b); this.bipedHeadwear.addChild(Shape6); this.bipedHeadwear.addChild(Shape6b); this.bipedHeadwear.addChild(Shape7); this.bipedHeadwear.addChild(Shape7b); this.bipedHeadwear.addChild(Shape8); this.bipedHeadwear.addChild(Shape9); this.bipedHeadwear.addChild(Shape10); this.bipedHeadwear.addChild(Shape11); this.bipedHeadwear.addChild(Shape12); this.bipedHeadwear.addChild(Shape12b); this.bipedHeadwear.addChild(Shape13); this.bipedHeadwear.addChild(Shape13b); If neither work, tell us what happens when you take out the code.
  3. Try using LivingHurtEvent or LivingAttackEvent .
  4. Take out getArmorTexture or getArmorModel ; you only need one.
  5. Code from BlockFurnace that should be of interest for you: /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } /** * set a blocks direction */ private void setDefaultDirection(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { int l = par1World.getBlockId(par2, par3, par4 - 1); int i1 = par1World.getBlockId(par2, par3, par4 + 1); int j1 = par1World.getBlockId(par2 - 1, par3, par4); int k1 = par1World.getBlockId(par2 + 1, par3, par4); byte b0 = 3; if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1]) { b0 = 3; } if (Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l]) { b0 = 2; } if (Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1]) { b0 = 5; } if (Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1]) { b0 = 4; } par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2); } } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } if (l == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); } if (l == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } if (l == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } if (par6ItemStack.hasDisplayName()) { ((TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName()); } } EDIT: I noticed that you're asking about 1.5.2; I'll look into it ASAP. EDIT 2: 1.5.2 won't decompile for me...
  6. More efficient code: this.currentPower += power;
  7. Looking over my own code, I'm pretty sure I know what's the problem. But before we get fixing, change your render IDs: int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_URANIUM.name()); int copperRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_COPPER.name()); int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID(UNOBTANIUM.name()); You have to change them again because RenderingRegistry.addNewArmourRendererPrefix (which is in your client proxy) adds an armor prefix to the string array RenderBiped.bipedArmorFilenamePrefix . bipedArmorFilenamePrefix is defined as an array of armor type strings ( new String[] {"leather", "chainmail", "iron", "diamond", "gold"} ), so your code should register armor type strings, rather than texture paths, when using SeroCraft.proxy.registerArmorRenderID . Now getting to the actual fixing, change public String getArmorTextureFile(ItemStack itemstack, Entity entity, int slot, int layer) to public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, int layer) . This is in the armor class (e.g. ItemSCUnobtaniumArmor).
  8. Try this: int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/UraniumArmor"); int copperRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/CopperArmor"); int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/UnobtaniumArmor"); The problem is that "_layer_#.png" is already added, so "serocraft/Armor_" makes Minecraft look for textures in "minecraft:textures/models/armor/serocraft/Armor__layer_#.png" (two underscores after "Armor"). Also, put your armor textures in "serocraft:textures/models/armor" rather than "serocraft:textures/armor". You might need to change some code here and there, but it helps with compatibility.
  9. No. GameRegistry.registerBlock registers a block into the code. LanguageRegistry.addName adds a name to be displayed in-game. For example: Block testBlock = new Block(1000, Material.air).setUnlocalizedName("testBlock").setTextureName("test_block"); GameRegistry.registerBlock(testBlock, "testBlock"); LanguageRegistry.addName(testBlock, "Test Block"); I personally like to register blocks with their unlocalized names like so: GameRegistry.registerBlock(testBlock, testBlock.getUnlocalizedName.substring(5));
  10. There are lots of them: https://github.com/MinecraftForge/MinecraftForge/tree/master/src/main/java/net/minecraftforge/event Explore Forge source code more often.
  11. I believe the method you are looking for is swingItem() , which is located in EntityLivingBase , a class extended by EntityPlayer .
  12. Dude, look at the source code (tested with Forge 10.12.0.996, may not work with other versions): Item.class public Item setTextureName(String par1Str) { this.iconString = par1Str; return this; } /** * Returns the string associated with this Item's Icon. */ @SideOnly(Side.CLIENT) protected String getIconString() { return this.iconString == null ? "MISSING_ICON_ITEM_" + field_150901_e.func_148757_b(this) + "_" + this.unlocalizedName : this.iconString; } Block.class public Block func_149658_d(String p_149658_1_) { this.field_149768_d = p_149658_1_; return this; } @SideOnly(Side.CLIENT) protected String func_149641_N() { return this.field_149768_d == null ? "MISSING_ICON_BLOCK_" + func_149682_b(this) + "_" + this.field_149770_b : this.field_149768_d; }
  13. If you somehow did not understand the post above: @EventHandler public void preInit(FMLPreInitializationEvent event) { tabRoleplay = new CreativeTabs("tabRoleplay") { public ItemStack getIconItemStack() { return new ItemStack(Item.eyeOfEnder, 1, 0); }}; testBlock = new BlockTest(testBlockID, Material.cloth).setUnlocalizedName("testBlock").setCreativeTab(this.tabRoleplay); GameRegistry.registerBlock(testBlock, "testBlock"); }
  14. I've fixed it! In Block PortalOreleans, I just had to change this: public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && (par5Entity instanceof EntityPlayerMP)) { EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity; if (thePlayer.timeUntilPortal > 0) { thePlayer.timeUntilPortal = 10; } else if (thePlayer.dimension != mod_MOreTrees.oreleansID) { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mod_MOreTrees.oreleansID); } else { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0); } } } Into this: public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && (par5Entity instanceof EntityPlayerMP)) { EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity; if (thePlayer.timeUntilPortal > 0) { thePlayer.timeUntilPortal = 10; } else if (thePlayer.dimension != mod_MOreTrees.oreleansID) { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mod_MOreTrees.oreleansID, new TeleporterOreleans(thePlayer.mcServer.worldServerForDimension(mod_MOreTrees.oreleansID))); } else { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterOreleans(thePlayer.mcServer.worldServerForDimension(0))); } } }
  15. I think I've managed to get the player to teleport into the custom portal, but I'm not sure. I can't tell because whenever I go into a portal, I immediately teleport back to the normal world.
  16. This is what happens: 1. Player creates custom portal 2. Player teleports to custom dimension 3. Instead of another custom portal, a nether portal is created in the custom dimension My code: mod_MOreTrees: http://paste.minecraftforge.net/view/6847afd3 BlockPortalOreleans: http://paste.minecraftforge.net/view/ec0a8390 ChunkProviderOreleans: http://paste.minecraftforge.net/view/100e33ed PortalPositionOreleans: http://paste.minecraftforge.net/view/ea275cb8 TeleporterOreleans: http://paste.minecraftforge.net/view/d3b49a9d WorldProviderOreleans: http://paste.minecraftforge.net/view/1d8000f1
  17. I don't know if this will help, but it's just a suggestion. You could make a biome and add this code to the constructor: this.topBlock = (byte) 0; this.fillerBlock = (byte) 0; Then you could make a new dimension that uses this biome. If you need the tutorials here's a link: http://www.minecraftforum.net/topic/1797143-
  18. In Block, there are 3 variables called thinGlass, tripWireSource, and tripWire. public static final Block thinGlass = (new BlockPane(102, "glass", "glass_pane_top", Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setUnlocalizedName("thinGlass"); public static final BlockTripWireSource tripWireSource = (BlockTripWireSource)(new BlockTripWireSource(131)).setUnlocalizedName("tripWireSource").func_111022_d("trip_wire_source"); public static final Block tripWire = (new BlockTripWire(132)).setUnlocalizedName("tripWire").func_111022_d("trip_wire"); In Item, there is a variable called silk. public static Item silk = (new ItemReed(31, Block.tripWire)).setUnlocalizedName("string").setCreativeTab(CreativeTabs.tabMaterials).func_111206_d("string");
  19. Instead of using the TomatoCrop class in that tutorial, I would recommend this one: package tutorial.generic; import java.util.Random; import net.minecraft.block.BlockCrops; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class TomatoCrop extends BlockCrops { @SideOnly(Side.CLIENT) private Icon[] iconArray; public TomatoCrop(int par1) { super(par1); } @SideOnly(Side.CLIENT) /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getIcon(int par1, int par2) { if (par2 < 7) { if (par2 == 6) { par2 = 5; } return this.iconArray[par2 >> 1]; } else { return this.iconArray[3]; } } /** * Generate a seed ItemStack for this crop. */ protected int getSeedItem() { return Generic.tomatoSeeds.itemID; } /** * Generate a crop produce ItemStack for this crop. */ protected int getCropItem() { return Generic.tomatoFruit.itemID; } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random par1Random) { return 1; } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.iconArray = new Icon[4]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray[i] = par1IconRegister.registerIcon("generic:" + "tomatoes_" + i); } } } Then you would place tomatoes_1.png, tomatoes_2.png, tomatoes_3.png, and tomatoes_4.png in "assets/generic/textures/blocks". Examples: tomatoes_0: tomatoes_1: tomatoes_2: tomatoes_3:
  20. I think he's talking about the config file in "<mcp folder>/jars/config". The next time you run your mod in Eclipse, a new config will generate.
  21. "tryToCreatePortal" is located in BlockPortalOreleans. Here's the code: http://paste.minecraftforge.net/view/d570fac5
×
×
  • Create New...

Important Information

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