Jump to content

Forge Animated Texture


Bksparkie1

Recommended Posts

Ok so i am trying to create an animated texture like water but its going inside a block ive but the texture is not animated when i enter the world... ive tried changing setting, the only difference i really need from the main waterfx is that my texture is in a different png and a different colour, if someone could point out my mistake please post thank you

 

mod Class File

 

 

 

package net.minecraft.src.electricalagemod;

 

import java.lang.reflect.Method;

import java.util.Random;

import java.util.logging.Level;

 

 

import net.minecraft.src.Block;

import net.minecraft.src.Item;

import net.minecraft.src.ItemReed;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Material;

import net.minecraft.src.ModLoader;

import net.minecraft.src.TextureWaterFX;

import net.minecraft.src.World;

import net.minecraft.src.WorldGenMinable;

import net.minecraft.src.electricalagemod.BlastFurnaceRender;

import net.minecraft.src.electricalagemod.BlastFurnaceRender1;

import net.minecraft.src.electricalagemod.BlastFurnaceRender2;

import net.minecraft.src.electricalagemod.BlastFurnaceRender3;

import net.minecraft.src.electricalagemod.BlockBlastFurnace;

import net.minecraft.src.electricalagemod.BlockCopper;

import net.minecraft.src.electricalagemod.BlockMold;

import net.minecraft.src.electricalagemod.BlockMold1;

import net.minecraft.src.electricalagemod.BlockMold2;

import net.minecraft.src.electricalagemod.BlockMold3;

import net.minecraft.src.electricalagemod.BlockSilicone;

import net.minecraft.src.electricalagemod.BlockTin;

import net.minecraft.src.electricalagemod.BlockUranium;

import net.minecraft.src.electricalagemod.ItemBattery;

import net.minecraft.src.electricalagemod.ItemBrush;

import net.minecraft.src.electricalagemod.ItemCircuit;

import net.minecraft.src.electricalagemod.ItemCoolant;

import net.minecraft.src.electricalagemod.ItemCopperIngot;

import net.minecraft.src.electricalagemod.ItemCopperLiquid;

import net.minecraft.src.electricalagemod.ItemCrankShaft;

import net.minecraft.src.electricalagemod.ItemEmptyTinBucket;

import net.minecraft.src.electricalagemod.ItemGoldliquid;

import net.minecraft.src.electricalagemod.ItemHeatSensor;

import net.minecraft.src.electricalagemod.ItemIronliquid;

import net.minecraft.src.electricalagemod.ItemMagnet;

import net.minecraft.src.electricalagemod.ItemTinIngot;

import net.minecraft.src.electricalagemod.ItemTinliquid;

import net.minecraft.src.electricalagemod.ItemTransformer;

import net.minecraft.src.electricalagemod.ItemTurbine;

import net.minecraft.src.electricalagemod.Mold1Render;

import net.minecraft.src.electricalagemod.Mold2Render;

import net.minecraft.src.electricalagemod.Mold3Render;

import net.minecraft.src.electricalagemod.MoldRender;

import net.minecraftforge.client.MinecraftForgeClient;

import net.minecraftforge.common.Configuration;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.FMLLog;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Instance;

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.network.NetworkRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid = "Electricalage", name = "Electrical Age", version = "1.2.1")

public class Electricalage{

 

//Ores

public static final Block Tin = (new BlockTin(200)).setBlockName("Tin Ore").setHardness(1F).setResistance(5F);

public static final Block Copper = (new BlockCopper(201)).setHardness(1F).setResistance(5F).setBlockName("Copper");

public static final Block Uranium = (new BlockUranium(222)).setBlockName("Uranium Ore").setHardness(1F).setResistance(7F);

    public static final Block Silicone = (new BlockSilicone(204)).setBlockName("Silicone Ore").setHardness(1F).setResistance(5F);

    //Ingots/materials

    public static final Item CopperIngot = (new ItemCopperIngot(1130)).setItemName("CopperIngot");

    public static final Item CopperLiquid = (new ItemCopperLiquid(1140)).setItemName("Liquid Copper");

    public static final Item TinIngot = (new ItemTinIngot(1120)).setItemName("TinIngot");

    public static final Item TinLiquid = (new ItemTinliquid(1110)).setItemName("Liquid Tin");

    public static final Item IronLiquid = (new ItemIronliquid(1210)).setItemName("Liquid Iron");

    public static final Item GoldLiquid = (new ItemGoldliquid(1211)).setItemName("Liquid Gold");

    //Items

