Cleaning up for MC 1.3.* work

This commit is contained in:
pahimar 2012-08-15 14:10:41 -04:00
parent fea27f4298
commit 504e832f1c
53 changed files with 0 additions and 2922 deletions

View file

@ -1,26 +0,0 @@
package ee3.addons;
import net.minecraft.src.Item;
import net.minecraft.src.ModLoader;
import ee3.core.helper.Helper;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BuildCraftAddon extends EEAddon {
public static void init() {
try {
ModLoader.getLogger().finer(Helper.getLogMessage("BuildCraft detected; attempting to initialize BuildCraft addon"));
ModLoader.getLogger().finer(Helper.getLogMessage("BuildCraft addon initialized"));
}
catch (Exception e) {
ModLoader.getLogger().fine(Helper.getLogMessage("Failed to initialize BuildCraft Addon"));
e.printStackTrace(System.err);
}
}
}

View file

@ -1,26 +0,0 @@
package ee3.addons;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EEAddon {
public static Item getModItem(String fieldItemName, String modClassName) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
return (Item)Class.forName(modClassName).getField(fieldItemName).get(null);
}
public static Block getModBlock(String fieldBlockName, String modClassName) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
return (Block)Class.forName(modClassName).getField(fieldBlockName).get(null);
}
public static ItemStack getModItemStack(String fieldItemName, String modClassName) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
return new ItemStack(getModItem(fieldItemName, modClassName));
}
}

View file

@ -1,25 +0,0 @@
package ee3.addons;
import net.minecraft.src.ModLoader;
import ee3.core.helper.Helper;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class IndustrialCraftAddon {
public static void init() {
try {
ModLoader.getLogger().finer(Helper.getLogMessage("IndustrialCraft2 detected; attempting to initialize IndustrialCraft2 addon"));
ModLoader.getLogger().finer(Helper.getLogMessage("IndustrialCraft2 addon initialized"));
}
catch (Exception e) {
ModLoader.getLogger().fine(Helper.getLogMessage("Failed to initialize IndustrialCraft2 addon"));
e.printStackTrace(System.err);
}
}
}

View file

@ -1,25 +0,0 @@
package ee3.addons;
import net.minecraft.src.ModLoader;
import ee3.core.helper.Helper;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class RedPowerAddon {
public static void init() {
try {
ModLoader.getLogger().finer(Helper.getLogMessage("RedPower2 detected; attempting to initialize RedPower2 addon"));
ModLoader.getLogger().finer(Helper.getLogMessage("RedPower2 addon initialized"));
}
catch (Exception e) {
ModLoader.getLogger().fine(Helper.getLogMessage("Failed to initialize RedPower2 addon"));
e.printStackTrace(System.err);
}
}
}

View file

@ -1,44 +0,0 @@
package ee3.block;
import java.util.ArrayList;
import ee3.lib.Reference;
import net.minecraft.src.BlockLog;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.ItemStack;
public class BlockCorruptedLog extends BlockLog {
protected BlockCorruptedLog(int id) {
super(id);
}
public int getBlockColor() {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns the color this block should be rendered. Used by leaves.
*/
public int getRenderColor(int par1) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this, 1, 0));
itemList.add(new ItemStack(this, 1, 1));
itemList.add(new ItemStack(this, 1, 2));
itemList.add(new ItemStack(this, 1, 3));
}
}

View file

@ -1,32 +0,0 @@
package ee3.block;
import ee3.lib.Reference;
import net.minecraft.src.BlockSapling;
import net.minecraft.src.IBlockAccess;
public class BlockCorruptedSapling extends BlockSapling {
protected BlockCorruptedSapling(int par1) {
super(par1, 15);
}
public int getBlockColor() {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns the color this block should be rendered. Used by leaves.
*/
public int getRenderColor(int par1) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
return Integer.parseInt(Reference.hexRedWaterCorruptionOverlayColor, 16);
}
}

View file

@ -1,30 +0,0 @@
package ee3.block;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.forge.ITextureProvider;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockEE extends BlockContainer {
protected BlockEE(int i) {
super(i, Material.rock);
}
@Override
public TileEntity getBlockEntity() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getBlockName() {
return "Test";
}
}

View file

@ -1,32 +0,0 @@
package ee3.block;
import java.util.ArrayList;
import java.util.Random;
import ee3.lib.Reference;
import net.minecraft.src.Block;
import net.minecraft.src.BlockFlowing;
import net.minecraft.src.BlockFluid;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.World;
public class BlockRedWaterFlowing extends BlockFlowing {
protected BlockRedWaterFlowing(int id, Material material) {
super(id, material);
this.blockHardness = 100F;
this.setLightOpacity(3);
this.setBlockName("redWaterFlowing");
}
@Override
public String getTextureFile() {
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
}

View file

@ -1,32 +0,0 @@
package ee3.block;
import java.util.ArrayList;
import ee3.core.helper.LocalizationHelper;
import ee3.lib.Reference;
import net.minecraft.src.BlockStationary;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.World;
public class BlockRedWaterStill extends BlockStationary {
protected BlockRedWaterStill(int id, Material material) {
super(id, material);
this.blockHardness = 100F;
this.setLightOpacity(3);
setBlockName("redWaterStill");
disableStats();
setRequiresSelfNotify();
}
@Override
public String getTextureFile() {
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
}

View file

@ -1,49 +0,0 @@
package ee3.block;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemMetadata;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.ModLoader;
import ee3.lib.BlockIds;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ModBlocks {
public static BlockRedWaterStill redWaterStill;
public static BlockRedWaterFlowing redWaterFlowing;
public static BlockCorruptedLog corruptedLog;
public static BlockCorruptedSapling corruptedSapling;
public static void init() {
redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL, Material.water);
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1, Material.water);
corruptedLog = new BlockCorruptedLog(250);
corruptedSapling = new BlockCorruptedSapling(251);
redWaterStill.setBlockName("redWaterStill");
redWaterFlowing.setBlockName("redWaterFlowing");
corruptedLog.setBlockName("corruptedLog");
corruptedSapling.setBlockName("corruptedSapling");
ModLoader.addName(redWaterStill, "Red Water (Still)");
ModLoader.addName(redWaterFlowing, "Red Water (Flowing)");
ModLoader.addName(corruptedLog, "Corrupted Wood");
ModLoader.addName(corruptedSapling, "Corrupted Sapling");
ModLoader.registerBlock(redWaterStill);
ModLoader.registerBlock(redWaterFlowing);
ModLoader.registerBlock(corruptedLog);
ModLoader.registerBlock(corruptedSapling);
Item.itemsList[corruptedLog.blockID] = (new ItemMetadata(corruptedLog.blockID - 256, corruptedLog)).setItemName("log");
}
}

View file

@ -1,31 +0,0 @@
package ee3.container;
import ee3.item.ModItems;
import net.minecraft.src.ContainerWorkbench;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.InventoryCraftResult;
import net.minecraft.src.InventoryCrafting;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.Slot;
import net.minecraft.src.SlotCrafting;
import net.minecraft.src.World;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerPortableCrafting extends ContainerWorkbench {
public ContainerPortableCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) {
super(par1InventoryPlayer, par2World, par3, par4, par5);
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
}

View file

