Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Added first round of nether tech #5
Browse files Browse the repository at this point in the history
Solid fuels (Nether Coal, Nether Coal Block)
AE Integration
Mekanism Integration
Cleaned up a bit of stuff.
Added pack.mcmeta to get it to stop complaining about it.

Still need more integration points, only works with UE builds right now
:P

Works with vanilla as well, surround charcoal with nether rack.
  • Loading branch information
renevo committed Sep 17, 2013
1 parent 410446c commit 47f873d
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 65 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Wed, 10 Jul 2013 19:02:52 -0700
#Mon, 16 Sep 2013 17:10:08 -0700
release.minecraft.version=1.6.2
release.number=14
release.number=17
45 changes: 37 additions & 8 deletions src/common/burptech/BurpTechConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import java.io.File;

import burptech.block.Blocks;
import burptech.item.Items;
import burptech.block.*;
import burptech.item.*;
import burptech.lib.*;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import net.minecraftforge.common.*;

/*
* All config for BurpTech here
Expand All @@ -19,14 +18,27 @@ public class BurpTechConfig
public Property enableMobsEatingOffOfGround;
public Property enableMobsWandering;
public Property enableGreedyVillagers;
public Property enableIlluminatedCocoa;

public Property recipeCobwebs;
public Property recipePortableWorkbench;
public Property recipeRucksack;
public Property recipeEnderRucksack;

public Property recipeCookedEgg;

public Property enableNetherTechSolidFuels;

public Property blockIlluminatedCocoa;
public Property blockNetherCoal;

public Property itemEnderRucksack;
public Property itemRucksack;
public Property itemPortableWorkbench;
public Property itemCookedEgg;
public Property itemNetherDust;
public Property itemNetherCoal;

/*
* BurpTech Items
*/
Expand Down Expand Up @@ -67,6 +79,9 @@ public static BurpTechConfig load(File configFolder)
result.enableGreedyVillagers = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "EnableGreedyVillagers", true);
result.enableGreedyVillagers.comment = "When enabled, villagers will follow players with diamonds and emeralds in there hands";

result.enableIlluminatedCocoa = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "IlluminatedCocoaPlants", true);
result.enableIlluminatedCocoa.comment = "When enabled, allows you to right click a grown cocoa plant with glowstone to turn it into a lamp";

// Recipes
result.recipeCobwebs = configuration.get(Constants.CONFIG_CATEGORY_RECIPES, "Cobwebs", true);
result.recipeCobwebs.comment = "Enables crafting of cobwebs from string";
Expand All @@ -83,13 +98,27 @@ public static BurpTechConfig load(File configFolder)
result.recipeCookedEgg = configuration.get(Constants.CONFIG_CATEGORY_RECIPES, "CookedEggs", true);
result.recipeCookedEgg.comment = "Enables cooked eggs for food";

// Nether Tech
result.enableNetherTechSolidFuels = configuration.get(Constants.CONFIG_CATEGORY_NETHERTECH, "SolidFuels", true);
result.enableNetherTechSolidFuels.comment = "Enables Nether Tech Solid Fuels";

// Items
result.items = new Items(configuration);
result.items.create();
result.itemEnderRucksack = configuration.getItem("EnderRucksack", burptech.lib.Constants.ITEM_START + 0);
result.itemRucksack = configuration.getItem("Rucksack", burptech.lib.Constants.ITEM_START + 1);
result.itemPortableWorkbench = configuration.getItem("PortableWorkbench", burptech.lib.Constants.ITEM_START + 2);
result.itemCookedEgg = configuration.getItem("CookedEgg", burptech.lib.Constants.ITEM_START + 3);
result.itemNetherDust = configuration.getItem("NetherDust", burptech.lib.Constants.ITEM_START + 4);
result.itemNetherCoal = configuration.getItem("NetherCoal", burptech.lib.Constants.ITEM_START + 5);

result.items = new Items();
result.items.create(result);

