Jump to content

ThatBenderGuy

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by ThatBenderGuy

  1. Not sure if you were referring to me because I have listed all my source code and it's not renderModel it's just render No, there are two codes: render and renderModel, and when you make a custom block model (but not in an entity model) you should do renderModel too Oh well I dont have "renderModels" in my code but here is how I fixed it I had my addTools method before my proxy.registerRenderThings method thus It was trying to obtain here is my new source code for my @Init load method @Init public void load(FMLInitializationEvent e){ addBlocks(); addItems(); addTools(); // <- Notice how this method addArmor(); addRecipes(); addMobs(); proxy.registerRenderThings(); // <- is now BEFORE this method proxy.registerServerTickHandler(); EntityEgg(EntityAlien.class, 0xFFFFFF, 0x00DD00); GameRegistry.registerWorldGenerator(new worldGeneratorBlinomium()); GameRegistry.registerTileEntity(CannonTileEntity.class, "cannonTileEntity"); }
  2. Not sure if you were referring to me because I have listed all my source code and it's not renderModel it's just render
  3. I'm getting the same error which doesn't make sense Here's my crash report ---- Minecraft Crash Report ---- // Ouch. That hurt Time: 3/27/13 10:00 AM Description: Failed to start game java.lang.NullPointerException at com.biosystemstudios.ClientProxy.registerRenderThings(ClientProxy.java:14) at com.biosystemstudios.mod_MainClass.load(mod_MainClass.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:689) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206) at net.minecraft.client.Minecraft.startGame(Minecraft.java:444) at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44) at net.minecraft.client.Minecraft.run(Minecraft.java:729) at java.lang.Thread.run(Thread.java:722) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.5.1 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_11, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 845715608 bytes (806 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v7.44 FML v5.1.8.608 Minecraft Forge 7.7.0.608 4 mods loaded, 4 mods active mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized terestrial [Extra Terestrial Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored LWJGL: 2.4.2 OpenGL: ATI Radeon HD 5450 GL version 4.2.11631 Compatibility Profile Context, ATI Technologies Inc. Is Modded: Definitely; Client brand changed to 'forge,fml' Type: Client (map_client.txt) Texture Pack: Default Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null [. Here is my classes ClientProxy http://pastebin.com/s7Xc6h0n BlinSwordModel package com.biosystemstudios; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class BlinSwordModel extends ModelBase { //fields public ModelRenderer Hilt2; public ModelRenderer Hilt1; public ModelRenderer Handle; public ModelRenderer Bludge1; public ModelRenderer Bludge2; public ModelRenderer Blade1; public ModelRenderer Blade2; public ModelRenderer Blade3; public ModelRenderer Shape1; public BlinSwordModel() { textureWidth = 64; textureHeight = 64; Hilt2 = new ModelRenderer(this, 0, 30); Hilt2.addBox(-4F, 0F, 0F, 8, 1, 1); Hilt2.setRotationPoint(0F, 1F, 0F); Hilt2.setTextureSize(64, 64); Hilt2.mirror = true; setRotation(Hilt2, 0F, 0F, 0F); Hilt1 = new ModelRenderer(this, 0, 30); Hilt1.addBox(-3F, 0F, 0F, 6, 1, 1); Hilt1.setRotationPoint(0F, 0F, 0F); Hilt1.setTextureSize(64, 64); Hilt1.mirror = true; setRotation(Hilt1, 0F, 0F, 0F); Handle = new ModelRenderer(this, 0, 34); Handle.addBox(-1F, -3F, -1F, 2, 6, 2); Handle.setRotationPoint(0F, 5F, 0.5F); Handle.setTextureSize(64, 64); Handle.mirror = true; setRotation(Handle, 0F, 0F, 0F); Bludge1 = new ModelRenderer(this, 25, 0); Bludge1.addBox(0F, 0F, 0F, 3, 2, 3); Bludge1.setRotationPoint(-1.5F, 8F, -1F); Bludge1.setTextureSize(64, 64); Bludge1.mirror = true; setRotation(Bludge1, 0F, 0F, 0F); Bludge2 = new ModelRenderer(this, 25, 0); Bludge2.addBox(0F, 0F, 0F, 2, 1, 2); Bludge2.setRotationPoint(-1F, 10F, -0.5F); Bludge2.setTextureSize(64, 64); Bludge2.mirror = true; setRotation(Bludge2, 0F, 0F, 0F); Blade1 = new ModelRenderer(this, 0, 0); Blade1.addBox(0F, 0F, 0F, 3, 16, 1); Blade1.setRotationPoint(-1.5F, -16F, 0F); Blade1.setTextureSize(64, 64); Blade1.mirror = true; setRotation(Blade1, 0F, 0F, 0F); Blade2 = new ModelRenderer(this, 9, 0); Blade2.addBox(0F, 0F, 0F, 1, 3, 1); Blade2.setRotationPoint(-0.25F, -18F, 0F); Blade2.setTextureSize(64, 64); Blade2.mirror = true; setRotation(Blade2, 0F, 0F, -0.2617994F); Blade3 = new ModelRenderer(this, 9, 0); Blade3.addBox(0F, 0F, 0F, 1, 3, 1); Blade3.setRotationPoint(-0.7F, -18.25F, 0F); Blade3.setTextureSize(64, 64); Blade3.mirror = true; setRotation(Blade3, 0F, 0F, 0.2617994F); Shape1 = new ModelRenderer(this, 9, 0); Shape1.addBox(0F, 0F, 0F, 1, 1, 1); Shape1.setRotationPoint(-0.5F, -17F, 0F); Shape1.setTextureSize(64, 64); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Hilt2.render(f5); Hilt1.render(f5); Handle.render(f5); Bludge1.render(f5); Bludge2.render(f5); Blade1.render(f5); Blade2.render(f5); Blade3.render(f5); Shape1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } ItemRenderSword package com.biosystemstudios; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; public class ItemRenderSword implements IItemRenderer { protected BlinSwordModel swordModel; public ItemRenderSword(){ swordModel = new BlinSwordModel(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type){ case EQUIPPED: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type){ case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture("/mods/et/textures/models/BlinSword.png"); swordModel.render((Entity)data[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f); GL11.glPopMatrix(); } default: break; } } } mod_MainClass package com.biosystemstudios; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "terestrial", name = "Extra Terestrial Mod", version = "0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class mod_MainClass { @SidedProxy(clientSide = "com.biosystemstudios.ClientProxy", serverSide = "com.biosystemstudios.ServerProxy") public static ServerProxy proxy; //Blocks public static Block TutBlock; public static Block CannonBlock; //items public static Item BlinOreRaw; public static Item BlinOrePure; public static Item BlinShard; public static Item BlinCrystal; public static Item BlinPaxel; public static Item GlassBox; //Tools public static Item BlinomiumPickaxe; public static Item BlinomiumAxe; public static Item BlinomiumShovel; public static Item BlinomiumHoe; public static Item BlinomiumSword; //Armor public static Item BlinHelmet; public static Item BlinPlate; public static Item BlinLegs; public static Item BlinBoots; // Pre-Init @PreInit public void load(FMLPreInitializationEvent PreEvent){ } // Init @Init public void load(FMLInitializationEvent e){ proxy.registerRenderThings(); proxy.registerServerTickHandler(); addBlocks(); // Blocks addItems(); // Items addTools(); // Tools addArmor(); // Armor addRecipes(); // Recipes addMobs(); // Mobs EntityEgg(EntityAlien.class, 0xFFFFFF, 0x00DD00); GameRegistry.registerWorldGenerator(new worldGeneratorBlinomium()); GameRegistry.registerTileEntity(CannonTileEntity.class, "cannonTileEntity"); } private void addBlocks(){ TutBlock = new TutBlock(450).setHardness(1.5f).setResistance(17.0f).setUnlocalizedName("Tut Block").setLightValue(0.9f); CannonBlock = new CannonBlock(451).setHardness(175.0f).setResistance(20.0f).setUnlocalizedName("Cannon Block"); MinecraftForge.setBlockHarvestLevel(TutBlock, "pickaxe", 3); GameRegistry.registerBlock(TutBlock, "BiosystemStudios.TutBlock"); GameRegistry.registerBlock(CannonBlock, "BiosystemStudios.CannonBlock"); } private void addItems(){ BlinOreRaw = new BlinOreRaw(2000).setUnlocalizedName("Raw Blinomium Ore"); BlinOrePure = new BlinOrePure(2001).setUnlocalizedName("Pure Blinomium Ore"); BlinShard = new BlinShard(2002).setUnlocalizedName("Blinomium Shard"); BlinCrystal = new BlinCrystal(2003, -6, -7.0f, false).setUnlocalizedName("Blinomium Crystal"); GlassBox = new GlassBox(2004).setUnlocalizedName("Glass Box"); } private void addArmor(){ EnumArmorMaterial BlinArmorMaterial = EnumHelper.addArmorMaterial("Blinomium Armor Material", 40, new int[]{4, 9, 7, 4}, 10); BlinHelmet = new BlinArmor(4000, BlinArmorMaterial, proxy.addArmor("Blinomium"), 0).setUnlocalizedName("Blin Helmet"); BlinPlate = new BlinArmor(4001, BlinArmorMaterial, proxy.addArmor("Blinomium"), 1).setUnlocalizedName("Blin Plate"); BlinLegs = new BlinArmor(4002, BlinArmorMaterial, proxy.addArmor("Blinomium"), 2).setUnlocalizedName("Blin Legs"); BlinBoots = new BlinArmor(4003, BlinArmorMaterial, proxy.addArmor("Blinomium"), 3).setUnlocalizedName("Blin Boots"); } private void addTools(){ EnumToolMaterial BlinomiumTool = EnumHelper.addToolMaterial("Blinomium Material", 2, 6400, 24.0f, 8, 10); BlinomiumPickaxe = new BlinomiumPickaxe(3000, BlinomiumTool).setUnlocalizedName("Blinomium Pickaxe"); BlinomiumAxe = new BlinomiumAxe(3001, BlinomiumTool).setUnlocalizedName("Blinomium Axe"); BlinomiumShovel = new BlinomiumShovel(3002, BlinomiumTool).setUnlocalizedName("Blinomium Spade"); BlinomiumHoe = new BlinomiumHoe(3003, BlinomiumTool).setUnlocalizedName("Blinomium Hoe"); BlinomiumSword = new BlinomiumSword(3004, BlinomiumTool).setUnlocalizedName("Blinomium Sword").setFull3D(); BlinPaxel = new BlinomiumPaxel(3005, BlinomiumTool).setUnlocalizedName("Blinomium Paxel"); } private void addMobs(){ EntityRegistry.registerModEntity(EntityAlien.class, "AlienEntity", 1, this, 80, 5, true); EntityRegistry.addSpawn(EntityAlien.class, 10, 1, 3, EnumCreatureType.monster, BiomeGenBase.beach, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.jungle, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills); LanguageRegistry.instance().addStringLocalization("entity.terestrial.AlienEntity.name", "Alien Entity"); } private void registerItemNames(){ LanguageRegistry.addName(TutBlock, "Raw Blinomium Ore"); LanguageRegistry.addName(BlinOreRaw, "Impure Blinomium Ore"); LanguageRegistry.addName(BlinOrePure, "Blinomium Ingot"); LanguageRegistry.addName(BlinomiumPickaxe, "Blinomium Pickaxe"); LanguageRegistry.addName(BlinomiumAxe, "Blinomium Axe"); LanguageRegistry.addName(BlinomiumShovel, "Blinomium Shovel"); LanguageRegistry.addName(BlinomiumHoe, "Blinomium Hoe"); LanguageRegistry.addName(BlinomiumSword, "Blinomium Sword"); LanguageRegistry.addName(BlinHelmet, "Blinomium Helmet"); LanguageRegistry.addName(BlinPlate, "Blinomium Plate"); LanguageRegistry.addName(BlinLegs, "Blinomium Legs"); LanguageRegistry.addName(BlinBoots, "Blinomium Boots"); LanguageRegistry.addName(BlinShard, "Blinomium Shard"); LanguageRegistry.addName(BlinCrystal, "Blinomium Crystal"); LanguageRegistry.addName(CannonBlock, "Cannon"); LanguageRegistry.addName(BlinPaxel, "Ultimate Blinomium Tool"); LanguageRegistry.addName(GlassBox, "Uncharged Cannon"); } private void addRecipes(){ //Recipes // Tools GameRegistry.addRecipe(new ItemStack(this.BlinomiumPickaxe, 1), new Object[]{ "BBB", " S ", " S ", 'B', this.BlinOrePure, 'S', Item.stick }); GameRegistry.addRecipe(new ItemStack(this.BlinomiumSword, 1), new Object[]{ " B ", " B ", " S ", 'B', this.BlinOrePure, 'S', Item.stick }); GameRegistry.addRecipe(new ItemStack(this.BlinomiumAxe, 1), new Object[]{ "BB ","BS ", " S ", 'B', this.BlinOrePure, 'S', Item.stick }); GameRegistry.addRecipe(new ItemStack(this.BlinomiumShovel, 1), new Object[]{ " B ", " S ", " S ", 'B', this.BlinOrePure, 'S', Item.stick }); GameRegistry.addRecipe(new ItemStack(this.BlinomiumHoe, 1), new Object[]{ "BB ", " S ", " S ", 'B', this.BlinOrePure, 'S', Item.stick }); // Armors GameRegistry.addRecipe(new ItemStack(this.BlinHelmet, 1), new Object[] { "BBB", "B B", " ", 'B', this.BlinOrePure }); GameRegistry.addRecipe(new ItemStack(this.BlinPlate, 1), new Object[]{ "b b", "bbb", "bbb", 'b', this.BlinOrePure }); GameRegistry.addRecipe(new ItemStack(this.BlinLegs, 1), new Object[]{ "bbb", "b b", "b b", 'b', this.BlinOrePure }); GameRegistry.addRecipe(new ItemStack(this.BlinBoots, 1), new Object[]{ " ", "b b", "b b", 'b', this.BlinOrePure }); //Smelting Recipes GameRegistry.addSmelting(this.TutBlock.blockID, new ItemStack(this.BlinOreRaw, 1), 10.0f); GameRegistry.addSmelting(this.BlinOreRaw.itemID , new ItemStack(this.BlinOrePure, 1), 10.0f); /*GameRegistry.addRecipe(new ItemStack(this.BlinOrePure, 1), new Object[]{ "r", 'r', (new ItemStack(mod_MainClass.BlinOreRaw, 1, -1)) });*/ //Misc. Recipes GameRegistry.addRecipe(new ItemStack(this.BlinCrystal, 1), new Object[]{ "ss", "ss", 's', this.BlinShard }); GameRegistry.addShapelessRecipe(new ItemStack(this.CannonBlock, 1), new Object[]{ this.BlinCrystal, this.GlassBox }); GameRegistry.addRecipe(new ItemStack(this.GlassBox, 1), new Object[]{ "iii","i p", "iii", 'i', Item.ingotIron, 'p', Block.thinGlass }); } public static int getUniqueID(){ int EntityId = 300; do{ EntityId++; }while(EntityList.getStringFromID(EntityId) != null); return EntityId; } public static void EntityEgg(Class<? extends Entity > entity, int primaryColor, int secondaryColor){ int id = getUniqueID(); EntityList.IDtoClassMapping.put(id, entity); EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor)); } // Post Load @PostInit public void PostLoad(FMLPostInitializationEvent PostEvent){ registerItemNames(); //Item Names } } Not quite sure why I am getting a null pointer exception. I have my itemID and the ItemRender class in there. Not sure why I'm crashing
  4. ya I made an edit before I saw your post I figured it out. I already had a world variable declared so I just moved around my code to create the world.isRemote if statement
  5. So I have this code on my custom sword public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { Random rand = new Random(); int chance = (1 + rand.nextInt(100)); World world = par3EntityLiving.worldObj; if(chance <= { par1ItemStack.damageItem(100, par3EntityLiving); par2EntityLiving.addPotionEffect(new PotionEffect(Potion.wither.getId(), 100, 7)); par2EntityLiving.entityDropItem(new ItemStack(mod_MainClass.BlinShard, 1), 1.0f); }else{ par1ItemStack.damageItem(1, par3EntityLiving); } return true; } And sometimes it'll spawn an extra item that can't be picked up. I thought it would use world.isRemote but this specific method doesn't use world in it. So I am at a loss at what could be causing a ghost item to appear. EDIT: I just derped. I realised I did declare a world variable and changed my code to this public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { World world = par3EntityLiving.worldObj; if (world.isRemote) { return true; }else{ Random rand = new Random(); int chance = (1 + rand.nextInt(100)); if(chance <= { par1ItemStack.damageItem(100, par3EntityLiving); par2EntityLiving.addPotionEffect(new PotionEffect(Potion.wither.getId(), 100, 7)); par2EntityLiving.entityDropItem(new ItemStack(mod_MainClass.BlinShard, 1), 1.0f); }else{ par1ItemStack.damageItem(1, par3EntityLiving); } return true; } }
  6. But you found them now, using the link above? Also take a look into the code which is used inn TileEntityFurnace and BlockFurnace as I said, and then look at the other TE's and their blocks. That should help you out inn understanding how they work and how to use them Lol I do that all the time on finding out how to do a specific thing is look at existing vanilla minecraft classes. But sometimes I get to that point where I just don't know what to do to make it function. Just one real quick final question. Do I ever need to use GameRegistry.registerTileEntity when working with tile entities?
  7. Just a little thread for people who code (java or not) to share how they keep sane while coding for long periods. I like to smoke my E-Cig and listen to MSI, especially when working on Java/Minecraft Mods. But for some reason when coding in C++ or C# I like to listen to Deathcore and System Of A Down more than my MSI
  8. public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10) { if (par3World.isRemote) { return true; }else{ if(par3World.getBlockId(x, y, z) == Block.stone.blockID){ par3World.setBlock(x, y, z, Block.sand.blockID); } return true; } } the first 'if' statement is so that the code is ran once. It's required if you want to have it use the item then put this under par3World.setBlock par1ItemStack.stackSize--;
  9. [lmgtfy=forge furnace tutorial]Where did you look?[/lmgtfy] There's a lot of them Haha I've googled but I can only find tutorials for it for 1.3.2 and earlier, and not for forge either
  10. hmm looked around and can't seem to find a tutorial for forge on creating new furnace type tile entities
  11. MyBlock.class public class MyBlock extends Block { private Icon blockTop; private Icon blockFront; private myTileEntity tentity; public MyBlock(int ID) { super(ID, Material.iron); this.setCreativeTab(CreativeTabs.tabBlock); tentity = new myTileEntity(); } public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; }else{ tentity.switchActivated(); player.addChatMessage("[" + tentity.getActivated() + "]"); return true; } } } myTileEntity.class package com.biosystemstudios; import net.minecraft.tileentity.TileEntity; public class myTileEntity extends TileEntity { private boolean activated = false; public myTileEntity() {} public boolean getActivated(){ return activated; } public void setActivated(boolean b){ activated = b; } public void switchActivated(){ activated = !activated; } } There's my code but what the problem is when I place down more than 1 block and right click any one the activated variable is the same from the last block. So if i right click the first block it'll set activated to true but if I go right click the other block it'll set activated back to false Tile Entities are supposed to store data unique to a specific block, how come the variable is still shared?
  12. public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { tentity.switchActivated(); //tentity is my tileentity. The method will switch a boolean to false or true player.addChatMessage("[" + tentity.getActivated() + "]"); return true; } When I test this code in game and right click my block, it returns "[true] [false]" For some reason it's being ran twice. Anyone know a work around? EDIT: Figure it out. Had to put my code inside an if statement like this if (par1World.isRemote) { return true; }else{ //Code goes here }
  13. Well actually that brings up a 2nd thing I need. I can't seem to locate the method for blocks for when they are activated by redstone. I need that. To answer you first question, I need to find out what direction my block is facing when it is powered by redstone. I just make my block extend TileEntity instead of block to make it a tile entity correct?
  14. How would I go about this? Here is my current code (Omitted any that has nothing to with the direction of the block) private Icon field_94458_cO; private Icon field_94459_cP; public MyBlock(int ID) { super(ID, Material.iron); this.setCreativeTab(CreativeTabs.tabBlock); } /** * 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); } } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLiving.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)).func_94129_a(par6ItemStack.getDisplayName()); } } @Override public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("et:blockSides"); this.field_94459_cP = par1IconRegister.registerIcon("et:blockFront"); this.field_94458_cO = par1IconRegister.registerIcon("et:blockTop"); } public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return par1 == 1 ? this.field_94458_cO : (par1 == 0 ? this.field_94458_cO : (par1 != par2 ? this.blockIcon : this.field_94459_cP)); } public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); }
  15. Well see that's my problem how am I supposed to translate out Block.field_94337_cv if it no longer is obfuscated? Will I have to run you're pseudo code in the previous mcp that still had it obfuscated? EDIT: Found out it's activator rail through your code, thanks
  16. Using the latest mcp I had this in my paxel tool's public static final Block[] blocksEffectiveAggainst variable. Block.field_94337_cv But with mcp updating it's references of methods and Block ID's, I have no clue what actual block this is. Any idea folks? My best bet is one of the 4 new blocks added: Quartz Ore, Quartz, Hopper, or Redstone Block. But I'm not sure which one it is Mcp's changelog only says "Updated to client 1.5.1 & server 1.5.1"
  17. Alright thanks. Any forge modding series on youtube you recommend?
  18. What I mean is how hard will it be for me to adapt to it from modding with modLoader? I've made several mods before but with modLoader, not Forge. Also how what's the difficulty of modding with it over modLoader? Easier, harder. One last thing too. How long does it roughly take for Forge to update to the latest minecraft? Pre-release 1.5 is out and 1.5 will be officially out on Wednesday. Just curious. I hate switching minecraft versions but it bugs me because my server is broke until craftBukkit is updated to 1.5 and I don't want to mod for 1.4.7 if Forge for 1.5 is released soon. Thanks in advance for any help
×
×
  • Create New...

Important Information

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