@ -1,135 +0,0 @@
package ee3.core;
import java.io.File;
import java.util.HashMap;
import static ee3.lib.ItemIds.*;
import static ee3.lib.BlockIds.*;
import ee3.mod_EE3;
import ee3.lib.Reference;
import static net.minecraft.src.forge.Configuration.*;
import net.minecraft.src.forge.Configuration;
import net.minecraft.src.forge.Property;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ConfigurationManager {
private String cfgFile;
private static final String CATEGORY_KEYBIND = "keybinds";
public static boolean AUTO_RESOLVE_IDS;
public static boolean ENABLE_SOUNDS;
public static boolean ENABLE_PARTICLES;
public ConfigurationManager(String cfgFile) {
this.cfgFile = Reference.CONFIG_DIR + cfgFile;
}
public void init() {
Configuration config;
try {
File configFile = new File(mod_EE3.proxy.getMinecraftDir(), cfgFile);
config = new Configuration(configFile);
config.load();
}
catch(Exception e) {
e.printStackTrace();
config = null;
}
if (config != null) {
Property prop;
/* General Configs */
prop = config.getOrCreateBooleanProperty("autoResolve", CATEGORY_GENERAL, false);
AUTO_RESOLVE_IDS = prop.getBoolean(false);
prop = config.getOrCreateBooleanProperty("enableSounds", CATEGORY_GENERAL, true);
ENABLE_SOUNDS = prop.getBoolean(false);
prop = config.getOrCreateBooleanProperty("enableParticles", CATEGORY_GENERAL, true);
ENABLE_PARTICLES = prop.getBoolean(false);
/* Block Ids */
prop = config.getOrCreateBlockIdProperty("redWater", 176);
RED_WATER_STILL = prop.getInt();
/* Item Ids */
prop = config.getOrCreateIntProperty("miniumShard", CATEGORY_ITEM, 27269);
MINIUM_SHARD = prop.getInt();
prop = config.getOrCreateIntProperty("miniumStone", CATEGORY_ITEM, 27270);
MINIUM_STONE = prop.getInt();
prop = config.getOrCreateIntProperty("philStone", CATEGORY_ITEM, 27271);
PHIL_STONE = prop.getInt();
prop = config.getOrCreateIntProperty("djinnRing", CATEGORY_ITEM, 27272);
DJINN_RING = prop.getInt();
prop = config.getOrCreateIntProperty("eyeOfTheVoid", CATEGORY_ITEM, 27273);
EYE_OF_THE_VOID = prop.getInt();
prop = config.getOrCreateIntProperty("idolOfGaia", CATEGORY_ITEM, 27274);
IDOL_OF_GAIA = prop.getInt();
prop = config.getOrCreateIntProperty("umbralDisplacer", CATEGORY_ITEM, 27275);
UMBRAL_DISPLACER = prop.getInt();
prop = config.getOrCreateIntProperty("wikidsTempest", CATEGORY_ITEM, 27276);
WIKIDS_TEMPEST = prop.getInt();
prop = config.getOrCreateIntProperty("hornOfEverflowing", CATEGORY_ITEM, 27277);
HORN_OF_EVERFLOWING = prop.getInt();
prop = config.getOrCreateIntProperty("timelordsPocketWatch", CATEGORY_ITEM, 27278);
TIMELORDS_POCKET_WATCH = prop.getInt();
prop = config.getOrCreateIntProperty("calcinedAsh", CATEGORY_ITEM, 27279);
CALCINED_ASH = prop.getInt();
prop = config.getOrCreateIntProperty("alchemicalCoal", CATEGORY_ITEM, 27280);
ALCHEMICAL_COAL = prop.getInt();
prop = config.getOrCreateIntProperty("mobiusFuel", CATEGORY_ITEM, 27281);
MOBIUS_FUEL = prop.getInt();
prop = config.getOrCreateIntProperty("diviningRod", CATEGORY_ITEM, 27282);
DIVINING_ROD = prop.getInt();
prop = config.getOrCreateIntProperty("panacea", CATEGORY_ITEM, 27283);
PANACEA = prop.getInt();
prop = config.getOrCreateIntProperty("autoMail", CATEGORY_ITEM, 27284);
AUTO_MAIL = prop.getInt();
prop = config.getOrCreateIntProperty("caster", CATEGORY_ITEM, 27285);
CASTER = prop.getInt();
prop = config.getOrCreateIntProperty("projector", CATEGORY_ITEM, 27286);
PROJECTOR = prop.getInt();
prop = config.getOrCreateIntProperty("algot", CATEGORY_ITEM, 27287);
ALGOT = prop.getInt();
prop = config.getOrCreateIntProperty("wolfBoots", CATEGORY_ITEM, 27288);
WOLF_BOOTS = prop.getInt();
prop = config.getOrCreateIntProperty("darkMatter", CATEGORY_ITEM, 27289);
DARK_MATTER = prop.getInt();
prop = config.getOrCreateIntProperty("dmPickaxe", CATEGORY_ITEM, 27290);
DARK_MATTER_PICKAXE = prop.getInt();
prop = config.getOrCreateIntProperty("dmShovel", CATEGORY_ITEM, 27291);
DARK_MATTER_SHOVEL = prop.getInt();
prop = config.getOrCreateIntProperty("dmHoe", CATEGORY_ITEM, 27292);
DARK_MATTER_HOE = prop.getInt();
prop = config.getOrCreateIntProperty("dmShears", CATEGORY_ITEM, 27292);
DARK_MATTER_SHEARS = prop.getInt();
prop = config.getOrCreateIntProperty("dmHammer", CATEGORY_ITEM, 27293);
DARK_MATTER_HAMMER = prop.getInt();
prop = config.getOrCreateIntProperty("dmSword", CATEGORY_ITEM, 27294);
DARK_MATTER_SWORD = prop.getInt();
prop = config.getOrCreateIntProperty("dmBow", CATEGORY_ITEM, 27295);
DARK_MATTER_BOW = prop.getInt();
prop = config.getOrCreateIntProperty("dmFishingRod", CATEGORY_ITEM, 27296);
DARK_MATTER_FISHING_ROD = prop.getInt();
prop = config.getOrCreateIntProperty("dmArmor", CATEGORY_ITEM, 27297);
DARK_MATTER_ARMOR = prop.getInt();
prop = config.getOrCreateIntProperty("wardOfXeno", CATEGORY_ITEM, 27297);
WARD_OF_XENOPHOBIA = prop.getInt();
/* Keybinds */
prop = config.getOrCreateIntProperty("extra", CATEGORY_KEYBIND, 46);
prop = config.getOrCreateIntProperty("charge", CATEGORY_KEYBIND, 47);
prop = config.getOrCreateIntProperty("toggle", CATEGORY_KEYBIND, 34);
prop = config.getOrCreateIntProperty("release", CATEGORY_KEYBIND, 19);
/* Write */
config.save();
}
}
}

View file

@ -1,46 +0,0 @@
package ee3.core;
import ee3.mod_EE3;
import ee3.core.interfaces.IProxy;
import ee3.item.ItemPhilosopherStone;
import ee3.item.ModItems;
import ee3.lib.Reference;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.forge.ICraftingHandler;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CraftingHandler implements ICraftingHandler {
@Override
public void onTakenFromCrafting(EntityPlayer player, ItemStack stack, IInventory craftMatrix) {
if (mod_EE3.proxy.isPortableCraftingGUIOpen()) {
ItemStack currentInventoryItem = player.inventory.getCurrentItem();
if (currentInventoryItem != null) {
currentInventoryItem.damageItem(Reference.MINIUM_STONE_TRANSMUTE_COST, player);
}
}
ItemStack currentItemStack;
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
currentItemStack = craftMatrix.getStackInSlot(i);
if (currentItemStack != null) {
if (currentItemStack.itemID == ModItems.miniumStone.shiftedIndex) {
currentItemStack.damageItem(Reference.MINIUM_STONE_TRANSMUTE_COST, player);
currentItemStack.stackSize++;
}
else if (currentItemStack.itemID == ModItems.philStone.shiftedIndex) {
currentItemStack.stackSize++;
}
}
}
}
}

View file

@ -1,48 +0,0 @@
package ee3.core;
import java.util.ArrayList;
import ee3.block.ModBlocks;
import ee3.core.helper.Helper;
import ee3.lib.Reference;
import net.minecraft.src.DamageSource;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ModLoader;
import net.minecraft.src.Potion;
import net.minecraft.src.PotionEffect;
import net.minecraft.src.forge.adaptors.EntityLivingHandlerAdaptor;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EntityLivingHandler extends EntityLivingHandlerAdaptor {
@Override
public boolean onEntityLivingDeath(EntityLiving entity, DamageSource killer)
{
if (killer.getDamageType().equals("player")) {
EntityPlayer player = (EntityPlayer)killer.getSourceOfDamage();
// We can do some really neat stuff here in the future!
}
return false;
}
@Override
public boolean onEntityLivingUpdate(EntityLiving entity) {
if (entity.worldObj.getWorldTime() % 4 == 0) {
if (Helper.handleRedWaterDetection(entity)) {
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.poison.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.blindness.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Reference.BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER * Reference.BLOCK_RED_WATER_EFFECT_DURATION_BASE * Reference.SECOND_IN_TICKS, 0));
}
}
return false;
}
}

View file