// Blocks
result.blocks = new Blocks(configuration);
result.blocks.create();
result.blockIlluminatedCocoa = configuration.getBlock("IlluminatedCocoaPlant", Constants.BLOCK_START + 0);
result.blockNetherCoal = configuration.getBlock("BlockNetherCoal", Constants.BLOCK_START + 1);

result.blocks = new Blocks();
result.blocks.create(result);

// save only if modified
if (configuration.hasChanged())
Expand Down
4 changes: 2 additions & 2 deletions src/common/burptech/block/BlockIlluminatedCocoa.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public BlockIlluminatedCocoa(int blockId, boolean illuminated)
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (blockID == BurpTechCore.configuration.blocks.illuminatedCocoaOn.blockID)
if (blockID == BurpTechCore.configuration.blocks.blockIlluminatedCocoaOn.blockID)
return true;

int meta = world.getBlockMetadata(x, y, z);
Expand All @@ -37,7 +37,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p

if (currentItem.itemID == Item.glowstone.itemID && ((meta & 12) >> 2) == 2)
{
world.setBlock(x, y, z, BurpTechCore.configuration.blocks.illuminatedCocoaOn.blockID, meta, 1 | 2 | 4);
world.setBlock(x, y, z, BurpTechCore.configuration.blocks.blockIlluminatedCocoaOn.blockID, meta, 1 | 2 | 4);
if (!player.capabilities.isCreativeMode)
{
currentItem.stackSize--;
Expand Down
54 changes: 21 additions & 33 deletions src/common/burptech/block/Blocks.java
Original file line number Diff line number Diff line change
@@ -1,53 +1,41 @@
package burptech.block;

import cpw.mods.fml.common.registry.GameRegistry;
import burptech.BurpTechConfig;
import burptech.BurpTechCore;
import burptech.lib.Constants;
import net.minecraft.block.Block;
import net.minecraftforge.common.*;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

/*
* Block definitions for BurpTech
*/
public class Blocks
{
Configuration configuration;
public Block blockIlluminatedCocoaOn;
public Block blockIlluminatedCocoaOff;
public Block blockNetherCoal;

public Block illuminatedCocoaOn;
public Block illuminatedCocoaOff;

public Property enableIlluminatedCocoa;

/*
* Default constructor
*/
public Blocks(Configuration configuration)
{
this.configuration = configuration;
}

public void create()
public void create(BurpTechConfig configuration)
{
enableIlluminatedCocoa = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "IlluminatedCocoaPlants", true);
enableIlluminatedCocoa.comment = "When enabled, allows you to right click a grown cocoa plant with glowstone to turn it into a lamp";
addIlluminatedCocoa(configuration);

if (enableIlluminatedCocoa.getBoolean(true))
{
BurpTechCore.log.info("Adding Illuminated Cocoa Plants");
AddIlluminatedCocoa(Constants.BLOCK_START + 0);
}
blockNetherCoal = (new Block(configuration.blockNetherCoal.getInt(), Material.rock)).setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("blockNetherCoal").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_coal_block");
GameRegistry.registerBlock(blockNetherCoal, "blockNetherCoal");
}

private void AddIlluminatedCocoa(int defaultBlockID)
private void addIlluminatedCocoa(BurpTechConfig configuration)
{
Property illuminatedCocoaOnBlockId = configuration.getBlock("IlluminatedCocoa", defaultBlockID, "The ID for the Illuminated Cocoa Plants. (Replaces default BlockCocoa)");
if (!configuration.enableIlluminatedCocoa.getBoolean(true))
return;

int illuminatedCocoaPlantID = configuration.blockIlluminatedCocoa.getInt();

int illuminatedCocoaPlantID = illuminatedCocoaOnBlockId.getInt();
if (illuminatedCocoaPlantID != 0)
{
illuminatedCocoaOn = new BlockIlluminatedCocoa(illuminatedCocoaPlantID, true).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa");
int cocoaPlantID = Block.cocoaPlant.blockID;
Block.blocksList[cocoaPlantID] = null;
illuminatedCocoaOff = new BlockIlluminatedCocoa(cocoaPlantID, false).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa");
}
BurpTechCore.log.info("Enabling Illuminated Cocoa Blocks");
blockIlluminatedCocoaOn = new BlockIlluminatedCocoa(illuminatedCocoaPlantID, true).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa");
int cocoaPlantID = Block.cocoaPlant.blockID;
Block.blocksList[cocoaPlantID] = null;
blockIlluminatedCocoaOff = new BlockIlluminatedCocoa(cocoaPlantID, false).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa");
}
}
19 changes: 19 additions & 0 deletions src/common/burptech/integration/AppliedEnergisticsIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package burptech.integration;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import net.minecraft.item.*;

public class AppliedEnergisticsIntegration
{
public static boolean addGrinderRecipe(ItemStack input, ItemStack output)
{
if (Loader.isModLoaded("AppliedEnergistics"))
{
// this is a fire and forget, need to verify that it actually works somehow
return FMLInterModComms.sendMessage("AppliedEnergistics", "add-grindable", input.itemID + "," + input.getItemDamage() + "," + output.itemID + "," + output.getItemDamage() + ",8");
}

return false;
}
}
11 changes: 11 additions & 0 deletions src/common/burptech/integration/GregTechIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package burptech.integration;

import net.minecraft.item.ItemStack;

public class GregTechIntegration
{
public static boolean addGrinderRecipe(ItemStack input, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4)
{
return false;
}
}
11 changes: 11 additions & 0 deletions src/common/burptech/integration/IndustrialcraftIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package burptech.integration;

import net.minecraft.item.*;

public class IndustrialcraftIntegration
{
public static boolean addMaceratorRecipe(ItemStack input, ItemStack output)
{
return false;
}
}
23 changes: 23 additions & 0 deletions src/common/burptech/integration/Integration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package burptech.integration;

import net.minecraft.item.ItemStack;

public class Integration
{
/*
* Adds a basic crushable item to mods that we integrate with. Returns true if any of them worked
*/
public static boolean addCrushableItem(ItemStack input, ItemStack output)
{
boolean isAddedToMod = false;

isAddedToMod = isAddedToMod | AppliedEnergisticsIntegration.addGrinderRecipe(input, output);
isAddedToMod = isAddedToMod | GregTechIntegration.addGrinderRecipe(input, output, null, null, null);
isAddedToMod = isAddedToMod | IndustrialcraftIntegration.addMaceratorRecipe(input, output);
isAddedToMod = isAddedToMod | MekanismIntegration.addCrusherRecipe(input, output);
isAddedToMod = isAddedToMod | RailcraftIntegration.addRockCrusherRecipe(input, output, null, 0);
isAddedToMod = isAddedToMod | ThermalExpansionIntegration.addPulverizerRecipe(input, output, null, 0);

return isAddedToMod;
}
}
28 changes: 28 additions & 0 deletions src/common/burptech/integration/MekanismIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package burptech.integration;

import java.lang.reflect.Method;

import burptech.BurpTechCore;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;

public class MekanismIntegration
{
public static boolean addCrusherRecipe(ItemStack input, ItemStack output)
{
if (!Loader.isModLoaded("Mekanism"))
return false;

try {
Class<?> recipeClass = Class.forName("mekanism.common.RecipeHandler");
Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);

return true;
} catch(Exception e) {
BurpTechCore.log.info("Error while adding Crusher Recipe to Mekanism: " + e.getMessage());
}

return false;
}
}
11 changes: 11 additions & 0 deletions src/common/burptech/integration/RailcraftIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package burptech.integration;