    public static final Item Battery = (new ItemBattery(1010)).setItemName("Battery");

    public static final Item CrankShaft = (new ItemCrankShaft(1020)).setItemName("Crank Shaft");

    public static final Item HeatSensor = (new ItemHeatSensor(1030)).setItemName("Heat Sensor");

    public static final Item Circuit = (new ItemCircuit(1040)).setItemName("Circuit");

    public static final Item Coolant = (new ItemCoolant(1050)).setItemName("Coolant");

    public static final Item Transformer = (new ItemTransformer(1060)).setItemName("Transformer");

    public static final Item Turbine = (new ItemTurbine(1070)).setItemName("Turbine");

    public static final Item Magnet = (new ItemMagnet(1080)).setItemName("Magnet");

    public static final Item Brush = (new ItemBrush(1090)).setItemName("Brush");

    public static final Item EmptyBucket = (new ItemEmptyTinBucket(1112)).setIconCoord(10, 4).setItemName("Empty Bucket");

    //Machines

    //BlastFurnace

    public static Block BlastFurnace = new BlockBlastFurnace(213).setResistance(.5F).setBlockName("Blast Furnace").setHardness(0.5f).setRequiresSelfNotify();

    public static Block TestBlock = new BlockTestBlock(237, Material.rock);

    public static Item BlastFurnace4 = new ItemReed(1510,BlastFurnace).setItemName("Blast Furnace");

    public static int Blocklevels = 1;

    public static int BlastFurnaceliquid;

    //Mold

    public static Block Mold = new BlockMold(217, net.minecraft.src.electricalagemod.MoldTileEntity.class).setResistance(.5F).setBlockName("Blast Furnace").setHardness(0.5f).setRequiresSelfNotify();

    public static Block Mold1 = new BlockMold1(218, net.minecraft.src.electricalagemod.Mold1TileEntity.class).setResistance(.5F).setBlockName("Mold").setHardness(0.5f).setRequiresSelfNotify();

    public static Block Mold2 = new BlockMold2(219, net.minecraft.src.electricalagemod.Mold2TileEntity.class).setResistance(.5F).setBlockName("Mold").setHardness(0.5f).setRequiresSelfNotify();

    public static Block Mold3 = new BlockMold3(220, net.minecraft.src.electricalagemod.Mold3TileEntity.class).setResistance(.5F).setBlockName("Mold").setHardness(0.5f).setRequiresSelfNotify();

    public static Item Mold4 = new ItemReed(1511,Mold).setItemName("Blast Furnace");

 

   

    //RenderMachines

    BlastFurnaceRender tileent1 = new BlastFurnaceRender();

    BlastFurnaceRender1 tileent2 = new BlastFurnaceRender1();

    BlastFurnaceRender2 tileent3 = new BlastFurnaceRender2();

    BlastFurnaceRender3 tileent4 = new BlastFurnaceRender3();

    MoldRender tileent5 = new MoldRender();

    Mold1Render tileent6 = new Mold1Render();

    Mold2Render tileent7 = new Mold2Render();

    Mold3Render tileent8 = new Mold3Render();

    //TODO List

    {

    preLoadTextures(null);

    registerBlocks(null);

    registerTileEntities(null);

    addName(null);

    addRecipes(null);

   

    }

  //PreLoadTextures

   

    public void preLoadTextures(FMLPreInitializationEvent event){

    //MyAnimation Texture

    ModLoader.addAnimation(new TextureBlastFurnaceFX());

   

    MinecraftForgeClient.preloadTexture("/ElectricalageBlocks.png");   

MinecraftForgeClient.preloadTexture("/CopperOre.png");

        MinecraftForgeClient.preloadTexture("/BlastFurnaceSide.png");

    }

  //RegisterTileEntitys

   