@ -1,324 +0,0 @@
package ee3.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import ee3.core.helper.Helper;
import ee3.item.ItemPhilosopherStone;
import ee3.item.ItemMiniumStone;
import ee3.item.ModItems;
import ee3.lib.Reference;
import net.minecraft.src.Block;
import net.minecraft.src.FurnaceRecipes;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import static net.minecraft.src.Item.*;
import static net.minecraft.src.Block.*;
import static ee3.lib.TransmuteEquivalencyList.*;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class RecipesPhilStone {
private static ItemStack philStone = new ItemStack(ModItems.philStone, 1, -1);
private static ItemStack miniumStone = new ItemStack(ModItems.miniumStone, 1, -1);
private static ItemStack anyCoal = new ItemStack(coal, 1, -1);
private static ItemStack anyWood = new ItemStack(wood, 1, -1);
private static ItemStack anyPlank = new ItemStack(planks, 1, -1);
private static ItemStack anySandStone = new ItemStack(sandStone, 1, -1);
private static ItemStack dyeBoneMeal = new ItemStack(dyePowder, 1, 15);
private static List<ItemStack> transmutationStones = Arrays.asList(miniumStone, philStone);
public static void initRecipes() {
initEquivalencyList();
for (ItemStack transmutationStone: transmutationStones) {
initTransmutationRecipes(transmutationStone);
initEquivalenceRecipes(transmutationStone);
initReconstructiveRecipes(transmutationStone);
initDestructorRecipes(transmutationStone);
initPortableSmeltingRecipes(transmutationStone);
}
if (Reference.DEBUG) {
debugPrintEquivalencyList();
}
}
public static void initTransmutationRecipes(ItemStack transmutationStone) {
/* 4 Cobble <-> 1 Flint */
addRecipe(flint, transmutationStone, cobblestone, cobblestone, cobblestone, cobblestone);
addRecipe(new ItemStack(cobblestone, 4), transmutationStone, flint);
/* 4 Dirt <-> 1 Gravel */
addRecipe(gravel, transmutationStone, dirt, dirt, dirt, dirt);
addRecipe(new ItemStack(dirt, 4), transmutationStone, gravel);
/* 4 Sand <-> 1 Sandstone */
// Vanilla Recipes exist to make SandStone from 4 Sand
addRecipe(new ItemStack(sand, 4), transmutationStone, anySandStone);
/* 2 Sticks -> Wood Plank */
addRecipe(planks, transmutationStone, stick, stick);
// Vanilla recipe exists to make sticks from planks
/* 4 Wood Planks -> Wood Block */
addRecipe(wood, transmutationStone, anyPlank, anyPlank, anyPlank, anyPlank);
// Vanilla recipes exist to make planks from any wood log
/* 4 Gravel/Sandstone/Flint -> 1 Clay Ball, 1 Clay Ball -> 4 Gravel */
addRecipe(clay, transmutationStone, gravel, gravel, gravel, gravel);
addRecipe(clay, transmutationStone, anySandStone, anySandStone, anySandStone, anySandStone);
addRecipe(clay, transmutationStone, flint, flint, flint, flint);
addRecipe(new ItemStack(gravel, 4), transmutationStone, clay);
/* 2 Wood Log <-> 1 Obsidian */
addRecipe(obsidian, transmutationStone, anyWood, anyWood);
addRecipe(new ItemStack(wood, 2), transmutationStone, obsidian);
/* 4 Clay Ball <-> 1 Clay Block */
// Vanilla recipe exists to make clay blocks from clay balls
addRecipe(new ItemStack(clay, 4), transmutationStone, blockClay);
/* 4 Obsidian/Clay Block -> 1 Iron Ingot, Iron Ingot -> Clay Block */
addRecipe(ingotIron, transmutationStone, obsidian, obsidian, obsidian, obsidian);
addRecipe(ingotIron, transmutationStone, blockClay, blockClay, blockClay, blockClay);
addRecipe(new ItemStack(blockClay, 4), transmutationStone, ingotIron);
/* 8 Iron Ingot <-> 1 Gold Ingot */
addRecipe(ingotGold, transmutationStone, ingotIron, ingotIron, ingotIron, ingotIron, ingotIron, ingotIron, ingotIron, ingotIron);
addRecipe(new ItemStack(ingotIron, 8), transmutationStone, ingotGold);
/* 4 Gold Ingot <-> 1 Diamond */
addRecipe(diamond, transmutationStone, ingotGold, ingotGold, ingotGold, ingotGold);
addRecipe(new ItemStack(ingotGold, 4), transmutationStone, diamond);
/* 8 Iron Block <-> 1 Gold Block */
addRecipe(blockGold, transmutationStone, blockSteel, blockSteel, blockSteel, blockSteel, blockSteel, blockSteel, blockSteel, blockSteel);
addRecipe(new ItemStack(blockSteel, 8), transmutationStone, blockGold);
/* 4 Gold Block <-> 1 Diamond Block */
addRecipe(blockDiamond, transmutationStone, blockGold, blockGold, blockGold, blockGold);
addRecipe(new ItemStack(blockGold, 4), transmutationStone, blockDiamond);
/* 1 Ender Pearl <-> 4 Iron Ingot */
addRecipe(enderPearl, transmutationStone, ingotIron, ingotIron, ingotIron, ingotIron);
addRecipe(new ItemStack(ingotIron, 4), transmutationStone, enderPearl);
}
public static void initEquivalencyList() {
addObjectsToEquivalencyLists(sand, dirt, cobblestone, grass);
addObjectsToEquivalencyLists(plantYellow, plantRed);
addObjectsToEquivalencyLists(mushroomRed, mushroomBrown);
addObjectsToEquivalencyLists(pumpkinSeeds, melonSeeds);
addObjectsToEquivalencyLists(pumpkin, Block.melon);
addObjectsToEquivalencyLists(new ItemStack(paper, 3), new ItemStack(Item.reed, 3));
addObjectsToEquivalencyLists(new ItemStack(flint, 2), new ItemStack(gravel, 2), new ItemStack(sandStone, 2, 0), new ItemStack(sandStone, 2, 1), new ItemStack(sandStone, 2, 2));
addObjectsToEquivalencyLists(getMetaCycle(planks, 4));
addObjectsToEquivalencyLists(getMetaCycle(wood, 4));
addObjectsToEquivalencyLists(getMetaCycle(sapling, 4));
addObjectsToEquivalencyLists(getMetaCycle(leaves, 4));
addObjectsToEquivalencyLists(getMetaCycle(tallGrass, 3));
addObjectsToEquivalencyLists(getMetaCycle(cloth, 16));
addObjectsToEquivalencyLists(getMetaCycle(stoneBrick, 4));
addObjectsToEquivalencyLists(getMetaCycle(dyePowder, 16, 3, 4, 15));
}
public static void initEquivalenceRecipes(ItemStack transmutationStone) {
int outputI;
for (ArrayList<ItemStack> itemStackList : equivalencyLists) {
ItemStack[] currentList = new ItemStack[itemStackList.size()];
currentList = itemStackList.toArray(currentList);
for(int i = 0; i < currentList.length; i++) {
outputI = (i == currentList.length - 1 ? 0 : i + 1);
addRecipe(currentList[outputI], transmutationStone, Helper.convertSingleStackToPluralStacks(currentList[i]));
}
}
System.out.println();
}
public static void initReconstructiveRecipes(ItemStack stone) {
/* 3 Bone Meal --> 1 Bone */
addRecipe(bone, stone, dyeBoneMeal, dyeBoneMeal, dyeBoneMeal);
/* 2 Blaze Powder --> 1 Blaze Rod */
addRecipe(blazeRod, stone, blazePowder, blazePowder);
}
public static void initDestructorRecipes(ItemStack transmutationStone) {
/* Smooth Stone -> Cobble Stone */
addRecipe(cobblestone, transmutationStone, stone);
/* Glass -> Sand */
addRecipe(sand, transmutationStone, glass);
/* Glowstone Block -> 4 Glowstone Dust */
addRecipe(new ItemStack(lightStoneDust, 4), transmutationStone, glowStone);
/* Brick Block -> 4 Bricks */
addRecipe(new ItemStack(Item.brick, 4), transmutationStone, Block.brick);
}
public static void initPortableSmeltingRecipes(ItemStack transmutationStone) {
Map furnaceMap = FurnaceRecipes.smelting().getSmeltingList();
Map furnaceMetaMap = ModLoader.getPrivateValue(FurnaceRecipes.class, FurnaceRecipes.smelting(), "metaSmeltingList");
Iterator iterFurnaceKeyMap = furnaceMap.keySet().iterator();
Iterator iterFurnaceMetaKeyMap = furnaceMetaMap.keySet().iterator();
Integer furnaceMapKey;
List furnaceMetaMapKey;
ItemStack unSmeltedStack;
while (iterFurnaceKeyMap.hasNext()) {
furnaceMapKey = (Integer) iterFurnaceKeyMap.next();
unSmeltedStack = new ItemStack(furnaceMapKey, 1, 0);
addSmeltingRecipe(unSmeltedStack, transmutationStone);
}
while (iterFurnaceMetaKeyMap.hasNext()) {
furnaceMetaMapKey = (List)iterFurnaceMetaKeyMap.next();
unSmeltedStack = new ItemStack((Integer)furnaceMetaMapKey.get(0), 1, (Integer)furnaceMetaMapKey.get(1));
addSmeltingRecipe(unSmeltedStack, transmutationStone);
}
}
protected static void addRecipe(ItemStack result, Object ... input) {
ModLoader.addShapelessRecipe(result, input);
}
protected static void addRecipe(ItemStack result, ItemStack transmutationStone, Object ... input) {
Object[] inputs = new Object[input.length + 1];
inputs[0] = transmutationStone;
for (int i = 1; i < inputs.length; ++i) {
inputs[i] = input[i-1];
}
addRecipe(result, inputs);
}
protected static void addRecipe(Block result, Object ... input) {
addRecipe(new ItemStack(result), input);
}
protected static void addRecipe(Block result, int count, Object ... input) {
addRecipe(new ItemStack(result, count), input);
}
protected static void addRecipe(Item result, Object ... input) {
addRecipe(new ItemStack(result), input);
}
protected static void addRecipe(Item result, int count, Object ... input) {
addRecipe(new ItemStack(result, count), input);
}
protected static Object[] getMetaCycle(Object input, int n) {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
ItemStack stack;
for (int i = 0; i < n; i++) {
stack = Helper.convertObjectToItemStack(input);
stack.setItemDamage(i);
list.add(stack);
}
return list.toArray();
}
protected static Object[] getMetaCycle(Object input, int n, int ... excludedMeta) {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
ItemStack stack;
int i = 0;
while (i < n) {
for (int j : excludedMeta) {
if (i == j)
++i;
}
if (!(i < n))
break;
stack = Helper.convertObjectToItemStack(input);
stack.setItemDamage(i);
list.add(stack);
++i;
}
return list.toArray();
}
/* Pass this a Block, Item or ItemStack and the maximum number of indexes, EXCLUDING zero */
protected static void addMetaCycleRecipe(Object input, int n) {
int outputI;
/* Makes a single item cycle through its meta values when it's crafted with a PStone */
for(int i = 0; i < n; i++) {
outputI = (i == n - 1 ? 0 : i + 1);
if(input instanceof Block)
ModLoader.addShapelessRecipe(new ItemStack((Block)input, 1, outputI), philStone, new ItemStack((Block)input, 1, i));
else if (input instanceof Item)
ModLoader.addShapelessRecipe(new ItemStack((Item)input, 1, outputI), philStone, new ItemStack((Item)input, 1, i));
else if (input instanceof ItemStack)
ModLoader.addShapelessRecipe(new ItemStack(((ItemStack)input).itemID, 1, outputI), philStone, new ItemStack(((ItemStack)input).itemID, 1, i));
}
}
protected static void addMetaCycleRecipe(Object input, int n, int ... excludedMeta) {
int i = 0;
int outputI = 1;
while (i < n && outputI != 0) {
outputI = (i == n - 1 ? 0 : i + 1);
for (int j : excludedMeta) {
if (outputI == j)
outputI = (outputI + 1) % 16;
}
if(input instanceof Block)
ModLoader.addShapelessRecipe(new ItemStack((Block)input, 1, outputI), philStone, new ItemStack((Block)input, 1, i));
else if (input instanceof Item)
ModLoader.addShapelessRecipe(new ItemStack((Item)input, 1, outputI), philStone, new ItemStack((Item)input, 1, i));
else if (input instanceof ItemStack)
ModLoader.addShapelessRecipe(new ItemStack(((ItemStack)input).itemID, 1, outputI), philStone, new ItemStack(((ItemStack)input).itemID, 1, i));
i = outputI;
}
}
/* Final method, actually adds the portable smelting recipe */
protected static void addSmeltingRecipe(ItemStack input, ItemStack transmutationStone) {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(input);
if(result == null)
return;
Object[] list = new Object[9];
list[0] = transmutationStone;
list[1] = anyCoal;
for(int i = 2; i < 9; i++)
list[i] = new ItemStack(input.getItem(), 1, input.getItemDamage());
ModLoader.addShapelessRecipe(new ItemStack(result.getItem(), 7, result.getItemDamage()), list);
}
}