import net.minecraft.item.ItemStack;

public class RailcraftIntegration
{
public static boolean addRockCrusherRecipe(ItemStack input, ItemStack output, ItemStack bonus, float bonusChance)
{
return false;
}
}
11 changes: 11 additions & 0 deletions src/common/burptech/integration/ThermalExpansionIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package burptech.integration;

import net.minecraft.item.ItemStack;

public class ThermalExpansionIntegration
{
public static boolean addPulverizerRecipe(ItemStack input, ItemStack output, ItemStack bonus, float bonusChance)
{
return false;
}
}
39 changes: 19 additions & 20 deletions src/common/burptech/item/Items.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
package burptech.item;

import burptech.lib.Constants;
import burptech.*;
import burptech.lib.*;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraftforge.common.*;

import net.minecraft.item.*;
import net.minecraftforge.oredict.OreDictionary;

/*
* Item definitions for BurpTech
*/
public class Items
{
Configuration configuration;

public Item portableWorkbench;
public Item rucksack;
public Item enderRucksack;

public Item cookedEgg;

/*
* Default constructor
*/
public Items(Configuration configuration)
{
this.configuration = configuration;
}

public Item netherDust;
public Item netherCoal;

/*
* Creates all of the item instances
*/
public void create()
public void create(BurpTechConfig configuration)
{
enderRucksack = new ItemRucksack(configuration.getItem("EnderRucksack", burptech.lib.Constants.ITEM_START + 0).getInt(), true).setUnlocalizedName("enderRucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);
rucksack = new ItemRucksack(configuration.getItem("Rucksack", burptech.lib.Constants.ITEM_START + 1).getInt(), false).setUnlocalizedName("rucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);
portableWorkbench = new ItemPortableWorkbench(configuration.getItem("PortableWorkbench", burptech.lib.Constants.ITEM_START + 2).getInt()).setUnlocalizedName("portableWorkbench").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);;
enderRucksack = new ItemRucksack(configuration.itemEnderRucksack.getInt(), true).setUnlocalizedName("enderRucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);
rucksack = new ItemRucksack(configuration.itemRucksack.getInt(), false).setUnlocalizedName("rucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);
portableWorkbench = new ItemPortableWorkbench(configuration.itemPortableWorkbench.getInt()).setUnlocalizedName("portableWorkbench").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);;

cookedEgg = new ItemFood(configuration.itemCookedEgg.getInt(), 2, .1F, false).setUnlocalizedName("cookedEgg").setTextureName(Constants.MOD_ID + ":" + "egg_cooked").setMaxStackSize(16);

netherDust = new Item(configuration.itemNetherDust.getInt()).setUnlocalizedName("netherDust").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_dust");
// ore dictionary (pulled from: http://minecraftmodcustomstuff.wikia.com/wiki/Ore_Dictionary - more here: http://www.minecraftforge.net/wiki/Common_Oredict_names)
OreDictionary.registerOre("dustNetherrack", netherDust);
OreDictionary.registerOre("itemDustNetherrack", netherDust);

cookedEgg = new ItemFood(configuration.getItem("CookedEgg", burptech.lib.Constants.ITEM_START + 3).getInt(), 2, .1F, false).setUnlocalizedName("cookedEgg").setTextureName(Constants.MOD_ID + ":" + "egg_cooked").setMaxStackSize(16);
netherCoal = new Item(configuration.itemNetherCoal.getInt()).setUnlocalizedName("netherCoal").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_coal");
}

}
27 changes: 27 additions & 0 deletions src/common/burptech/item/NetherTechSolidFuelHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package burptech.item;

import burptech.BurpTechCore;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler;

/**
* Solid Fuel NetherTech Fuel Handler
*
*/
public class NetherTechSolidFuelHandler implements IFuelHandler
{
@Override
public int getBurnTime(ItemStack fuel)
{
if (fuel == null)
return 0;

if (fuel.itemID == BurpTechCore.configuration.items.netherCoal.itemID)
return 1600 * 2; // coal * 2

if (fuel.itemID == BurpTechCore.configuration.blocks.blockNetherCoal.blockID)
return (1600 * 2) * 9; // (coal * 2) * 9

return 0;
}
}
Loading

0 comments on commit 47f873d

Please sign in to comment.