    public void registerTileEntities(FMLPreInitializationEvent event){

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.BlastFurnaceTileEntity.class, "BlastFurnaceTileEntity",tileent1);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.BlastFurnace1TileEntity.class, "BlastFurnace1TileEntity",tileent2);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.BlastFurnace2TileEntity.class, "BlastFurnace2TileEntity",tileent3);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.BlastFurnace3TileEntity.class, "BlastFurnace3TileEntity",tileent4);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.MoldTileEntity.class, "MoldTileEntity",tileent5);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.Mold1TileEntity.class, "Mold1TileEntity",tileent6);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.Mold2TileEntity.class, "Mold2TileEntity",tileent7);

    ModLoader.registerTileEntity(net.minecraft.src.electricalagemod.Mold3TileEntity.class, "Mold3TileEntity",tileent8);}

  //RegisterBlocks

   

    public void registerBlocks(FMLPreInitializationEvent event){

   

   

    ModLoader.registerBlock(Mold);

ModLoader.registerBlock(BlastFurnace);

ModLoader.registerBlock(Copper);

    ModLoader.registerBlock(Silicone);

    ModLoader.registerBlock(Uranium);

    ModLoader.registerBlock(Tin);

    ModLoader.registerBlock(Copper);

   

   

    }

  //AddNames

   

    public void addName(FMLPreInitializationEvent event){

    ModLoader.addName(Copper, "en_US", "Copper");

    ModLoader.addName(Turbine, "Turbine");

        ModLoader.addName(Magnet, "Magnet");

        ModLoader.addName(Brush, "Brush");

        ModLoader.addName(TinLiquid, "Liquid Tin");

        ModLoader.addName(CopperLiquid, "Liquid Copper");

        ModLoader.addName(IronLiquid, "Liquid Iron");

        ModLoader.addName(GoldLiquid, "Liquid Gold");

        ModLoader.addName(EmptyBucket, "Empty Bucket");

    ModLoader.addName(Transformer, "Transformer");

    ModLoader.addName(Coolant, "Coolant");

        ModLoader.addName(Circuit, "Circuit");

    ModLoader.addName(HeatSensor, "Heat Sensor");

    ModLoader.addName(CrankShaft, "Crank Shaft");

    ModLoader.addName(Battery, "Battery");

    ModLoader.addName(Silicone, "Silicone Ore");

    ModLoader.addName(Uranium, "Uranium Ore");

    ModLoader.addName(CopperIngot, "Copper Ingot");

    ModLoader.addName(TinIngot, "Tin Ingot");

    ModLoader.addName(Tin, "Tin Ore");}

  //PickaxeHarvestLevels

   

    public void pickaxeHarvestLevels(FMLPreInitializationEvent event){

        MinecraftForge.setBlockHarvestLevel(Tin, "pickaxe", 3);

        MinecraftForge.setBlockHarvestLevel(Copper, "pickaxe", 2);

        MinecraftForge.setBlockHarvestLevel(Uranium, "pickaxe", 3);

    }

  //AddRecipes

   

    public void addRecipes(FMLPreInitializationEvent event) {

    ModLoader.addSmelting(Copper.blockID, new ItemStack(CopperIngot, 1));

  ModLoader.addSmelting(Tin.blockID, new ItemStack(TinIngot, 1));

    ModLoader.addRecipe(new ItemStack(Block.waterStill, 1), new Object []{

" XX", "  ", "  ", Character.valueOf('X'), Block.dirt});

    ModLoader.addRecipe(new ItemStack(Item.bucketEmpty, 1), new Object []{

" X ", "  ", "  ", Character.valueOf('X'), Block.dirt});

    ModLoader.addRecipe(new ItemStack(Copper, 1), new Object []{

"  ", "  ", "XXX", Character.valueOf('X'), Block.dirt});

   

    ModLoader.addRecipe(new ItemStack(Tin, 1), new Object []{

"  ", "XXX", "XXX", Character.valueOf('X'), Block.dirt});

    ModLoader.addShapelessRecipe(new ItemStack(BlastFurnace4), new Object[]{

Block.dirt

});

ModLoader.addShapelessRecipe(new ItemStack(Mold4), new Object[]{

Block.wood

.wood

});}

  //GenerateOres

    public void generateSurface(World world, Random random, int i, int j)

    {

        for (int k = 0; k < 5; k++)

        {

            int l = i + random.nextInt(16);

            int i1 = random.nextInt(64);

            int j1 = j + random.nextInt(16);

            (new WorldGenMinable(Tin.blockID, 12)).generate(world, random, l, i1, j1);

        }

        for (int k = 0; k < 6; k++)

        {

            int l = i + random.nextInt(16);

            int i1 = random.nextInt(64);

            int j1 = j + random.nextInt(16);

            (new WorldGenMinable(Copper.blockID, 12)).generate(world, random, l, i1, j1);

        }

        for (int k = 0; k < 4; k++)

        {

            int l = i + random.nextInt(16);

            int i1 = random.nextInt(34);

            int j1 = j + random.nextInt(16);

            (new WorldGenMinable(Uranium.blockID, 8)).generate(world, random, l, i1, j1);

        }

        for (int k = 0; k < 4; k++)

        {

            int l = i + random.nextInt(16);

            int i1 = random.nextInt(34);

            int j1 = j + random.nextInt(16);

            (new WorldGenMinable(Silicone.blockID, 8)).generate(world, random, l, i1, j1); }

            }

   

}

 

 

 