View file

@ -1,57 +0,0 @@
package ee3.core;
import java.util.EnumSet;
import net.minecraft.src.BaseMod;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import ee3.addons.*;
import ee3.core.helper.Helper;
import ee3.lib.Reference;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class TickHandler implements ITickHandler {
private static boolean addonsInitialized = false;
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
for (TickType tickType : type) {
// WORLDLOAD ticks only happen once, so we'll use it to finish initialising things
if (tickType == TickType.WORLDLOAD) {
// Initialise
if (!addonsInitialized) {
addonsInitialized = true;
Helper.initAddons();
}
}
}
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
for (TickType tickType : type) {
if (tickType == TickType.GAME) {
}
}
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.GAME, TickType.WORLDLOAD);
}
@Override
public String getLabel() {
return Reference.MOD_NAME;
}
}

View file

@ -1,111 +0,0 @@
package ee3.core.helper;
import java.util.ArrayList;
import java.util.logging.Level;
import ee3.addons.BuildCraftAddon;
import ee3.addons.ForestryAddon;
import ee3.addons.IndustrialCraftAddon;
import ee3.addons.RedPowerAddon;
import ee3.block.ModBlocks;
import ee3.lib.Reference;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.BaseMod;
import net.minecraft.src.Block;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.MathHelper;
import net.minecraft.src.ModLoader;
import net.minecraft.src.World;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class Helper {
public static ItemStack convertObjectToItemStack(Object obj) {
if (obj instanceof Item) { return new ItemStack((Item)obj); }
else if (obj instanceof Block) { return new ItemStack((Block)obj); }
else if (obj instanceof ItemStack){ return (ItemStack)obj; }
else { return null; }
}
public static Object[] convertSingleStackToPluralStacks(ItemStack stack) {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
ItemStack currentStack;
for (int i = 0; i < stack.stackSize; i++) {
currentStack = new ItemStack(stack.itemID, 1, stack.getItemDamage());
list.add(currentStack);
}
return list.toArray();
}
public static String getLogMessage(String logMessage) {
return Reference.LOGGER_PREFIX + logMessage;
}
public static void initAddons() {
ModLoader.getLogger().finer(getLogMessage("Checking for addons needing initializing"));
boolean addonsFound = false;
for (BaseMod mod : ModLoader.getLoadedMods()) {
if (mod.toString().contains("mod_BuildCraftEnergy")) {
BuildCraftAddon.init();
addonsFound = true;
}
else if (mod.toString().contains("mod_RedPowerCore")) {
RedPowerAddon.init();
addonsFound = true;
}
else if (mod.toString().contains("mod_RedPowerWorld")) {
RedPowerAddon.init();
addonsFound = true;
}
else if (mod.toString().contains("mod_Forestry")) {
ForestryAddon.init();
addonsFound = true;
}
else if (mod.toString().contains("mod_IC2")) {
IndustrialCraftAddon.init();
addonsFound = true;
}
}
if (addonsFound)
ModLoader.getLogger().finer(getLogMessage("Done initializing addons"));
else
ModLoader.getLogger().finer(getLogMessage("No addons for loaded mods found"));
}
public static boolean handleRedWaterDetection(EntityLiving entity) {
return (isBlockInBB(entity.worldObj, entity.boundingBox, ModBlocks.redWaterFlowing)
|| isBlockInBB(entity.worldObj, entity.boundingBox, ModBlocks.redWaterStill));
}
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + Reference.BLOCK_RED_WATER_RANGE_BASE * Reference.BLOCK_RED_WATER_RANGE_MODIFIER * 1.0D);
for (int i = minX; i < maxX; ++i) {
for (int j = minY; j < maxY; ++j) {
for (int k = minZ; k < maxZ; ++k) {
Block currentBlock = Block.blocksList[world.getBlockId(i, j, k)];
if (currentBlock != null && currentBlock.blockID == block.blockID) {
return true;
}
}
}
}
return false;
}
}

View file

@ -1,75 +0,0 @@
package ee3.core.helper;
import java.io.InputStream;
import java.util.Properties;
import ee3.lib.Reference;
import net.minecraft.src.StringTranslate;
/**
* Simple mod localization class. Shamelessly ripped from Buildcraft, renamed LocalizationHelper, and modified.
*
* @author Jimeo Wan
* @license Public domain
*/
public class LocalizationHelper {
public static LocalizationHelper instance = new LocalizationHelper();
private static final String DEFAULT_LANGUAGE = "en_US";
private String loadedLanguage = null;
private Properties defaultMappings = new Properties();
private Properties mappings = new Properties();
/**
* Loads the mod's localization files. All language files must be stored in
* "/lang[modname]/", in .lang files. (ex: for the mod 'invtweaks',
* the french translation is in: "lang/invtweaks/fr_FR.lang")
*
* @param modName The mod name
*/
public LocalizationHelper() {
load(getCurrentLanguage());
}
/**
* Get a string for the given key, in the currently active translation.
*
* @param key
* @return
*/
public synchronized String get(String key) {
String currentLanguage = getCurrentLanguage();
if (!currentLanguage.equals(loadedLanguage))
load(currentLanguage);
return mappings.getProperty(key, defaultMappings.getProperty(key, key));
}
private void load(String newLanguage) {
defaultMappings.clear();
mappings.clear();
try {
InputStream langStream = LocalizationHelper.class.getResourceAsStream(
Reference.LANG_RESOURCE_LOCATION + newLanguage + ".lang");
InputStream defaultLangStream = LocalizationHelper.class.getResourceAsStream(
Reference.LANG_RESOURCE_LOCATION + DEFAULT_LANGUAGE + ".lang");
mappings.load((langStream == null) ? defaultLangStream : langStream);
defaultMappings.load(defaultLangStream);
if (langStream != null) {
langStream.close();
}
defaultLangStream.close();
} catch (Exception e) {
e.printStackTrace();
}
loadedLanguage = newLanguage;
}
private static String getCurrentLanguage() {
return StringTranslate.getInstance().getCurrentLanguage();
}
}

View file

@ -1,43 +0,0 @@
package ee3.core.helper;
import ee3.mod_EE3;
import ee3.lib.Sounds;
import ee3.lib.TransmuteEquivalencyList;
import net.minecraft.src.Block;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.World;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class TransmutationHelper {
public static boolean transmuteInWorld(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z) {
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if (world.getBlockMaterial(x, y, z) == Material.leaves) {
meta = meta % 4;
}
ItemStack nextItem = TransmuteEquivalencyList.getNextBlockInEquivalencyList(id, meta, entityPlayer.isSneaking());
if (nextItem != null) {
if (Block.blocksList[nextItem.itemID] != null) {
world.setBlockAndMetadataWithNotify(x, y, z, nextItem.itemID, nextItem.getItemDamage());
// @TODO
world.playSoundAtEntity(entityPlayer, Sounds.TRANSMUTE, 0.5F, 1.0F);
return true;
}
}
return false;
}
}

View file

@ -1,22 +0,0 @@
package ee3.core.interfaces;
import net.minecraft.src.ItemStack;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface IItemChargeable {
public abstract byte getCurrentCharge(ItemStack ist);
public abstract byte getMaxCharge();
public abstract void increaseCharge(ItemStack ist);
public abstract void decreaseCharge(ItemStack ist);
public abstract void setCurrentCharge(ItemStack ist, byte charge);
}

View file

@ -1,20 +0,0 @@
package ee3.core.interfaces;
import net.minecraft.src.ItemStack;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface IItemModal {
public abstract byte getCurrentMode(ItemStack ist);
public abstract byte getMaxMode();
public abstract byte cycleMode(ItemStack ist);
public abstract void setMode(ItemStack ist, byte mode);
}

View file

@ -1,58 +0,0 @@
package ee3.core.interfaces;
import java.io.File;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EnumRarity;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.ShapedRecipes;
import net.minecraft.src.World;
import net.minecraft.src.forge.IGuiHandler;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface IProxy {
public abstract void preloadTextures();
public abstract void initTextureFX();
public abstract void registerRenderInformation();
public abstract void registerTileEntities();
public abstract File getMinecraftDir();
public abstract boolean isRemote();
public abstract World getCurrentWorld();
public abstract String getMinecraftVersion();
public abstract void registerSoundHandler();
public abstract void registerKeyBindings();
public abstract void keyBindingEvent(Object event);
public abstract void handleControl(NetworkManager network, int key);
public abstract void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated);
public abstract void handleTEPacket(int x, int y, int z, byte direction, String player);
public abstract Object handleGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
public abstract void playSound(String soundName, float x, float y, float z, float volume, float pitch);
public abstract void addCustomEnumRarityTypes();
public abstract EnumRarity getCustomEnumRarityType(String custom);
public abstract boolean isPortableCraftingGUIOpen();
}

