Better Coal! Beta 1.7.3
This mod adds in 4 new coals from real life, Torches, and Blocks for each.
This was originally going to be a kind of realistic coal mod then I realized through research that there is actually a lot that goes into coal, their uses, temps, etc. So it just got turn more into a coal overhual.
This mod does require Modloader Beta 1.7.3, ModloaderMP Unofficial v2, and Forge V1.0.6. This video will show you have to navigate MCArchive and how to download those APIs. MCArchive: Best Place To Get Beta 1.7.3 Mods/APIs
Coal Details
Spoiler
Peat
- is made from any combination of 4 blocks or items on this list, Apple, Cactus, DeadBush, Golden Apple, Leaves, MushroomBrown, MushroomRed, PlanetYellow, PlanetRed, Pumpkin, Reed, Sapling, Seeds, TallGrass, Wheat to get 2 Peat.
- Peat can be used to make Lignite by combining 9 Peat to get 1 Lignite, Mossy Cobblestone by combining 4 Peat and 1 Cobblestone in any combination to get 1 Mossy Cobblestone, and 4 Peat Blocks can be used to make 1 Lignite Block.
- Peat will make 12 torches with a light value of 0.5776F.
- Peat Smelts 4 Items.
- Peat can be used to make a Peat Block that smelts 16 Items.
- Peat does not generation in the world it has to be crafted.
Lignite
- can be found in the earth or made by combining 9 Peat to get 1 Lignite.
- Lignite will make 10 torches with a light value of 0.6675F.
- Lignite Smelts 6 Items.
- Lignite can be used to make a Lignite Block that Smelts 24 Items.
- A Lignite Block is made by combining 4 Peat Blocks to get 1 Lignite Block.
- Lignite generates in that world from 0 to 128 at 10 tries a chunk sized from 1 to 8 in a vein.
- Lignite Ore drops 1 to 4.
Normal Coal
- can be found in the earth or made by combining 2 Lignite and 7 Peat in any combination to get 1 Coal.
- Coal will make 8 torches with a light value of 0.7575F.
- Coal Smelts 8 Items.
- Coal can be used to make a Coal Block that Smelts 32 Items.
- A Coal Block is made by comining 4 Lignite Blocks to get 1 Coal Block.
- Coal generates in that world from 0 to 96 at 10 tries a chunk sized from 1 to 8 in a vein.
- Coal Ore drops 1 to 4.
Bituminous
- can be found in the earth or makes by combining 3 Coal and 6 Peat in any combination to get 1 Bituminous.
- Bituminous will make 6 torches with a light value of 0.8475F.
- Bituminous Smelts 10 Items.
- Bituminous can be used to make a Bituminous Block that Smelts 40 Items.
- A Bituminous Block is made by combining 4 Coal Blocks to get 1 Bituminous Block.
- Bituminous generates in that world from 0 to 64 at 10 tries a chunk sized from 1 to 8 in a vein.
- Bituminous Ore drops 1 to 4.
Anthracite
- can be found in the earth or makes by combining 4 Bituminous and 5 Peat in any combination to get 1 Anthracite.
- Anthracite will make 4 torches with a light value of 0.9375F.
- Anthracite Smelts 12 Items.
- Anthracite can be used to make a Anthracite Block that Smelts 48 Items.
- A Anthracite Block is made by combining 4 Bituminous Blocks to get 1 Anthracite Block.
- Bituminous generates in that world from 0 to 32 at 10 tries a chunk sized from 1 to 8 in a vein.
- Bituminous Ore drops 1 to 4.
- 9 Anthractie Blocks can be used to make 1 Diamond.
Additional Information: Modloader recipes do not override existing recipes, so in order to get the Normal Torch recipes to produce 8 torches instead of 4, I made an edit to the RecipesCrafting class instead of the CraftingManager class because it is less sufficient in the grand scheme of things.
public void addRecipes(CraftingManager craftingManager1) {
craftingManager1.addRecipe(new ItemStack(Block.chest), new Object[]{"###", "# #", "###", '#', Block.planks});
craftingManager1.addRecipe(new ItemStack(Block.stoneOvenIdle), new Object[]{"###", "# #", "###", '#', Block.cobblestone});
craftingManager1.addRecipe(new ItemStack(Block.workbench), new Object[]{"##", "##", '#', Block.planks});
craftingManager1.addRecipe(new ItemStack(Block.sandStone), new Object[]{"##", "##", '#', Block.sand});
craftingManager1.addRecipe(new ItemStack(Block.torchWood, 8), new Object[]{"X", "#", 'X', Item.coal, '#', Item.stick});
craftingManager1.addRecipe(new ItemStack(Block.torchWood, 8), new Object[]{"X", "#", 'X', new ItemStack(Item.coal, 1, 1), '#', Item.stick});
}
For Light Value References a Glowstone Block has a light value of 1.0F being the brightest it gets. In the base game a Torch has the light value of 0.9375F. Which in this mod a regular torch has the light value of 0.7575F. I added the extra torches and changed the light values to give more of a use to the coals.
Generation Code
Spoiler
public void GenerateSurface(World world, Random random, int chunkX, int chunkZ) {
int tries = 10;
int vein = 8;
int posX;
int posY;
int posZ;
int i;
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(128);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockLignite.blockID, vein)).generate(world, random, posX, posY, posZ);
}
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(64);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockBituminous.blockID, vein)).generate(world, random, posX, posY, posZ);
}
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(32);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockAnthracite.blockID, vein)).generate(world, random, posX, posY, posZ);
}
}
Because Modloader generation doesn't override base game generation code I had to edit ChunkProviderGenerate to change coal
for(i13 = 0; i13 < 10; ++i13) {
i14 = i4 + this.rand.nextInt(16);
i15 = this.rand.nextInt(96);
i16 = i5 + this.rand.nextInt(16);
(new WorldGenMinable(Block.oreCoal.blockID, 8)).generate(this.worldObj, this.rand, i14, i15, i16);
}
Originally
for(i13 = 0; i13 < 20; ++i13) {
i14 = i4 + this.rand.nextInt(16);
i15 = this.rand.nextInt(128);
i16 = i5 + this.rand.nextInt(16);
(new WorldGenMinable(Block.oreCoal.blockID, 16)).generate(this.worldObj, this.rand, i14, i15, i16);
}
Here is the main mod class, you'll need to download the mod to view the source code of the other classes. This is a straight copy and paste from my work space, I am not fixing it up to make it more legible on here.
Spoiler
package net.minecraft.src;
import forge.Configuration;
import forge.ITextureProvider;
import forge.MinecraftForge;
import forge.MinecraftForgeClient;
import scifi.bettercoal.BlockAnthracite;
import scifi.bettercoal.BlockBetterCoalStorage;
import scifi.bettercoal.BlockBituminous;
import scifi.bettercoal.BlockLignite;
import scifi.bettercoal.BlockTorchAnthracite;
import scifi.bettercoal.BlockTorchBituminous;
import scifi.bettercoal.BlockTorchLignite;
import scifi.bettercoal.BlockTorchPeat;
import scifi.bettercoal.ItemAnthracite;
import scifi.bettercoal.ItemBituminous;
import scifi.bettercoal.ItemLignite;
import scifi.bettercoal.ItemPeat;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Random;
public class mod_BetterCoal extends BaseModMp {
private static Configuration config;
public static Item itemAnthracite;
public static Item itemBituminous;
public static Item itemLignite;
public static Item itemPeat;
public static int anthraciteID = 6543;
public static int bituminousID = 6544;
public static int ligniteID = 6545;
public static int peatID = 6546;
public static int idAnthracite;
public static int idBituminous;
public static int idLignite;
public static int idAnthraciteTorch;
public static int idBituminousTorch;
public static int idLigniteTorch;
public static int idPeatTorch;
public static int idAnthraciteBlock;
public static int idBituminousBlock;
public static int idCoalBlock;
public static int idLigniteBlock;
public static int idPeatBlock;
public static Block blockAnthracite;
public static Block blockBituminous;
public static Block blockLignite;
public static Block blockAnthraciteTorch;
public static Block blockBituminousTorch;
public static Block blockLigniteTorch;
public static Block blockPeatTorch;
public static Block blockAnthraciteBlock;
public static Block blockBituminousBlock;
public static Block blockCoalBlock;
public static Block blockLigniteBlock;
public static Block blockPeatBlock;
public mod_BetterCoal() {
MinecraftForgeClient.preloadTexture("/scifi/bettercoal/map.png");
itemAnthracite = new ItemAnthracite(anthraciteID);
itemBituminous = new ItemBituminous(bituminousID);
itemLignite = new ItemLignite(ligniteID);
itemPeat = new ItemPeat(peatID);
ModLoader.AddName(itemAnthracite, "Anthracite");
ModLoader.AddName(itemBituminous, "Bituminous");
ModLoader.AddName(itemLignite, "Lignite");
ModLoader.AddName(itemPeat, "Peat");
ModLoader.AddName(blockAnthracite, "Anthracite Ore");
ModLoader.RegisterBlock(blockAnthracite);
ModLoader.AddName(blockBituminous, "Bituminous Ore");
ModLoader.RegisterBlock(blockBituminous);
ModLoader.AddName(blockLignite, "Lignite Ore");
ModLoader.RegisterBlock(blockLignite);
ModLoader.AddName(blockAnthraciteTorch, "Anthracite Torch");
ModLoader.RegisterBlock(blockAnthraciteTorch);
ModLoader.AddName(blockBituminousTorch, "Bituminous Torch");
ModLoader.RegisterBlock(blockBituminousTorch);
ModLoader.AddName(blockLigniteTorch, "Lignite Torch");
ModLoader.RegisterBlock(blockLigniteTorch);
ModLoader.AddName(blockPeatTorch, "Peat Torch");
ModLoader.RegisterBlock(blockPeatTorch);
ModLoader.AddName(blockAnthraciteBlock, "Anthracite Block");
ModLoader.RegisterBlock(blockAnthraciteBlock);
ModLoader.AddName(blockBituminousBlock, "Bituminous Block");
ModLoader.RegisterBlock(blockBituminousBlock);
ModLoader.AddName(blockCoalBlock, "Coal Block");
ModLoader.RegisterBlock(blockCoalBlock);
ModLoader.AddName(blockLigniteBlock, "Lignite Block");
ModLoader.RegisterBlock(blockLigniteBlock);
ModLoader.AddName(blockPeatBlock, "Peat Block");
ModLoader.RegisterBlock(blockPeatBlock);
MinecraftForge.setBlockHarvestLevel(blockAnthracite, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockBituminous, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockLignite, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockAnthraciteBlock, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockBituminousBlock, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockCoalBlock, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockLigniteBlock, "pickaxe", 0);
MinecraftForge.setBlockHarvestLevel(blockPeatBlock, "axe", 0);
// ModLoader.AddRecipe(new ItemStack(blockPeatBlock, 64), new Object[]{"Y", 'Y', Block.dirt});
// ModLoader.AddShapelessRecipe(new ItemStack(itemPeat, 2), new Object[]{Block.pumpkin, Block.pumpkin, Block.pumpkin, Block.pumpkin});
ModLoader.AddRecipe(new ItemStack(blockAnthraciteTorch, 4), new Object[]{"X", "Y", 'X', itemAnthracite, 'Y', Item.stick});
ModLoader.AddRecipe(new ItemStack(blockBituminousTorch, 6), new Object[]{"X", "Y", 'X', itemBituminous, 'Y', Item.stick});
ModLoader.AddRecipe(new ItemStack(blockLigniteTorch, 10), new Object[]{"X", "Y", 'X', itemLignite, 'Y', Item.stick});
ModLoader.AddRecipe(new ItemStack(blockPeatTorch, 12), new Object[]{"X", "Y", 'X', itemPeat, 'Y', Item.stick});
ModLoader.AddRecipe(new ItemStack(Item.diamond, 1), new Object[]{"XXX", "XXX", "XXX", 'X', blockAnthraciteBlock});
ModLoader.AddRecipe(new ItemStack(blockAnthraciteBlock, 1), new Object[]{"XX", "XX", 'X', blockBituminousBlock});
ModLoader.AddRecipe(new ItemStack(blockBituminousBlock, 1), new Object[]{"XX", "XX", 'X', blockCoalBlock});
ModLoader.AddRecipe(new ItemStack(blockCoalBlock, 1), new Object[]{"XX", "XX", 'X', blockLigniteBlock});
ModLoader.AddRecipe(new ItemStack(blockLigniteBlock, 1), new Object[]{"XX", "XX", 'X', blockPeatBlock});
ModLoader.AddRecipe(new ItemStack(blockPeatBlock, 1), new Object[]{"XX", "XX", 'X', itemPeat});
ModLoader.AddShapelessRecipe(new ItemStack(itemPeat, 4), new Object[]{Item.appleGold, Item.appleGold, Item.appleGold, Item.appleGold});
ModLoader.AddShapelessRecipe(new ItemStack(Block.cobblestoneMossy, 1), new Object[]{Block.cobblestone, itemPeat, itemPeat, itemPeat, itemPeat});
ModLoader.AddShapelessRecipe(new ItemStack(itemLignite, 1), new Object[]{itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat});
ModLoader.AddShapelessRecipe(new ItemStack(Item.coal, 1), new Object[]{itemLignite, itemLignite, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat});
ModLoader.AddShapelessRecipe(new ItemStack(itemBituminous, 1), new Object[]{Item.coal, Item.coal, Item.coal, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat});
ModLoader.AddShapelessRecipe(new ItemStack(itemAnthracite, 1), new Object[]{itemBituminous, itemBituminous, itemBituminous, itemBituminous, itemPeat, itemPeat, itemPeat, itemPeat, itemPeat});
Object[] itemIDs = new Object[]{Item.appleRed, Block.cactus, Block.deadBush, new ItemStack(Block.leaves, 1, 0), new ItemStack(Block.leaves, 1, 1), new ItemStack(Block.leaves, 1, 2),
Block.mushroomBrown, Block.mushroomRed, Block.plantYellow, Block.plantRed, Block.pumpkin, Item.reed, Block.reed,
new ItemStack(Block.sapling, 1, 0), new ItemStack(Block.sapling, 1, 1), new ItemStack(Block.sapling, 1, 2), Item.seeds, Block.tallGrass, Item.wheat};
//Apple, Cactus, DeadBush, Golden Apple, Leaves, MushroomBrown, MushroomRed, PlanetYellow, PlanetRed, Pumpkin, Reed, Sapling, Seeds, TallGrass, Wheat
for(int one = 0; one < itemIDs.length; one++) {
for(int two = 0; two < itemIDs.length; two++) {
for(int three = 0; three < itemIDs.length; three++) {
for(int four = 0; four < itemIDs.length; four++) {
ModLoader.AddShapelessRecipe(new ItemStack(itemPeat, 2), new Object[]{itemIDs[one],itemIDs[two],itemIDs[three],itemIDs[four]});
}
}
}
}
Block.blocksList[Block.oreCoal.blockID] = null;
Block.blocksList[Block.torchWood.blockID] = null;
Field[] fields = Block.class.getDeclaredFields();
for(int i = 0; i < fields.length; ++i) {
Field field = fields[i];
try {
Field modifiers;
if(((Block)field.get((Object)null)).equals(Block.oreCoal)) {
field.setAccessible(true);
modifiers = Field.class.getDeclaredField("modifiers");
modifiers.setAccessible(true);
modifiers.set(field, field.getModifiers() & -17);
field.set((Object)null, new OverridenBlockOre());
}
if(((Block)field.get((Object)null)).equals(Block.torchWood)) {
field.setAccessible(true);
modifiers = Field.class.getDeclaredField("modifiers");
modifiers.setAccessible(true);
modifiers.set(field, field.getModifiers() & -17);
field.set((Object)null, new OverridenBlockTorch());
}
} catch (Exception exception5) {
}
}
ModLoader.SetInGameHook(this, true, false);
}
public String Version() {
return "v1.0";
}
public String Name() {
return "Better Coal";
}
public int AddFuel(int id) {
if (id == blockAnthraciteBlock.blockID) {
return 9600;
} else if (id == blockBituminousBlock.blockID) {
return 8000;
} else if (id == blockCoalBlock.blockID) {
return 6400;
} else if (id == blockLigniteBlock.blockID) {
return 4800;
} else if (id == blockPeatBlock.blockID) {
return 3200;
} else if (id == itemAnthracite.shiftedIndex) {
return 2400;
} else if (id == itemBituminous.shiftedIndex) {
return 2000;
} else if (id == itemLignite.shiftedIndex) {
return 1200;
} else {
return id == itemPeat.shiftedIndex ? 800 : 0;
}
}
public void GenerateSurface(World world, Random random, int chunkX, int chunkZ) {
int tries = 10;
int vein = 8;
int posX;
int posY;
int posZ;
int i;
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(128);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockLignite.blockID, vein)).generate(world, random, posX, posY, posZ);
}
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(64);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockBituminous.blockID, vein)).generate(world, random, posX, posY, posZ);
}
for(i = 0; i < tries; ++i) {
posX = chunkX + random.nextInt(16);
posY = random.nextInt(32);
posZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(blockAnthracite.blockID, vein)).generate(world, random, posX, posY, posZ);
}
}
static {
try {
(config = new Configuration(new File("./config/BetterCoal.cfg"))).load();
} catch (Exception exception1) {
System.out.println("[Better Coal] Error while trying to access configuration!");
throw new RuntimeException(exception1);
}
anthraciteID = Integer.valueOf(config.getOrCreateIntProperty("Anthracite Item ID", 2, 6543).value).intValue();
bituminousID = Integer.valueOf(config.getOrCreateIntProperty("Bituminous Item ID", 2, 6544).value).intValue();
ligniteID = Integer.valueOf(config.getOrCreateIntProperty("Lignite Item ID", 2, 6545).value).intValue();
peatID = Integer.valueOf(config.getOrCreateIntProperty("Peat Item ID", 2, 6546).value).intValue();
idAnthracite = Integer.valueOf(config.getOrCreateIntProperty("Anthracite Ore Block ID", 1, 167).value).intValue();
idBituminous = Integer.valueOf(config.getOrCreateIntProperty("Bituminous Ore Block ID", 1, 168).value).intValue();
idLignite = Integer.valueOf(config.getOrCreateIntProperty("Lignite Ore Block ID", 1, 169).value).intValue();
idAnthraciteTorch = Integer.valueOf(config.getOrCreateIntProperty("Anthracite Torch Block ID", 1, 170).value).intValue();
idBituminousTorch = Integer.valueOf(config.getOrCreateIntProperty("Bituminous Torch Block ID", 1, 171).value).intValue();
idLigniteTorch = Integer.valueOf(config.getOrCreateIntProperty("Lignite Torch Block ID", 1, 172).value).intValue();
idPeatTorch = Integer.valueOf(config.getOrCreateIntProperty("Peat Torch Block ID", 1, 173).value).intValue();
idAnthraciteBlock = Integer.valueOf(config.getOrCreateIntProperty("Anthracite Block ID", 1, 174).value).intValue();
idBituminousBlock = Integer.valueOf(config.getOrCreateIntProperty("Bituminous Block ID", 1, 175).value).intValue();
idCoalBlock = Integer.valueOf(config.getOrCreateIntProperty("Coal Block ID", 1, 176).value).intValue();
idLigniteBlock = Integer.valueOf(config.getOrCreateIntProperty("Lignite Block ID", 1, 177).value).intValue();
idPeatBlock = Integer.valueOf(config.getOrCreateIntProperty("Peat Block ID", 1, 178).value).intValue();
if(config != null) {
config.save();
}
blockAnthracite = (new BlockAnthracite(idAnthracite, 0)).setHardness(5.0F).setResistance(15.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Anthracite Ore");
blockBituminous = (new BlockBituminous(idBituminous, 1)).setHardness(4.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Bituminous Ore");
blockLignite = (new BlockLignite(idLignite, 2)).setHardness(2.0F).setResistance(4.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Lignite Ore");
blockAnthraciteTorch = (new BlockTorchAnthracite(idAnthraciteTorch, 7)).setResistance(15.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Anthracite Torch");
blockBituminousTorch = (new BlockTorchBituminous(idBituminousTorch, 8)).setResistance(10.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Bituminous Torch");
blockLigniteTorch = (new BlockTorchLignite(idLigniteTorch, 9)).setResistance(4.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Lignite Torch");
blockPeatTorch = (new BlockTorchPeat(idPeatTorch, 10)).setResistance(4.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Peat Torch");
blockAnthraciteBlock = (new BlockBetterCoalStorage(idAnthraciteBlock, 11)).setHardness(7.0F).setResistance(20.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Anthracite Block");
blockBituminousBlock = (new BlockBetterCoalStorage(idBituminousBlock, 12)).setHardness(6.0F).setResistance(15.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Bituminous Block");
blockCoalBlock = (new BlockBetterCoalStorage(idCoalBlock, 13)).setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Coal Block");
blockLigniteBlock = (new BlockBetterCoalStorage(idLigniteBlock, 14)).setHardness(4.0F).setResistance(9.0F).setStepSound(Block.soundStoneFootstep).setBlockName("Lignite Block");
blockPeatBlock = (new BlockBetterCoalStorage(idPeatBlock, 15)).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("Peat Block");
}
public class OverridenBlockOre extends BlockOre {
public OverridenBlockOre() {
super(Block.oreCoal.blockID, Block.oreCoal.blockIndexInTexture);
this.setHardness(Block.oreCoal.blockHardness);
this.setResistance(Block.oreCoal.blockResistance);
this.setStepSound(Block.oreCoal.stepSound);
this.setBlockName("oreCoal");
this.setTickOnLoad(true);
}
public int quantityDropped(Random random1) {
return this.blockID == Block.oreLapis.blockID ? 4 + random1.nextInt(5) : this.blockID == Block.oreCoal.blockID ? 1 + random1.nextInt(3) : 1;
}
}
public class OverridenBlockTorch extends BlockTorch {
protected OverridenBlockTorch() {
super(Block.torchWood.blockID, Block.torchWood.blockIndexInTexture);
this.setHardness(Block.torchWood.blockHardness);
this.setResistance(Block.torchWood.blockResistance);
this.setStepSound(Block.torchWood.stepSound);
this.setBlockName("torch");
this.setTickOnLoad(true);
}
private boolean func_31032_h(World world, int i, int j, int k) {
return world.isBlockSolidOnSide(i, j, k, 1) || world.getBlockId(i, j, k) == Block.fence.blockID;
}
public void onBlockPlaced(World world, int i, int j, int k, int l) {
this.setLightValue(0.7575F);
int i1 = world.getBlockMetadata(i, j, k);
if(l == 1 && this.func_31032_h(world, i, j - 1, k)) {
i1 = 5;
}
if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2)) {
i1 = 4;
}
if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3)) {
i1 = 3;
}
if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4)) {
i1 = 2;
}
if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5)) {
i1 = 1;
}
world.setBlockMetadataWithNotify(i, j, k, i1);
}
}
}
Sorry, for any horrible gammar it is late. I am going to bed now.
Edit: Still tired but I made the code look better using the Markdown supported formatting. - 18/03/2024
Project members
poopiedoopie9002
Member