TestBlock Class

 

 

package net.minecraft.src.electricalagemod;

 

import net.minecraft.src.Block;

import net.minecraft.src.Material;

 

public class BlockTestBlock extends Block {

 

public BlockTestBlock(int par1, Material par2Material) {

super(par1, Material.rock);

this.blockIndexInTexture = 205;

// TODO Auto-generated constructor stub

}

 

 

@Override

 

public String getTextureFile() {

  return "/ElectricalageBlocks.png";

}}

 

 

 

TextureFx Class

 

 

package net.minecraft.src.electricalagemod;

 

import cpw.mods.fml.client.FMLTextureFX;

 

public class TextureBlastFurnaceFX extends FMLTextureFX

{

    /** red RGB value for water texture */

    protected float[] red = new float[256];

 

    /** green RGB value for water texture */

    protected float[] green = new float[256];

 

    /** blue RGB value for water texture */

    protected float[] blue = new float[256];

 

    /** alpha RGB value for water texture */

    protected float[] alpha = new float[256];

    private int tickCounter = 0;

 

    public TextureBlastFurnaceFX()

    {

        super(Electricalage.TestBlock.blockIndexInTexture);

setup();

    }

 

    @Override

    public void setup()

    {

        super.setup();

        red = new float[tileSizeSquare];

        green = new float[tileSizeSquare];

        blue = new float[tileSizeSquare];

        alpha = new float[tileSizeSquare];

        tickCounter = 0;

    }

   

    public void onTick()

    {

        ++this.tickCounter;

        int var1;

        int var2;

        float var3;

        int var5;

        int var6;

 

        for (var1 = 0; var1 < tileSizeBase; ++var1)

        {

            for (var2 = 0; var2 < tileSizeBase; ++var2)

            {

                var3 = 0.0F;

 

                for (int var4 = var1 - 1; var4 <= var1 + 1; ++var4)

                {

                    var5 = var4 & tileSizeMask;

                    var6 = var2 & tileSizeMask;

                    var3 += this.red[var5 + var6 * tileSizeBase];

                }

 

                this.green[var1 + var2 * tileSizeBase] = var3 / 3.3F + this.blue[var1 + var2 * tileSizeBase] * 0.8F;

            }

        }

 

        for (var1 = 0; var1 < tileSizeBase; ++var1)

        {

            for (var2 = 0; var2 < tileSizeBase; ++var2)

            {

                this.blue[var1 + var2 * tileSizeBase] += this.alpha[var1 + var2 * tileSizeBase] * 0.05F;

 

                if (this.blue[var1 + var2 * tileSizeBase] < 0.0F)

                {

                    this.blue[var1 + var2 * tileSizeBase] = 0.0F;

                }

 

                this.alpha[var1 + var2 * tileSizeBase] -= 0.1F;

 

                if (Math.random() < 0.05D)

                {

                    this.alpha[var1 + var2 * tileSizeBase] = 0.5F;

                }

            }

        }

 

        float[] var12 = this.green;

        this.green = this.red;

        this.red = var12;

 

        for (var2 = 0; var2 < tileSizeSquare; ++var2)

        {

            var3 = this.red[var2];

 

            if (var3 > 1.0F)

            {

                var3 = 1.0F;

            }

 

            if (var3 < 0.0F)

            {

                var3 = 0.0F;

            }

 

            float var13 = var3 * var3;

            var5 = (int)(32.0F + var13 * 32.0F);

            var6 = (int)(50.0F + var13 * 64.0F);

            int var7 = 255;

            int var8 = (int)(146.0F + var13 * 50.0F);

 

            if (this.anaglyphEnabled)

            {

                int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;

                int var10 = (var5 * 30 + var6 * 70) / 100;

                int var11 = (var5 * 30 + var7 * 70) / 100;

                var5 = var9;

                var6 = var10;

                var7 = var11;

            }

 

            this.imageData[var2 * 4 + 0] = (byte)var5;

            this.imageData[var2 * 4 + 1] = (byte)var6;

            this.imageData[var2 * 4 + 2] = (byte)var7;

            this.imageData[var2 * 4 + 3] = (byte)var8;

        }

    }

}

 

 

 

 

id be extremely appreciative to any help anyone could give me

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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