View file

@ -1,13 +0,0 @@
package ee3.core.interfaces;
import net.minecraft.src.ItemStack;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface ITransmuteStone {
}

View file

@ -1,132 +0,0 @@
package ee3.emc;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import net.minecraft.src.Block;
import net.minecraft.src.CraftingManager;
import net.minecraft.src.IRecipe;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.ShapedRecipes;
import net.minecraft.src.ShapelessRecipes;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EMCList {
private HashMap<Integer, HashMap<Integer, EMCValue>> emcMap;
public EMCList() {
emcMap = new HashMap<Integer, HashMap<Integer, EMCValue>>();
}
public void initEMCList() {
determineBaseMaterials();
}
/* Helper functions */
private static void determineBaseMaterials() {
CraftingManager instance = CraftingManager.getInstance();
List recipeList = instance.getRecipeList();
IRecipe recipe;
ShapedRecipes shapedRecipe;
ShapelessRecipes shapelessRecipe;
ItemStack[] shapedInputs;
List<ItemStack> shapelessInputs;
ItemStack recipeOutput = null;
Iterator<IRecipe> recipeIter = recipeList.iterator();
ItemStack[] recipeInputs = null;
Vector<Integer> inputs = new Vector<Integer>();
Vector<Integer> outputs = new Vector<Integer>();
try {
while (recipeIter.hasNext()) {
recipe = recipeIter.next();
if (recipe instanceof ShapedRecipes) {
shapedRecipe = (ShapedRecipes) recipe;
//shapedInputs = mod_EE3.proxy.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeInputs = ModLoader.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeOutput = ModLoader.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeOutput");
System.out.println("Shaped Recipe");
}
else if (recipe instanceof ShapelessRecipes) {
shapelessRecipe = (ShapelessRecipes) recipe;
shapelessInputs = ModLoader.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeItems");
recipeInputs = shapelessInputs.toArray(new ItemStack[0]);
recipeOutput = ModLoader.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeOutput");
System.out.println("Shapeless Recipe");
}
System.out.println("Output: " + recipeOutput.toString());
outputs.add(recipeOutput.getItem().shiftedIndex);
for (ItemStack itemStack : recipeInputs) {
if (itemStack != null) {
System.out.println("Input: " + itemStack.toString());
if (!inputs.contains(new Integer(itemStack.getItem().shiftedIndex)))
inputs.add(new Integer(itemStack.getItem().shiftedIndex));
}
}
System.out.println();
}
//for (int i = 0; i < outputs.size(); i++) {
// System.out.println("i: " + i + ", item: " + outputs.get(i));
//}
inputs.removeAll(outputs);
for (int i = 0; i < inputs.size(); i++) {
System.out.println(i + "," + inputs.get(i) + "," + Item.itemsList[inputs.get(i)].getItemName());
}
}
catch (Exception e) {
e.printStackTrace(System.err);
}
}
private void printEMCList() {
System.out.println("\n*** Starting Debug Dump of EMC List ***");
System.out.println("*** End of EMC List ***\n");
}
private void addEMCValue(Block block, EMCValue emc) {
this.addEMCValue(block.blockID, 0, emc);
}
private void addEMCValue(Block block, int meta, EMCValue emc) {
this.addEMCValue(block.blockID, meta, emc);
}
private void addEMCValue(Item item, EMCValue emc) {
this.addEMCValue(item.shiftedIndex, 0, emc);
}
private void addEMCValue(ItemStack itemStack, EMCValue emc) {
this.addEMCValue(itemStack.itemID, itemStack.getItemDamage(), emc);
}
private void addEMCValue(int id, EMCValue emc) {
this.addEMCValue(id, 0, emc);
}
private void addEMCValue(int id, int meta, EMCValue emc) {
HashMap<Integer, EMCValue> tempMap = new HashMap<Integer, EMCValue>();
if(emcMap.get(id) != null) {
tempMap = emcMap.get(id);
}
tempMap.put(meta, emc);
emcMap.put(id, tempMap);
}
}

View file

@ -1,64 +0,0 @@
package ee3.emc;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EMCValue {
private float cost;
private float recoveryPercentage;
private boolean learnable;
private boolean recoverable;
private float[] emcBreakdown;
public EMCValue() { }
public EMCValue(float cost) {
this.cost = cost;
recoveryPercentage = 1.0F;
learnable = true;
recoverable = true;
}
public EMCValue(float cost, float recoveryPercentage, boolean learnable, boolean recoverable) {
this.cost = cost;
this.recoveryPercentage = recoveryPercentage;
this.learnable = learnable;
this.recoverable = recoverable;
}
public float getCostEMC() {
return cost;
}
public float getRecoveryEMC() {
return recoveryPercentage;
}
public boolean isLearnable() {
return learnable;
}
public boolean isRecoverable() {
return recoverable;
}
public void setCostEMC(float cost) {
this.cost = cost;
}
public void setRecoveryPercentage(float recoveryPercentage) {
this.recoveryPercentage = recoveryPercentage;
}
public void setLearnable(boolean learnable) {
this.learnable = learnable;
}
public void setRecoverable(boolean recoverable) {
this.recoverable = recoverable;
}
}

View file

@ -1,21 +0,0 @@
package ee3.gui;
import ee3.mod_EE3;
import ee3.lib.GuiIds;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;
import net.minecraft.src.forge.IGuiHandler;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class GuiHandler implements IGuiHandler {
@Override
public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return mod_EE3.proxy.handleGuiElement(ID, player, world, x, y, z);
}
}

View file

@ -1,15 +0,0 @@
package ee3.item;
import net.minecraft.src.ItemSapling;
public class ItemCorruptedSapling extends ItemSapling {
public ItemCorruptedSapling(int par1) {
super(par1);
}
public int getColorFromDamage(int par1, int par2) {
return Integer.parseInt("A5162E", 16);
}
}

View file

@ -1,18 +0,0 @@
package ee3.item;
import net.minecraft.src.ItemStack;
import ee3.core.helper.LocalizationHelper;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemEE extends ItemMod {
public ItemEE(int i) {
super(i);
}
}

View file

@ -1,16 +0,0 @@
package ee3.item;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemEEStackable extends ItemMod {
public ItemEEStackable(int i) {
super(i);
maxStackSize = 64;
}
}

View file

@ -1,18 +0,0 @@
package ee3.item;
import ee3.core.helper.LocalizationHelper;
import net.minecraft.src.ItemStack;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemMiniumShard extends ItemEE {
public ItemMiniumShard(int i) {
super(i);
}
}

View file

@ -1,47 +0,0 @@
package ee3.item;
import java.util.ArrayList;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EnumRarity;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import ee3.mod_EE3;
import ee3.core.helper.Helper;
import ee3.core.helper.TransmutationHelper;
import ee3.core.interfaces.ITransmuteStone;
import ee3.lib.CustomItemRarity;
import ee3.lib.Reference;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemMiniumStone extends ItemEE implements ITransmuteStone {
public ItemMiniumStone(int i) {
super(i);
this.setMaxDamage(Reference.MINIUM_STONE_DURABILITY);
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l) {
boolean result = TransmutationHelper.transmuteInWorld(itemStack, entityPlayer, world, x, y, z);
if (result) {
itemStack.damageItem(Reference.MINIUM_STONE_TRANSMUTE_COST, entityPlayer);
}
return result;
}
/*
* Returns the custom item rarity type for the item
* @see net.minecraft.src.Item#getRarity(net.minecraft.src.ItemStack)
*/
public EnumRarity getRarity(ItemStack par1ItemStack) {
return mod_EE3.proxy.getCustomEnumRarityType(CustomItemRarity.MAGICAL);
}
}

View file

