Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

My blocks all appear to have the same texture, even though I have checked over and over my code, and designated the texture from mec2terrain.png they should be using.

 

Any help would be amazing.

 

Thanks in advance

 

Jake

Code

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

package MedievalCraft2;

import java.util.ArrayList;
import java.util.Random;
import net.minecraft.*;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.Block;
import net.minecraft.src.forge.ITextureProvider;

public class BlockPlatinumOre extends Block implements ITextureProvider
{	
    public BlockPlatinumOre(int i, int j)
    {
        super(i, Material.rock);  
        setHardness(6F);
        setResistance(1.0F);
        setLightValue(0.4F);
    }
    public String getTextureFile()
    {
    	return "/MeC2/Terrain/terrain.png";
    }
    public int idDropped(int par1, Random par2Random, int par3)
    {
        return MeC2Items.shardPlatinum.shiftedIndex;
    }
    public int quantityDroppedWithBonus(int par1, Random par2Random)
    {
        return this.quantityDropped(par2Random) + par2Random.nextInt(par1 + 1);
    }
    public int quantityDropped(Random par1Random)
    {
        return 1 + par1Random.nextInt(2);
    }
    public void addCreativeItems(ArrayList itemList)
    {
      itemList.add(new ItemStack(this, 1, 5));
    }
}

 

 

package MedievalCraft2;

import net.minecraft.src.*;
import net.minecraft.src.forge.AchievementPage;
import net.minecraft.src.forge.IEntityInteractHandler;
import net.minecraft.src.forge.MinecraftForge;
import net.minecraft.src.forge.MinecraftForgeClient;
import net.minecraft.src.forge.ITextureProvider;
import net.minecraft.src.forge.NetworkMod;
import java.util.ArrayList;
import java.util.Map;
import java.util.Random;
import net.minecraft.client.Minecraft;

public class mod_MedievalCraft2 extends BaseMod
{
public static OreHandler oreHandler;

public static final Block limestone = new BlockLimestone(125, 16).setBlockName("limestone");
public static final Block slate = new BlockSlate(126, 17).setBlockName("slate");
public static final Block oreZerzerite = new BlockZerzeriteOre(127, 0).setBlockName("oreZerzerite");
public static final Block orePlatinum = new BlockPlatinumOre(130, 3).setBlockName("orePlatinum");

public void load()
{
	MinecraftForgeClient.preloadTexture("/MeC2/Terrain/terrain.png");
	MinecraftForgeClient.preloadTexture("/MeC2/GUI/mec2_items1.png");
	MinecraftForgeClient.preloadTexture("/MeC2/GUI/guialchemicalTable.png");
	MinecraftForgeClient.preloadTexture("/MeC2/GUI/guiDrawbridge.png");

	//MinecraftForge.versionDetect(MeC2Default.MeC2, 3, 0, 0);
	MeC2Config.load();
	oreHandler = new OreHandler();
	MinecraftForge.registerOreHandler(oreHandler);  
	//MinecraftForge.registerPickupHandler(new IPickupHandler());

	ModLoader.registerBlock(limestone);
	ModLoader.registerBlock(slate);
	ModLoader.registerBlock(oreZerzerite);
	ModLoader.registerBlock(orePlatinum);

	ModLoader.addName(limestone, "Limestone");
	ModLoader.addName(slate, "Slate");
	ModLoader.addName(oreZerzerite, "Zerzerite Ore");
	ModLoader.addName(orePlatinum, "Platinum Ore");

	MinecraftForge.setBlockHarvestLevel(slate, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(limestone, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(oreZerzerite, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(orePlatinum, "pickaxe", 2);

	AchievementPage page1 = new AchievementPage("Medieval Craft 2" /*ach1, ach2, ach3, ach4*/);
	MinecraftForge.registerAchievementPage(page1);


	ModLoader.addRecipe(new ItemStack(orePlatinum, 4), new Object[]{   "*", Character.valueOf('*'), Block.dirt });
}

public String getPriorities()
{
    return "";
}

public int addFuel(int i, int j)
  {
    if (i == MeC2Items.fuelZerzericCoal.shiftedIndex) {
      return 1600;
    }
    return 0;
  }

public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
    if (MeC2Config.generatePlatinumOre)
    {
      for (int i = 0; i < 8; i++) 
      {
        int randPosX = chunkX + random.nextInt(16);
        int randPosY = random.nextInt(30) + 4;
        int randPosZ = chunkZ + random.nextInt(16);
        new WorldGenMinable(orePlatinum.blockID, 4).generate(world, random, randPosX, randPosY, randPosZ);
      }
    }
}
public String getVersion()
  {
    String version = "1.0.0";
	return "1.0.0";
  }
}

 

All the textures are reading off the first 16x16 block in the "/MeC2/Terrain/terrain.png"

You dont ever set the icon index.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

Pardon? I thought icon index was items. Have I done that somewhere?

 

Edit:

I didn't put static(i, j, ...) I forgot the j....

 

Stupid stupid stupid!

 

Thanks :D

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.