@ -1,151 +0,0 @@
package ee3.item;
import ee3.core.helper.LocalizationHelper;
import ee3.lib.Reference;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.forge.ITextureProvider;
/**
* TODO Class Description
* @author pahimar, x3n0ph0b3
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemMod extends Item implements ITextureProvider {
public ItemMod(int i) {
super(i);
maxStackSize = 1;
setNoRepair();
}
public String getItemDisplayName(ItemStack itemstack) {
return LocalizationHelper.instance.get(getItemNameIS(itemstack));
}
@Override
public String getTextureFile() {
return Reference.SPRITE_SHEET_LOCATION + Reference.ITEM_SPRITE_SHEET;
}
public String getString(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setString(ist, s, "");
return ist.stackTagCompound.getString(s);
}
public void setString(ItemStack ist, String s, String s1) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setString(s, s1);
}
public boolean getBoolean(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setBoolean(ist, s, false);
return ist.stackTagCompound.getBoolean(s);
}
public void setBoolean(ItemStack ist, String s, boolean b) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setBoolean(s, b);
}
public short getShort(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setShort(ist, s, 0);
return (short)(ist.stackTagCompound.getShort(s));
}
public void setShort(ItemStack ist, String s, int i) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setShort(s, (short)i);
}
public int getInteger(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setInteger(ist, s, 0);
return ist.stackTagCompound.getInteger(s);
}
public void setInteger(ItemStack ist, String s, int i) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setInteger(s, i);
}
public byte getByte(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setByte(ist, s, (byte)0);
return ist.stackTagCompound.getByte(s);
}
public void setByte(ItemStack ist, String s, byte i) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setByte(s, i);
}
public long getLong(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setLong(ist, s, 0);
return ist.stackTagCompound.getLong(s);
}
public void setLong(ItemStack ist, String s, long i) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setLong(s, i);
}
public float getFloat(ItemStack ist, String s) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
if (!ist.stackTagCompound.hasKey(s))
setFloat(ist, s, 0F);
return ist.stackTagCompound.getFloat(s);
}
public void setFloat(ItemStack ist, String s, float f) {
if (ist.stackTagCompound == null)
ist.setTagCompound(new NBTTagCompound());
ist.stackTagCompound.setFloat(s, f);
}
}

View file

@ -1,105 +0,0 @@
package ee3.item;
import ee3.mod_EE3;
import ee3.core.helper.TransmutationHelper;
import ee3.core.interfaces.IItemChargeable;
import ee3.core.interfaces.IItemModal;
import ee3.core.interfaces.ITransmuteStone;
import ee3.lib.CustomItemRarity;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EnumRarity;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
/**
* TODO Class Description
* @author pahimar, x3n0ph0b3
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemPhilosopherStone extends ItemEE implements IItemChargeable, IItemModal, ITransmuteStone {
private byte currentCharge;
private byte maxCharge;
private byte currentMode;
private byte maxMode;
public ItemPhilosopherStone(int i) {
super(i);
maxCharge = 4;
maxMode = 2;
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l) {
return TransmutationHelper.transmuteInWorld(itemStack, entityPlayer, world, x, y, z);
}
/*
* Returns the custom item rarity type for the item
* @see net.minecraft.src.Item#getRarity(net.minecraft.src.ItemStack)
*/
public EnumRarity getRarity(ItemStack par1ItemStack) {
return mod_EE3.proxy.getCustomEnumRarityType(CustomItemRarity.RARE);
}
/*
* Gives the Philosopher Stone a nice visual effect
* @see net.minecraft.src.Item#hasEffect(net.minecraft.src.ItemStack)
*/
public boolean hasEffect(ItemStack par1ItemStack) {
return true;
}
@Override
public byte getMaxCharge() {
return maxCharge;
}
@Override
public void increaseCharge(ItemStack ist) {
if (getCurrentCharge(ist) < getMaxCharge())
setCurrentCharge(ist, (byte)(getCurrentCharge(ist) + 1));
}
@Override
public void decreaseCharge(ItemStack ist) {
if (getCurrentCharge(ist) > 0)
setCurrentCharge(ist, (byte)(getCurrentCharge(ist) - 1));
}
@Override
public byte getCurrentCharge(ItemStack ist) {
return getByte(ist, "currentCharge");
}
@Override
public void setCurrentCharge(ItemStack ist, byte charge) {
setByte(ist, "currentCharge", charge);
}
@Override
public byte getCurrentMode(ItemStack ist) {
return getByte(ist, "currentMode");
}
@Override
public byte getMaxMode() {
return maxMode;
}
@Override
public byte cycleMode(ItemStack ist) {
if (getCurrentMode(ist) < getMaxMode())
setMode(ist, (byte)(getCurrentMode(ist) + 1));
else
setMode(ist, (byte)0);
return getCurrentMode(ist);
}
@Override
public void setMode(ItemStack ist, byte mode) {
setByte(ist, "currentMode", mode);
}
}

View file

@ -1,34 +0,0 @@
package ee3.item;
import ee3.lib.ItemIds;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemSapling;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ModItems {
public static Item miniumShard;
public static Item miniumStone;
public static Item philStone;
public static void init() {
/* Initialise each mod item individually */
miniumShard = new ItemMiniumShard(ItemIds.MINIUM_SHARD).setIconCoord(0, 0).setItemName("miniumShard");
miniumStone = new ItemMiniumStone(ItemIds.MINIUM_STONE).setIconCoord(1, 0).setItemName("miniumStone");
philStone = new ItemPhilosopherStone(ItemIds.PHIL_STONE).setIconCoord(2, 0).setItemName("philosophersStone");
ModLoader.addShapelessRecipe(new ItemStack(miniumStone), Block.dirt);
ModLoader.addShapelessRecipe(new ItemStack(philStone), Block.dirt, Block.dirt);
}
}

View file

@ -1,13 +0,0 @@
package ee3.lib;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockIds {
public static int RED_WATER_STILL;
}

View file

@ -1,51 +0,0 @@
package ee3.lib;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CustomItemRarity {
/**
* Colour Value Guide
*
* 0 = Black
* 1 = Dark Blue
* 2 = Green
* 3 = Cyan
* 4 = Dark Red
* 5 = Purple
* 6 = Orange
* 7 = Light Grey
* 8 = Dark Grey
* 9 = Blue
* 10 = Light Green
* 11 = Light Cyan
* 12 = Light Red
* 13 = Pink
* 14 = Yellow
* 15 = White
*
**/
public static final int COLOR_JUNK = 7;
public static final int COLOR_NORMAL = 15;
public static final int COLOR_MAGICAL = 9;
public static final int COLOR_RARE = 14;
public static final int COLOR_LEGENDARY = 6;
public static final String JUNK = "custom_junk";
public static final String NORMAL = "custom_normal";
public static final String MAGICAL = "custom_magical";
public static final String RARE = "custom_rare";
public static final String LEGENDARY = "custom_legendary";
public static final String DISPLAY_NAME_JUNK = "Junk";
public static final String DISPLAY_NAME_NORMAL = "Normal";
public static final String DISPLAY_NAME_MAGICAL = "Magical";
public static final String DISPLAY_NAME_RARE = "Rare";
public static final String DISPLAY_NAME_LEGENDARY = "Legendary";
}

View file

@ -1,11 +0,0 @@
package ee3.lib;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class GuiIds {
public static int PORTABLE_CRAFTING = 1;
}

View file

@ -1,41 +0,0 @@
package ee3.lib;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemIds {
public static int MINIUM_SHARD;
public static int MINIUM_STONE;
public static int PHIL_STONE;
public static int DJINN_RING;
public static int EYE_OF_THE_VOID;
public static int IDOL_OF_GAIA;
public static int UMBRAL_DISPLACER;
public static int WIKIDS_TEMPEST;
public static int HORN_OF_EVERFLOWING;
public static int TIMELORDS_POCKET_WATCH;
public static int WARD_OF_XENOPHOBIA;
public static int CALCINED_ASH;
public static int ALCHEMICAL_COAL;
public static int MOBIUS_FUEL;
public static int DIVINING_ROD;
public static int PANACEA;
public static int AUTO_MAIL;
public static int CASTER;
public static int PROJECTOR;
public static int ALGOT;
public static int WOLF_BOOTS;
public static int DARK_MATTER;
public static int DARK_MATTER_PICKAXE;
public static int DARK_MATTER_SHOVEL;
public static int DARK_MATTER_HOE;
public static int DARK_MATTER_SHEARS;
public static int DARK_MATTER_HAMMER;
public static int DARK_MATTER_SWORD;
public static int DARK_MATTER_BOW;
public static int DARK_MATTER_FISHING_ROD;
public static int DARK_MATTER_ARMOR;
}

View file

@ -1,43 +0,0 @@
package ee3.lib;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class Reference {
public static final boolean DEBUG = false;
public static final String MOD_NAME = "Equivalent Exchange 3";
public static final String CHANNEL_NAME = "EE3";
public static final String LOGGER_PREFIX = "[" + MOD_NAME + "] ";
public static final String CONFIG_FILE = "EE3.cfg";
public static final String CONFIG_DIR = "config/ee3/";
public static final String SPRITE_SHEET_LOCATION = "/ee3/art/sprites/";
public static final String ITEM_SPRITE_SHEET = "ee3_items.png";
public static final String BLOCK_SPRITE_SHEET = "ee3_blocks.png";
public static final String GUI_SHEET_LOCATION = "/ee3/art/gui/";
public static final String ARMOR_SHEET_LOCATION = "/ee3/art/armor/";
public static final String SOUND_RESOURCE_LOCATION = "ee3/sound/";
public static final String SOUND_PREFIX = "ee3.sound.";
public static final String LANG_RESOURCE_LOCATION = "/ee3/lang/";
public static final int SECOND_IN_TICKS = 20;
public static final String hexRedWaterCorruptionOverlayColor = "A5162E";
public static final int MINIUM_STONE_DURABILITY = 1531;
public static final int MINIUM_STONE_TRANSMUTE_COST = 4;
public static final String ITEM_NAME_MINIUM_SHARD = "item.name.minium_shard";
public static final String ITEM_NAME_MINIUM_STONE = "item.name.minium_stone";
public static final String ITEM_NAME_PHILOSOPHERS_STONE = "item.name.philosophers_stone";
public static final int BLOCK_RED_WATER_EFFECT_DURATION_BASE = 5;
public static final int BLOCK_RED_WATER_EFFECT_DURATION_MODIFIER = 1;
public static final int BLOCK_RED_WATER_RANGE_BASE = 1;
public static final int BLOCK_RED_WATER_RANGE_MODIFIER = 1;
}

View file

@ -1,44 +0,0 @@
package ee3.lib;
import static ee3.lib.Reference.*;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class Sounds {
public static String[] soundFiles = {SOUND_RESOURCE_LOCATION + "break.ogg",
SOUND_RESOURCE_LOCATION + "chargetick.ogg",
SOUND_RESOURCE_LOCATION + "destruct.ogg",
SOUND_RESOURCE_LOCATION + "flash.ogg",
SOUND_RESOURCE_LOCATION + "gust.ogg",
SOUND_RESOURCE_LOCATION + "heal.ogg",
SOUND_RESOURCE_LOCATION + "kinesis.ogg",
SOUND_RESOURCE_LOCATION + "launch.ogg",
SOUND_RESOURCE_LOCATION + "nova.ogg",
SOUND_RESOURCE_LOCATION + "philball.ogg",
SOUND_RESOURCE_LOCATION + "tock.ogg",
SOUND_RESOURCE_LOCATION + "transmute.ogg",
SOUND_RESOURCE_LOCATION + "wall.ogg",
SOUND_RESOURCE_LOCATION + "waterball.ogg",
SOUND_RESOURCE_LOCATION + "wind.ogg"};
public static final String BREAK = SOUND_PREFIX + "break";
public static final String CHARGE_TICK = SOUND_PREFIX + "chargetick";
public static final String DESTRUCTION = SOUND_PREFIX + "destruct";
public static final String FLASH = SOUND_PREFIX + "flash";
public static final String GUST = SOUND_PREFIX + "gust";
public static final String HEAL = SOUND_PREFIX + "heal";
public static final String KINESIS = SOUND_PREFIX + "kinesis";
public static final String LAUNCH = SOUND_PREFIX + "launch";
public static final String NOVA = SOUND_PREFIX + "nova";
public static final String PHILOSOPHERS_BALL = SOUND_PREFIX + "philball";
public static final String TOCK = SOUND_PREFIX + "tock";
public static final String TRANSMUTE = SOUND_PREFIX + "transmute";
public static final String WALL = SOUND_PREFIX + "wall";
public static final String WATER_BALL = SOUND_PREFIX + "waterball";
public static final String WIND = SOUND_PREFIX + "wind";
}

View file

@ -1,216 +0,0 @@
package ee3.lib;
import java.util.ArrayList;
import java.util.Iterator;
import ee3.core.helper.Helper;
import net.minecraft.src.Block;
import net.minecraft.src.BlockSand;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class TransmuteEquivalencyList {
public static ArrayList<ArrayList<ItemStack>> equivalencyLists = new ArrayList<ArrayList<ItemStack>>();
public static void addObjectsToEquivalencyLists(Object ... objList) {
if (objList.length < 2)
return;
for (int i = 0; i < objList.length - 1; i++) {
addObjectToEquivalencyList(objList[i], objList[i+1]);
}
}
public static void addObjectToEquivalencyList(Object obj1, Object obj2) {
ItemStack stack1 = Helper.convertObjectToItemStack(obj1);
ItemStack stack2 = Helper.convertObjectToItemStack(obj2);
ArrayList<ItemStack> currentList = new ArrayList<ItemStack>();
Integer stack1Index = getEquivalencyIndexForItem(stack1);
Integer stack2Index = getEquivalencyIndexForItem(stack2);
if ((stack1Index != null) && (stack2Index != null)) {
return;
}
else if ((stack1Index != null) && (stack2Index == null)) {
currentList = equivalencyLists.get(stack1Index.intValue());
currentList.add(stack2);
equivalencyLists.set(stack1Index.intValue(), currentList);
}
else if ((stack1Index == null) && (stack2Index != null)) {
currentList = equivalencyLists.get(stack2Index.intValue());
currentList.add(stack1);
equivalencyLists.set(stack2Index.intValue(), currentList);
}
else if ((stack1Index == null) && (stack2Index == null)) {
currentList.add(stack1);
currentList.add(stack2);
equivalencyLists.add(currentList);
}
}
public static Integer getEquivalencyIndexForItem(Object obj) {
ItemStack checkStack = Helper.convertObjectToItemStack(obj);
ArrayList<ItemStack> currentList;
int i = 0;
while (i < equivalencyLists.size()) {
currentList = equivalencyLists.get(i);
for (ItemStack currentStack : currentList) {
if (checkStack.isStackEqual(currentStack)) {
return new Integer(i);
}
}
++i;
}
return null;
}
public static Integer getEquivalencyIndexForItem(int id, int meta) {
ArrayList<ItemStack> currentList;
int i = 0;
while (i < equivalencyLists.size()) {
currentList = equivalencyLists.get(i);
for (ItemStack currentStack : currentList) {
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
return new Integer(i);
}
}
++i;
}
return null;
}
public static ArrayList<ItemStack> getEquivalencyListForItem(Object obj) {
ItemStack checkStack = Helper.convertObjectToItemStack(obj);
if (checkStack == null)
return null;
for (ArrayList<ItemStack> list : equivalencyLists) {
for (ItemStack currentStack : list) {
if (checkStack.isStackEqual(currentStack)) {
return list;
}
}
}
return null;
}
public static ArrayList<ItemStack> getEquivalencyListForItem(int id, int meta) {
for (ArrayList<ItemStack> list : equivalencyLists) {
for (ItemStack currentStack : list) {
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
return list;
}
}
}
return null;
}
public static ItemStack getNextItemInEquivalencyList(Object obj) {
ItemStack checkStack = Helper.convertObjectToItemStack(obj);
if (checkStack == null)
return null;
return getNextItemInEquivalencyList(checkStack.itemID, checkStack.getItemDamage());
}
public static ItemStack getNextItemInEquivalencyList(int id, int meta) {
ArrayList<ItemStack> list = getEquivalencyListForItem(id, meta);
ItemStack currentStack;
ItemStack returnStack = null;
int i = 0;
if (list != null) {
while (i < list.size()) {
currentStack = list.get(i);
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
returnStack = list.get((i + 1) % list.size());
break;
}
++i;
}
}
return returnStack;
}
public static ItemStack getNextBlockInEquivalencyList(int id, int meta, boolean useGravityAffectedBlocks) {
ArrayList<ItemStack> list = getEquivalencyListForItem(id, meta);
ItemStack currentStack;
ItemStack returnStack = null;
int i = 0;
if (list != null) {
while (i < list.size()) {
currentStack = list.get(i);
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
int index = (i + 1) % list.size();
returnStack = list.get(index);
//while ((index != i) && (Block.blocksList[returnStack.itemID] == null)) {
while ((index != i) && ((Block.blocksList[returnStack.itemID] == null) || ((Block.blocksList[returnStack.itemID] instanceof BlockSand) && !useGravityAffectedBlocks) ))
{
returnStack = list.get(index);
index = (index + 1) % list.size();
}
}
++i;
}
}
return returnStack;
}
public static ItemStack getPrevBlockInEquivalencyList(int id, int meta) {
ArrayList<ItemStack> list = getEquivalencyListForItem(id, meta);
ItemStack currentStack;
ItemStack returnStack = null;
int i = 0;
if (list != null) {
while (i < list.size()) {
currentStack = list.get(i);
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
int index = ((i - 1) + list.size()) % list.size();
returnStack = list.get(index);
while ((index != i) && (Block.blocksList[returnStack.itemID] == null)) {
returnStack = list.get(index);
index = ((index - 1) + list.size()) % list.size();
}
}
++i;
}
}
return returnStack;
}
public static void debugPrintEquivalencyList() {
int i = 0;
for (ArrayList list : equivalencyLists) {
System.out.println("equivalencyList[" + i + "]: " + list.toString());
++i;
}
}
}

View file

@ -1,70 +0,0 @@
package ee3.lib;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import ee3.mod_EE3;
import net.minecraft.src.ModLoader;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class Version {
public static final int MAJOR = 1;
public static final int MINOR = 0;
public static final int REVISION = 0;
public static final int BUILD = 0;
public static final int REQ_FORGE_MAJOR = 3;
public static final int REQ_FORGE_MINOR = 3;
public static final int REQ_FORGE_REVISION = 8;
private static final String REMOTE_VERSION_FILE = "http://dl.dropbox.com/u/25591134/EE2/version.txt";
public static final byte CURRENT = 0;
public static final byte OUTDATED = 1;
public static final byte CONNECTION_ERROR = 2;
public static byte currentVersion = 0;
public static String getVersion() {
return String.format("%d.%d.%d.%d", MAJOR, MINOR, REVISION, BUILD);
}
public static void versionCheck() {
try {
URL url = new URL(REMOTE_VERSION_FILE);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line = null;
while ((line = reader.readLine()) != null) {
if (line.startsWith(mod_EE3.proxy.getMinecraftVersion())) {
if (line.contains(Reference.CHANNEL_NAME)) {
if (line.endsWith(getVersion())) {
ModLoader.getLogger().finer(Reference.LOGGER_PREFIX + "Version Check - Using the latest version");
currentVersion = CURRENT;
return;
}
}
}
}
ModLoader.getLogger().finer(Reference.LOGGER_PREFIX + "Version Check - Using outdated version");
currentVersion = OUTDATED;
} catch (Exception e) {
ModLoader.getLogger().warning(Reference.LOGGER_PREFIX + "Version Check - Unable to read from remote version authority");
currentVersion = CONNECTION_ERROR;
}
}
}

View file

@ -1,119 +0,0 @@
package ee3;
import cpw.mods.fml.common.FMLCommonHandler;
import ee3.block.ModBlocks;
import ee3.core.ConfigurationManager;
import ee3.core.CraftingHandler;
import ee3.core.EntityLivingHandler;
import ee3.core.RecipesPhilStone;
import ee3.core.TickHandler;
import ee3.core.interfaces.IProxy;
import ee3.emc.EMCList;
import ee3.gui.GuiHandler;
import ee3.item.ModItems;
import ee3.lib.ItemIds;
import ee3.lib.Reference;
import ee3.lib.Sounds;
import ee3.lib.Version;
import ee3.network.PacketHandler;
import net.minecraft.src.BaseMod;
import net.minecraft.src.ModLoader;
import net.minecraft.src.SidedProxy;
import net.minecraft.src.forge.MinecraftForge;
import net.minecraft.src.forge.NetworkMod;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class mod_EE3 extends NetworkMod {
private static mod_EE3 instance;
@SidedProxy(clientSide="ee3.client.EEProxy", serverSide="ee3.server.EEProxy")
public static IProxy proxy;
public static EMCList emcList;
public static ConfigurationManager config = new ConfigurationManager(Reference.CONFIG_FILE);
public void load() {
instance = this;
emcList = new EMCList();
// Forge version check
MinecraftForge.versionDetect(Reference.MOD_NAME, Version.REQ_FORGE_MAJOR, Version.REQ_FORGE_MINOR, Version.REQ_FORGE_REVISION);
// Register the Tick Handler
FMLCommonHandler.instance().registerTickHandler(new TickHandler());
// Check this version of EE against the remote version authority
Version.versionCheck();
// Register Packet Handler
MinecraftForge.registerConnectionHandler(new PacketHandler());
// Register KeyBindings
this.proxy.registerKeyBindings();
// Register GUI Handler
MinecraftForge.setGuiHandler(this, new GuiHandler());
// Register Sound Handler
this.proxy.registerSoundHandler();
// Register the EntityLiving Handler
MinecraftForge.registerEntityLivingHandler(new EntityLivingHandler());
// Register the Crafting Handler
MinecraftForge.registerCraftingHandler(new CraftingHandler());
// Initialise the configuration settings from file
this.config.init();
// Add in the custom Item rarity types
this.proxy.addCustomEnumRarityTypes();
// Pre-load Textures
this.proxy.preloadTextures();
// Initialise the mod blocks
ModBlocks.init();
// Initialise the mod items
ModItems.init();
// Init TextureFX
this.proxy.initTextureFX();
// Initialise the Philosopher Stone recipes
RecipesPhilStone.initRecipes();
// Initialise the EMC List
//this.emcList.initEMCList();
}
public static BaseMod instance() {
return instance;
}
@Override
public void keyBindingEvent(Object event) {
this.proxy.keyBindingEvent(event);
}
@Override
public String getVersion() {
return Version.getVersion();
}
@Override
public boolean clientSideRequired() {
return true;
}
@Override
public boolean serverSideRequired() {
return false;
}
}

View file

@ -1,59 +0,0 @@
package ee3.network;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.forge.packets.ForgePacket;
/**
* TODO Class Description
* @author pahimar, cpw
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EEPacket {
protected PacketTypeHandler packetType;
protected boolean isChunkDataPacket;
public EEPacket(PacketTypeHandler type, boolean isChunkDataPacket) {
this.packetType = type;
this.isChunkDataPacket = isChunkDataPacket;
}
public byte[] populate() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
try {
dos.writeByte(packetType.ordinal());
this.writeData(dos);
} catch (IOException e) {
e.printStackTrace();
}
return bos.toByteArray();
}
public void readPopulate(DataInputStream data) {
try {
this.readData(data);
} catch (IOException e) {
e.printStackTrace();
}
}
public void execute(NetworkManager network) { }
public void writeData(DataOutputStream data) throws IOException { }
public void readData(DataInputStream data) throws IOException { }
public void setKey(int key) { }
public void setCoords(int x, int y, int z) { }
public void setOrientation(byte direction) { }
public void setPlayerName(String player) { }
public void setItem(int itemId) { }
public void setState(boolean activated) { }
}

View file

@ -1,42 +0,0 @@
package ee3.network;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import ee3.mod_EE3;
import net.minecraft.src.NetworkManager;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class KeyPressedPacket extends EEPacket {
public int key;
public KeyPressedPacket() {
super(PacketTypeHandler.KEY, false);
}
@Override
public void writeData(DataOutputStream data) throws IOException {
data.writeInt(key);
}
public void readData(DataInputStream data) throws IOException {
this.key = data.readInt();
}
public void setKey(int key) {
this.key = key;
}
// Stub
public void execute(NetworkManager network) {
mod_EE3.proxy.handleControl(network, key);
}
}

View file

@ -1,57 +0,0 @@
package ee3.network;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import ee3.lib.Reference;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet1Login;
import net.minecraft.src.forge.IConnectionHandler;
import net.minecraft.src.forge.IPacketHandler;
import net.minecraft.src.forge.MessageManager;
/**
* TODO Class Description
* @author pahimar, cpw
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class PacketHandler implements IPacketHandler, IConnectionHandler {
@Override
public void onConnect(NetworkManager network) {
}
@Override
//Called when a connection is established
public void onLogin(NetworkManager network, Packet1Login login) {
MessageManager.getInstance().registerChannel(network, this, Reference.CHANNEL_NAME);
}
@Override
//Called when a connection drops
public void onDisconnect(NetworkManager network, String message, Object[] args) {
MessageManager.getInstance().removeConnection(network);
}
@Override
// Called when a Packet is received
public void onPacketData(NetworkManager network, String channel, byte[] data) {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data));
EEPacket packet = PacketTypeHandler.buildPacket(data);
packet.execute(network);
}
// Called when a Packet is requested to be sent
public static Packet getPacketForSending(EEPacket packet) {
return PacketTypeHandler.populatePacket(packet);
}
public static EEPacket getPacket(PacketTypeHandler type) {
EEPacket pkt = PacketTypeHandler.buildPacket(type);
return pkt;
}
}

View file

@ -1,13 +0,0 @@
package ee3.network;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class PacketIds {
public static final int KEYPRESS_EVENT = 0;
public static final int TILE_UPDATE = 1;
public static final int PEDESTAL_UPDATE = 2;
}

View file

@ -1,65 +0,0 @@
package ee3.network;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import ee3.lib.Reference;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet250CustomPayload;
/**
* TODO Class Description
* @author pahimar, cpw
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public enum PacketTypeHandler {
KEY(KeyPressedPacket.class),
TILE(TileEntityPacket.class),
PEDESTAL(PedestalPacket.class);
private Class<? extends EEPacket> clazz;
PacketTypeHandler(Class<? extends EEPacket> clazz) {
this.clazz=clazz;
}
// Called from PacketHandler.onPacketData
public static EEPacket buildPacket(byte[] data) {
ByteArrayInputStream bis = new ByteArrayInputStream(data);
int selector = bis.read();
DataInputStream dis = new DataInputStream(bis);
EEPacket pkt = null;
try {
pkt = values()[selector].clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
}
pkt.readPopulate(dis);
return pkt;
}
// Called from code to get a packet of a specific type
public static EEPacket buildPacket(PacketTypeHandler type) {
EEPacket pkt = null;
try {
pkt = values()[type.ordinal()].clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
}
return pkt;
}
public static Packet populatePacket(EEPacket packet) {
byte[] data = packet.populate();
Packet250CustomPayload pkt = new Packet250CustomPayload();
pkt.channel = Reference.CHANNEL_NAME;
pkt.data = data;
pkt.length = data.length;
pkt.isChunkDataPacket = packet.isChunkDataPacket;
return pkt;
}
}

View file

@ -1,60 +0,0 @@
package ee3.network;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import ee3.mod_EE3;
import net.minecraft.src.NetworkManager;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class PedestalPacket extends EEPacket {
int x, y, z;
public int itemId;
public boolean activated;
public PedestalPacket() {
super(PacketTypeHandler.PEDESTAL, true);
}
public void setCoords(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public void setItem(int itemId) {
this.itemId = itemId;
}
public void setState(boolean activated) {
this.activated = activated;
}
@Override
public void writeData(DataOutputStream data) throws IOException {
data.writeInt(x);
data.writeInt(y);
data.writeInt(z);
data.writeInt(itemId);
data.writeBoolean(activated);
}
public void readData(DataInputStream data) throws IOException {
this.x = data.readInt();
this.y = data.readInt();
this.z = data.readInt();
this.itemId = data.readInt();
this.activated = data.readBoolean();
}
public void execute(NetworkManager network) {
mod_EE3.proxy.handlePedestalPacket(x, y, z, itemId, activated);
}
}

View file

@ -1,62 +0,0 @@
package ee3.network;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import ee3.mod_EE3;
import net.minecraft.src.NetworkManager;
/**
* TODO Class Description
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class TileEntityPacket extends EEPacket {
public int x, y, z;
public byte direction;
String player;
public TileEntityPacket() {
super(PacketTypeHandler.TILE, true);
}
public void setCoords(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public void setOrientation(byte direction) {
this.direction = direction;
}
public void setPlayerName(String player) {
this.player = player;
}
@Override
public void writeData(DataOutputStream data) throws IOException {
data.writeInt(x);
data.writeInt(y);
data.writeInt(z);
data.writeByte(direction);
data.writeUTF(player);
}
public void readData(DataInputStream data) throws IOException {
this.x = data.readInt();
this.y = data.readInt();
this.z = data.readInt();
this.direction = data.readByte();
this.player = data.readUTF();
}
public void execute(NetworkManager network) {
mod_EE3.proxy.handleTEPacket(x, y, z, direction, player);
}
}

View file

@ -1,5 +0,0 @@
package ee3.te;
public class TileCalcinator extends TileEE {
}

View file

@ -1,7 +0,0 @@
package ee3.te;
import net.minecraft.src.TileEntity;
public class TileEE extends TileEntity {
}

View file

@ -1,19 +0,0 @@
[
{
"modid" : "mod_EE3",
"name" : "Equivalent Exchange 3",
"version" : "v1.0.0.0",
"url" : "http://www.minecraftforum.net/topic/1106178-",
"credits" : "Original by x3n0ph0b3, maintained by Pahimar",
"authors": [
"x3n0ph0b3",
"pahimar"
],
"description": "Transmute stuff into other stuff! Become a Minecraft God!",
"logoFile" : "",
"updateUrl" : "http://www.minecraftforum.net/topic/1106178-",
"parent" : "",
"screenshots": [
]
}
]