Missed the removal part of the last commit

This commit is contained in:
pahimar 2013-08-23 11:01:17 -04:00
parent ae1ebbe58e
commit 2a3e65c8ec
143 changed files with 2 additions and 12863 deletions

3
.gitignore vendored
View file

@ -2,4 +2,5 @@ build.properties
.DS_Store
.DS_Store?
.Spotlight-V100
.Trashes
.Trashes
/bin

View file

@ -1,201 +0,0 @@
package com.pahimar.ee3;
import java.io.File;
import java.util.Arrays;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.MinecraftForge;
import com.pahimar.ee3.block.ModBlocks;
import com.pahimar.ee3.command.CommandHandler;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.core.handlers.ActionRequestHandler;
import com.pahimar.ee3.core.handlers.AddonHandler;
import com.pahimar.ee3.core.handlers.CraftingHandler;
import com.pahimar.ee3.core.handlers.EntityLivingHandler;
import com.pahimar.ee3.core.handlers.FuelHandler;
import com.pahimar.ee3.core.handlers.InterModCommsHandler;
import com.pahimar.ee3.core.handlers.ItemEventHandler;
import com.pahimar.ee3.core.handlers.LocalizationHandler;
import com.pahimar.ee3.core.handlers.PlayerDestroyItemHandler;
import com.pahimar.ee3.core.handlers.VersionCheckTickHandler;
import com.pahimar.ee3.core.handlers.WorldTransmutationHandler;
import com.pahimar.ee3.core.proxy.CommonProxy;
import com.pahimar.ee3.core.util.LogHelper;
import com.pahimar.ee3.core.util.VersionHelper;
import com.pahimar.ee3.creativetab.CreativeTabEE3;
import com.pahimar.ee3.emc.DynEMC;
import com.pahimar.ee3.item.ModItems;
import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes;
import com.pahimar.ee3.lib.InterModComms;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
import com.pahimar.ee3.network.PacketHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* Equivalent-Exchange-3
*
* EquivalentExchange3
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION_NUMBER, dependencies = Reference.DEPENDENCIES, certificateFingerprint = Reference.FINGERPRINT)
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class EquivalentExchange3 {
@Instance(Reference.MOD_ID)
public static EquivalentExchange3 instance;
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static CreativeTabs tabsEE3 = new CreativeTabEE3(
CreativeTabs.getNextID(), Reference.MOD_ID);
@EventHandler
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
// Report (log) to the user that the version of Equivalent Exchange 3
// they are using has been changed/tampered with
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
// Initialize the custom commands
CommandHandler.initCommands(event);
}
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
// Initialize the log helper
LogHelper.init();
// Load the localization files into the LanguageRegistry
LocalizationHandler.loadLanguages();
// Initialize the configuration
ConfigurationHandler.init(new File(event.getModConfigurationDirectory()
.getAbsolutePath()
+ File.separator
+ Reference.CHANNEL_NAME
+ File.separator + Reference.MOD_ID + ".cfg"));
// Conduct the version check and log the result
VersionHelper.execute();
// Initialize the Version Check Tick Handler (Client only)
TickRegistry.registerTickHandler(new VersionCheckTickHandler(),
Side.CLIENT);
// Initialize the Render Tick Handler (Client only)
proxy.registerRenderTickHandler();
// Register the KeyBinding Handler (Client only)
proxy.registerKeyBindingHandler();
// Register the Sound Handler (Client only)
proxy.registerSoundHandler();
// Initialize mod blocks
ModBlocks.init();
// Initialize mod items
ModItems.init();
}
@EventHandler
@SuppressWarnings("unchecked")
public void load(FMLInitializationEvent event) {
// Register the GUI Handler
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
// Register the PlayerDestroyItem Handler
MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler());
// Register the Item Pickup Handler
MinecraftForge.EVENT_BUS.register(new ItemEventHandler());
// Register the EntityLiving Handler
MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());
MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());
MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());
GameRegistry.registerCraftingHandler(new CraftingHandler());
// Register the DrawBlockHighlight Handler
proxy.registerDrawBlockHighlightHandler();
// Initialize mod tile entities
proxy.registerTileEntities();
// Initialize custom rendering and pre-load textures (Client only)
proxy.initRenderingAndTextures();
// Add in the ability to dye Alchemical Bags
CraftingManager.getInstance().getRecipeList()
.add(new RecipesAlchemicalBagDyes());
// Register the Fuel Handler
GameRegistry.registerFuelHandler(new FuelHandler());
// Quick test to see that sending an encoded recipe to be added to the
// recipe registry works
FMLInterModComms.sendMessage(
Reference.MOD_ID,
InterModComms.ADD_RECIPE,
NBTHelper.encodeRecipeAsNBT(Item.bucketWater,
Arrays.asList(Item.bucketEmpty, Block.waterStill)));
FMLInterModComms.sendMessage(
Reference.MOD_ID,
InterModComms.ADD_RECIPE,
NBTHelper.encodeRecipeAsNBT(Item.bucketLava,
Arrays.asList(Item.bucketEmpty, Block.lavaStill)));
}
@EventHandler
public void modsLoaded(FMLPostInitializationEvent event) {
// Initialize the Addon Handler
AddonHandler.init();
// Initialize the DynEMC system
// TODO Seems like this happens earlier than it should now, investigate
// where this should go
DynEMC dynEMC = DynEMC.getInstance();
}
@EventHandler
public void handleIMCMessages(IMCEvent event) {
InterModCommsHandler.processIMCMessages(event);
}
}

View file

@ -1,130 +0,0 @@
package com.pahimar.ee3.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
/**
* Equivalent-Exchange-3
*
* BlockAlchemicalChest
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockAlchemicalChest extends BlockEE {
/**
* Is the random generator used by alchemical chest to drop the inventory
* contents in random directions.
*/
private Random rand = new Random();
public BlockAlchemicalChest(int id) {
super(id, Material.wood);
this.setUnlocalizedName(Strings.ALCHEMICAL_CHEST_NAME);
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileAlchemicalChest();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return RenderIds.alchemicalChestRenderId;
}
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, id, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking())
return true;
else if (world.isBlockSolidOnSide(x, y + 1, z, ForgeDirection.DOWN))
return true;
else {
if (!world.isRemote) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
if (tileAlchemicalChest != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z);
}
}
return true;
}
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
return;
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) {
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0;
}
}
}
}

View file

@ -1,168 +0,0 @@
package com.pahimar.ee3.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileGlassBell;
/**
* Equivalent-Exchange-3
*
* BlockAludel
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockAludelBase extends BlockEE {
/**
* Is the random generator used by aludel to drop the inventory contents in
* random directions.
*/
private Random rand = new Random();
public BlockAludelBase(int id) {
super(id, Material.anvil);
this.setUnlocalizedName(Strings.ALUDEL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
this.setHardness(5F);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileAludel();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return RenderIds.aludelRenderId;
}
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
if (world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) {
world.markBlockForUpdate(x, y + 1, z);
world.updateAllLightTypes(x, y + 1, z);
}
super.breakBlock(world, x, y, z, id, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
else {
if (!world.isRemote) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
if (tileAludel != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y, z);
}
}
return true;
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
if (world.getBlockTileEntity(x, y + 1, z) != null && world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y + 1, z);
tileGlassBell.setOrientation(ForgeDirection.UP);
if (world.getBlockTileEntity(x, y, z) != null && world.getBlockTileEntity(x, y, z) instanceof TileAludel) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
ItemStack itemStackGlassBell = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX);
tileGlassBell.setInventorySlotContents(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, null);
tileAludel.setInventorySlotContents(TileAludel.INPUT_INVENTORY_INDEX, itemStackGlassBell);
}
}
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
return 0;
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
return;
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) {
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0;
}
}
}
}

View file

@ -1,128 +0,0 @@
package com.pahimar.ee3.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileCalcinator;
/**
* Equivalent-Exchange-3
*
* BlockCalcinator
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockCalcinator extends BlockEE {
/**
* Is the random generator used by calcinator to drop the inventory contents
* in random directions.
*/
private Random rand = new Random();
public BlockCalcinator(int id) {
super(id, Material.rock);
this.setUnlocalizedName(Strings.CALCINATOR_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setHardness(5F);
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileCalcinator();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return RenderIds.calcinatorRenderId;
}
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, id, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
else {
if (!world.isRemote) {
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
if (tileCalcinator != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
}
}
return true;
}
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
return;
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) {
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0;
}
}
}
}

View file

@ -1,76 +0,0 @@
package com.pahimar.ee3.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.tileentity.TileEE;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* BlockEE
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public abstract class BlockEE extends BlockContainer {
public BlockEE(int id, Material material) {
super(id, material);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(String.format("%s:%s", Reference.MOD_ID.toLowerCase(), getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
}
protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
/**
* Sets the direction of the block when placed
*/
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
int direction = 0;
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (facing == 0) {
direction = ForgeDirection.NORTH.ordinal();
}
else if (facing == 1) {
direction = ForgeDirection.EAST.ordinal();
}
else if (facing == 2) {
direction = ForgeDirection.SOUTH.ordinal();
}
else if (facing == 3) {
direction = ForgeDirection.WEST.ordinal();
}
world.setBlockMetadataWithNotify(x, y, z, direction, 3);
if (itemStack.hasDisplayName()) {
((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(direction);
}
}

View file

@ -1,231 +0,0 @@
package com.pahimar.ee3.block;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileEE;
import com.pahimar.ee3.tileentity.TileGlassBell;
public class BlockGlassBell extends BlockEE {
/**
* Is the random generator used by glass bell to drop the inventory contents
* in random directions.
*/
private Random rand = new Random();
public BlockGlassBell(int id) {
super(id, Material.glass);
this.setUnlocalizedName(Strings.GLASS_BELL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setHardness(1.0F);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileGlassBell();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return RenderIds.glassBellId;
}
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, id, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
else {
if (!world.isRemote) {
TileEntity tileEntityGlassBell = world.getBlockTileEntity(x, y, z);
TileEntity tileEntityAludel = world.getBlockTileEntity(x, y - 1, z);
if (tileEntityAludel instanceof TileAludel && tileEntityGlassBell instanceof TileGlassBell) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y - 1, z);
return true;
}
if (tileEntityGlassBell != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.GLASS_BELL, world, x, y, z);
}
}
return true;
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
if (itemStack.hasDisplayName()) {
((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
if (world.getBlockTileEntity(x, y - 1, z) != null && world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) {
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(ForgeDirection.UP);
}
else {
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
}
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) {
return sideHit;
}
/**
* Ray traces through the blocks collision from start vector to end vector
* returning a ray trace hit. Args: world, x, y, z, startVec, endVec
*/
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null) {
if (tileEntity instanceof TileGlassBell) {
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
switch (tileGlassBell.getOrientation()) {
case DOWN: {
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
break;
}
case UP: {
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
break;
}
case NORTH: {
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
break;
}
case SOUTH: {
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
break;
}
case EAST: {
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
break;
}
case WEST: {
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
break;
}
case UNKNOWN: {
break;
}
}
}
}
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
ItemStack itemStack;
if (world.getBlockTileEntity(x, y, z) instanceof TileGlassBell) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
if (world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y - 1, z);
itemStack = tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX);
if (itemStack != null && itemStack.itemID < 4096)
return Block.lightValue[itemStack.itemID];
}
itemStack = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX);
if (itemStack != null && itemStack.itemID < 4096)
return Block.lightValue[itemStack.itemID];
}
return 0;
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
return;
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) {
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0;
}
}
}
}

View file

@ -1,28 +0,0 @@
package com.pahimar.ee3.block;
import net.minecraft.block.BlockFlowing;
import net.minecraft.block.material.Material;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* BlockRedWaterFlowing
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockRedWaterFlowing extends BlockFlowing {
protected BlockRedWaterFlowing(int id) {
super(id, Material.water);
blockHardness = 100F;
this.setLightOpacity(3);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setUnlocalizedName(Strings.RED_WATER_FLOWING_NAME);
}
}

View file

@ -1,29 +0,0 @@
package com.pahimar.ee3.block;
import net.minecraft.block.BlockStationary;
import net.minecraft.block.material.Material;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* BlockRedWaterStill
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockRedWaterStill extends BlockStationary {
protected BlockRedWaterStill(int id) {
super(id, Material.water);
blockHardness = 100F;
this.setLightOpacity(3);
this.setUnlocalizedName(Strings.RED_WATER_STILL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.disableStats();
}
}

View file

@ -1,55 +0,0 @@
package com.pahimar.ee3.block;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.lib.BlockIds;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* Equivalent-Exchange-3
*
* ModBlocks
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ModBlocks {
/* Mod block instances */
public static Block calcinator;
public static Block aludelBase;
public static Block alchemicalChest;
public static Block glassBell;
public static Block redWaterStill;
public static Block redWaterFlowing;
public static void init() {
calcinator = new BlockCalcinator(BlockIds.CALCINATOR);
aludelBase = new BlockAludelBase(BlockIds.ALUDEL_BASE);
alchemicalChest = new BlockAlchemicalChest(BlockIds.ALCHEMICAL_CHEST);
glassBell = new BlockGlassBell(BlockIds.GLASS_BELL);
redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL);
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1);
GameRegistry.registerBlock(calcinator, Strings.CALCINATOR_NAME);
GameRegistry.registerBlock(aludelBase, Strings.ALUDEL_NAME);
GameRegistry.registerBlock(alchemicalChest, Strings.ALCHEMICAL_CHEST_NAME);
GameRegistry.registerBlock(glassBell, Strings.GLASS_BELL_NAME);
//GameRegistry.registerBlock(redWaterStill, Strings.RED_WATER_STILL_NAME);
//GameRegistry.registerBlock(redWaterFlowing, Strings.RED_WATER_FLOWING_NAME);
initBlockRecipes();
}
private static void initBlockRecipes() {
GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] { "iii", "i i", "i i", Character.valueOf('i'), Block.glass });
GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] { "iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone });
}
}

View file

@ -1,35 +0,0 @@
package com.pahimar.ee3.client.audio;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import com.pahimar.ee3.core.util.LogHelper;
import com.pahimar.ee3.lib.Sounds;
/**
* Equivalent-Exchange-3
*
* SoundHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class SoundHandler {
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event) {
// For each custom sound file we have defined in Sounds
for (String soundFile : Sounds.soundFiles) {
// Try to add the custom sound file to the pool of sounds
try {
event.manager.addSound(soundFile);
}
// If we cannot add the custom sound file to the pool, log the exception
catch (Exception e) {
LogHelper.warning("Failed loading sound file: " + soundFile);
}
}
}
}

View file

@ -1,78 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiAlchemicalBag
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiAlchemicalBag extends GuiContainer {
public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) {
super(new ContainerAlchemicalBag(inventoryPlayer));
xSize = 248;
ySize = 186;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRenderer.drawString(StatCollector
.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6,
4210752);
fontRenderer.drawString(
StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY),
44, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.mc.getTextureManager().bindTexture(...)
this.mc.func_110434_K().func_110577_a(Textures.GUI_ALCHEMICAL_STORAGE);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
if (mc.thePlayer != null) {
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack,
Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
NBTHelper.removeTag(itemStack,
Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
}
}
}
}

View file

@ -1,58 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiAlchemicalChest
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiAlchemicalChest extends GuiContainer {
private TileAlchemicalChest tileAlchemicalChest;
public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest alchemicalChest) {
super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest));
tileAlchemicalChest = alchemicalChest;
xSize = 248;
ySize = 186;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRenderer.drawString(tileAlchemicalChest.isInvNameLocalized() ? tileAlchemicalChest.getInvName() : StatCollector.translateToLocal(tileAlchemicalChest.getInvName()), 8, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 44, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.mc.getTextureManager().bindTexture(...)
this.mc.func_110434_K().func_110577_a(Textures.GUI_ALCHEMICAL_STORAGE);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,56 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerAludel;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAludel;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiAludel
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiAludel extends GuiContainer {
private TileAludel tileAludel;
public GuiAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) {
super(new ContainerAludel(inventoryPlayer, tileAludel));
this.tileAludel = tileAludel;
xSize = 176;
ySize = 187;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
String containerName = tileAludel.isInvNameLocalized() ? tileAludel.getInvName() : StatCollector.translateToLocal(tileAludel.getInvName());
fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(Textures.GUI_ALUDEL);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,58 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerCalcinator;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileCalcinator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiCalcinator
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiCalcinator extends GuiContainer {
private TileCalcinator tileCalcinator;
public GuiCalcinator(InventoryPlayer player, TileCalcinator tileCalcinator) {
super(new ContainerCalcinator(player, tileCalcinator));
ySize = 176;
this.tileCalcinator = tileCalcinator;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
String containerName = tileCalcinator.isInvNameLocalized() ? tileCalcinator.getInvName() : StatCollector.translateToLocal(tileCalcinator.getInvName());
fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.getTextureManager().bindTexture(...)
this.mc.func_110434_K().func_110577_a(Textures.GUI_CALCINATOR);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,56 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiGlassBell
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiGlassBell extends GuiContainer {
private TileGlassBell tileGlassBell;
public GuiGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) {
super(new ContainerGlassBell(inventoryPlayer, tileGlassBell));
this.tileGlassBell = tileGlassBell;
xSize = 176;
ySize = 140;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
String containerName = tileGlassBell.isInvNameLocalized() ? tileGlassBell.getInvName() : StatCollector.translateToLocal(tileGlassBell.getInvName());
fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(Textures.GUI_GLASS_BELL);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,76 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiPortableCrafting
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiPortableCrafting extends GuiContainer {
public GuiPortableCrafting(EntityPlayer player, World world, int x, int y, int z) {
super(new ContainerPortableCrafting(player.inventory, world, x, y, z));
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_PORTABLE_CRAFTING), 28, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(Textures.GUI_PORTABLE_CRAFTING);
int var5 = (width - xSize) / 2;
int var6 = (height - ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize);
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
if (mc.thePlayer != null) {
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
}
}
}
}
}
}

View file

@ -1,58 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiPortableTransmutation
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiPortableTransmutation extends GuiContainer {
public GuiPortableTransmutation(Container par1Container) {
super(par1Container);
// TODO Auto-generated constructor stub
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(Textures.GUI_PORTABLE_TRANSMUTATION);
int var5 = (width - xSize) / 2;
int var6 = (height - ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize);
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
if (mc.thePlayer != null) {
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
}
}
}
}
}

View file

@ -1,34 +0,0 @@
package com.pahimar.ee3.client.model;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import com.pahimar.ee3.lib.Models;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ModelAludel
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ModelAludel {
private IModelCustom modelAludel;
public ModelAludel() {
modelAludel = AdvancedModelLoader.loadModel(Models.ALUDEL);
}
public void render() {
modelAludel.renderPart("Base");
}
}

View file

@ -1,39 +0,0 @@
package com.pahimar.ee3.client.model;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import com.pahimar.ee3.lib.Models;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* ModelCalcinator
*
* Model for the Calcinator
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ModelCalcinator {
private IModelCustom modelCalcinator;
public ModelCalcinator() {
modelCalcinator = AdvancedModelLoader.loadModel(Models.CALCINATOR);
}
public void render() {
modelCalcinator.renderAll();
}
public void renderPart(String partName) {
modelCalcinator.renderPart(partName);
}
}

View file

@ -1,21 +0,0 @@
package com.pahimar.ee3.client.model;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import com.pahimar.ee3.lib.Models;
public class ModelGlassBell {
private IModelCustom modelGlassBell;
public ModelGlassBell() {
modelGlassBell = AdvancedModelLoader.loadModel(Models.GLASS_BELL);
}
public void render() {
modelGlassBell.renderPart("Bell");
}
}

View file

@ -1,84 +0,0 @@
package com.pahimar.ee3.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
/**
* Equivalent-Exchange-3
*
* RenderUtils
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class RenderUtils {
private static int rotationAngle = 0;
public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, ItemStack stack, int x, int y, float zLevel, float scale) {
RenderBlocks renderBlocks = new RenderBlocks();
Block block = Block.blocksList[stack.itemID];
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.VANILLA_BLOCK_TEXTURE_SHEET);
GL11.glPushMatrix();
GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(0F + 1 * rotationAngle, 0.0F, 1.0F, 0.0F);
rotationAngle = (rotationAngle + 1) % 360;
int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0);
float var16 = (var10 >> 16 & 255) / 255.0F;
float var12 = (var10 >> 8 & 255) / 255.0F;
float var13 = (var10 & 255) / 255.0F;
GL11.glColor4f(var16, var12, var13, 1.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
renderBlocks.useInventoryTint = true;
renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F);
renderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
public static void renderItemIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, float opacity, float scale) {
Icon icon = itemStack.getIconIndex();
GL11.glDisable(GL11.GL_LIGHTING);
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.VANILLA_ITEM_TEXTURE_SHEET);
int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0);
float red = (overlayColour >> 16 & 255) / 255.0F;
float green = (overlayColour >> 8 & 255) / 255.0F;
float blue = (overlayColour & 255) / 255.0F;
GL11.glColor4f(red, green, blue, opacity);
drawTexturedQuad(x, y, icon, 16 * scale, 16 * scale, -90);
GL11.glEnable(GL11.GL_LIGHTING);
}
public static void drawTexturedQuad(int x, int y, Icon icon, float width, float height, double zLevel) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x + 0, y + height, zLevel, icon.getMinU(), icon.getMaxV());
tessellator.addVertexWithUV(x + width, y + height, zLevel, icon.getMaxU(), icon.getMaxV());
tessellator.addVertexWithUV(x + width, y + 0, zLevel, icon.getMaxU(), icon.getMinV());
tessellator.addVertexWithUV(x + 0, y + 0, zLevel, icon.getMinU(), icon.getMinV());
tessellator.draw();
}
}

View file

@ -1,81 +0,0 @@
package com.pahimar.ee3.client.renderer.item;
import net.minecraft.client.model.ModelChest;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemAlchemicalChestRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ItemAlchemicalChestRenderer implements IItemRenderer {
private ModelChest modelChest;
public ItemAlchemicalChestRenderer() {
modelChest = new ModelChest();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
renderAlchemicalChest(0.5F, 0.5F, 0.5F);
break;
}
case EQUIPPED: {
renderAlchemicalChest(1.0F, 1.0F, 1.0F);
break;
}
case EQUIPPED_FIRST_PERSON: {
renderAlchemicalChest(1.0F, 1.0F, 1.0F);
break;
}
case INVENTORY: {
renderAlchemicalChest(0.0F, 0.075F, 0.0F);
break;
}
default:
break;
}
}
private void renderAlchemicalChest(float x, float y, float z) {
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALCHEMICAL_CHEST);
GL11.glPushMatrix(); //start
GL11.glTranslatef(x, y, z); //size
GL11.glRotatef(180, 1, 0, 0);
GL11.glRotatef(-90, 0, 1, 0);
modelChest.renderAll();
GL11.glPopMatrix(); //end
}
}

View file

@ -1,90 +0,0 @@
package com.pahimar.ee3.client.renderer.item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelAludel;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemAludelRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ItemAludelRenderer implements IItemRenderer {
private ModelAludel modelAludel;
public ItemAludelRenderer() {
modelAludel = new ModelAludel();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
renderAludel(-0.5F, -0.38F, 0.5F, 1.0F);
return;
}
case EQUIPPED: {
renderAludel(0.0F, 0.0F, 1.0F, 1.0F);
return;
}
case EQUIPPED_FIRST_PERSON: {
renderAludel(0.0F, 0.0F, 1.0F, 1.0F);
return;
}
case INVENTORY: {
renderAludel(-1.0F, -0.9F, 0.0F, 1.0F);
return;
}
default:
return;
}
}
private void renderAludel(float x, float y, float z, float scale) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(x, y, z);
GL11.glRotatef(-90F, 1F, 0, 0);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALUDEL);
// Render
modelAludel.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View file

@ -1,90 +0,0 @@
package com.pahimar.ee3.client.renderer.item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelCalcinator;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemCalcinatorRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ItemCalcinatorRenderer implements IItemRenderer {
private ModelCalcinator modelCalcinator;
public ItemCalcinatorRenderer() {
modelCalcinator = new ModelCalcinator();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
renderCalcinator(-0.5F, 0.0F, 0.5F, 1.0F);
return;
}
case EQUIPPED: {
renderCalcinator(0.0F, 0.0F, 1.0F, 1.0F);
return;
}
case EQUIPPED_FIRST_PERSON: {
renderCalcinator(0.0F, 0.0F, 1.0F, 1.0F);
return;
}
case INVENTORY: {
renderCalcinator(0.0F, -0.1F, 1.0F, 1.0F);
return;
}
default:
return;
}
}
private void renderCalcinator(float x, float y, float z, float scale) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(x, y, z);
GL11.glRotatef(-90F, 1F, 0, 0);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_CALCINATOR);
// Render
modelCalcinator.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View file

@ -1,90 +0,0 @@
package com.pahimar.ee3.client.renderer.item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelGlassBell;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemGlassBellRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ItemGlassBellRenderer implements IItemRenderer {
private ModelGlassBell modelGlassBell;
public ItemGlassBellRenderer() {
modelGlassBell = new ModelGlassBell();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
renderGlassBell(-0.5F, -1.2F, 0.5F, 1.4F);
return;
}
case EQUIPPED: {
renderGlassBell(-0.2F, -0.85F, 0.8F, 1.4F);
return;
}
case EQUIPPED_FIRST_PERSON: {
renderGlassBell(-0.2F, -0.85F, 0.8F, 1.4F);
return;
}
case INVENTORY: {
renderGlassBell(-1.0F, -1.675F, 0.0F, 1.4F);
return;
}
default:
return;
}
}
private void renderGlassBell(float x, float y, float z, float scale) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(x, y, z);
GL11.glRotatef(-90F, 1F, 0, 0);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_GLASS_BELL);
// Render
modelGlassBell.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View file

@ -1,81 +0,0 @@
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityAlchemicalChestRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityAlchemicalChestRenderer extends
TileEntitySpecialRenderer {
private ModelChest modelChest = new ModelChest();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileAlchemicalChest) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity;
ForgeDirection direction = null;
if (tileAlchemicalChest.getWorldObj() != null) {
direction = ForgeDirection.getOrientation(tileAlchemicalChest.getBlockMetadata());
}
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALCHEMICAL_CHEST);
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
short angle = 0;
if (direction != null) {
if (direction == ForgeDirection.NORTH) {
angle = 180;
}
else if (direction == ForgeDirection.SOUTH) {
angle = 0;
}
else if (direction == ForgeDirection.WEST) {
angle = 90;
}
else if (direction == ForgeDirection.EAST) {
angle = -90;
}
}
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick;
adjustedLidAngle = 1.0F - adjustedLidAngle;
adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
modelChest.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}

View file

@ -1,167 +0,0 @@
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelAludel;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityAludelRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityAludelRenderer extends TileEntitySpecialRenderer {
private ModelAludel modelAludel = new ModelAludel();
private final RenderItem customRenderItem;
public TileEntityAludelRenderer() {
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
};
};
customRenderItem.setRenderManager(RenderManager.instance);
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileAludel) {
TileAludel tileAludel = (TileAludel) tileEntity;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
scaleTranslateRotate(x, y, z, tileAludel.getOrientation());
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_ALUDEL);
// Render
modelAludel.render();
GL11.glPopMatrix();
/**
* Render the ghost item inside of the Aludel, slowly spinning
*/
GL11.glPushMatrix();
TileEntity tileGlassBell = tileAludel.worldObj.getBlockTileEntity(tileAludel.xCoord, tileAludel.yCoord + 1, tileAludel.zCoord);
if (tileGlassBell instanceof TileGlassBell) {
if (tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX) != null) {
float scaleFactor = getGhostItemScaleFactor(tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX));
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
EntityItem ghostEntityItem = new EntityItem(tileAludel.worldObj);
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX));
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F);
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0);
}
}
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
}
}
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {
if (orientation == ForgeDirection.NORTH) {
GL11.glTranslated(x + 1, y, z);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.EAST) {
GL11.glTranslated(x + 1, y, z + 1);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.SOUTH) {
GL11.glTranslated(x, y, z + 1);
GL11.glRotatef(0F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.WEST) {
GL11.glTranslated(x, y, z);
GL11.glRotatef(-90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
}
private float getGhostItemScaleFactor(ItemStack itemStack) {
float scaleFactor = 1.0F;
if (itemStack != null) {
if (itemStack.getItem() instanceof ItemBlock) {
switch (customRenderItem.getMiniBlockCount(itemStack)) {
case 1:
return 0.90F;
case 2:
return 0.90F;
case 3:
return 0.90F;
case 4:
return 0.90F;
case 5:
return 0.80F;
default:
return 0.90F;
}
}
else {
switch (customRenderItem.getMiniItemCount(itemStack)) {
case 1:
return 0.65F;
case 2:
return 0.65F;
case 3:
return 0.65F;
case 4:
return 0.65F;
default:
return 0.65F;
}
}
}
return scaleFactor;
}
}

View file

@ -1,58 +0,0 @@
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelCalcinator;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileCalcinator;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityCalcinatorRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer {
private ModelCalcinator modelCalcinator = new ModelCalcinator();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileCalcinator) {
TileCalcinator tileCalcinator = (TileCalcinator) tileEntity;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.0F, (float) z + 1.2F);
GL11.glRotatef(45F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_CALCINATOR);
// Render
modelCalcinator.renderPart("Calcinator");
if (tileCalcinator.getStackInSlot(TileCalcinator.OUTPUT_INVENTORY_INDEX) != null) {
modelCalcinator.renderPart("Dust");
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
}

View file

@ -1,265 +0,0 @@
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelGlassBell;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityGlassBellRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
private ModelGlassBell modelGlassBell = new ModelGlassBell();
private final RenderItem customRenderItem;
public TileEntityGlassBellRenderer() {
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
};
};
customRenderItem.setRenderManager(RenderManager.instance);
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileGlassBell) {
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
/**
* Render the Glass Bell
*/
GL11.glPushMatrix();
// Scale, Translate, Rotate
renderGlassBellByOrientation(x, y, z, tileGlassBell.getOrientation());
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(Textures.MODEL_GLASS_BELL);
modelGlassBell.render();
GL11.glPopMatrix();
/**
* Render the ghost item inside of the Glass Bell, slowly spinning
*/
GL11.glPushMatrix();
if (tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX) != null) {
float scaleFactor = getGhostItemScaleFactor(tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX));
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
EntityItem ghostEntityItem = new EntityItem(tileGlassBell.worldObj);
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX));
translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation());
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0);
}
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
}
}
private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) {
switch (forgeDirection) {
case DOWN: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.0F, (float) y + 2.0F, (float) z + 0.0F);
GL11.glRotatef(90F, 1F, 0F, 0F);
return;
}
case UP: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.0F, (float) y + -1.0F, (float) z + 1.0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
return;
}
case NORTH: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 1.0F, (float) y + 0.0F, (float) z + 2.0F);
GL11.glRotatef(180F, 0F, 1F, 0F);
return;
}
case SOUTH: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + -1.0F);
return;
}
case EAST: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + -1.0F, (float) y + 1.0F, (float) z + 1.0F);
GL11.glRotatef(-90F, 0F, 0F, 1F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
return;
}
case WEST: {
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 2.0F, (float) y + 0.0F, (float) z + 1.0F);
GL11.glRotatef(90F, 0F, 0F, 1F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
return;
}
case UNKNOWN: {
return;
}
default: {
return;
}
}
}
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) {
if (ghostItemStack != null) {
if (ghostItemStack.getItem() instanceof ItemBlock) {
switch (forgeDirection) {
case DOWN: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.7F, (float) z + 0.5F);
return;
}
case UP: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
return;
}
case NORTH: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
return;
}
case SOUTH: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
return;
}
case EAST: {
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case WEST: {
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
return;
}
case UNKNOWN: {
return;
}
default: {
return;
}
}
}
else {
switch (forgeDirection) {
case DOWN: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
return;
}
case UP: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
return;
}
case NORTH: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
return;
}
case SOUTH: {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
return;
}
case EAST: {
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case WEST: {
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
return;
}
case UNKNOWN: {
return;
}
default: {
return;
}
}
}
}
}
private float getGhostItemScaleFactor(ItemStack itemStack) {
float scaleFactor = 1.0F;
if (itemStack != null) {
if (itemStack.getItem() instanceof ItemBlock) {
switch (customRenderItem.getMiniBlockCount(itemStack)) {
case 1:
return 0.90F;
case 2:
return 0.90F;
case 3:
return 0.90F;
case 4:
return 0.90F;
case 5:
return 0.80F;
default:
return 0.90F;
}
}
else {
switch (customRenderItem.getMiniItemCount(itemStack)) {
case 1:
return 0.65F;
case 2:
return 0.65F;
case 3:
return 0.65F;
case 4:
return 0.65F;
default:
return 0.65F;
}
}
}
return scaleFactor;
}
}

View file

@ -1,103 +0,0 @@
package com.pahimar.ee3.command;
import java.util.List;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import com.pahimar.ee3.lib.Commands;
/**
* Equivalent-Exchange-3
*
* CommandEE
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandEE extends CommandBase {
@Override
public String getCommandName() {
return Commands.COMMAND_EE3;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender commandSender) {
return true;
}
@Override
@SuppressWarnings("rawtypes")
public List addTabCompletionOptions(ICommandSender commandSender, String[] args) {
switch (args.length) {
case 1: {
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_OVERLAY, Commands.COMMAND_PARTICLES, Commands.COMMAND_SOUNDS, Commands.COMMAND_VERSION });
}
case 2: {
if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_ON, Commands.COMMAND_OFF, Commands.COMMAND_POSITION, Commands.COMMAND_SCALE, Commands.COMMAND_OPACITY });
else if (args[0].equalsIgnoreCase(Commands.COMMAND_PARTICLES))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_ON, Commands.COMMAND_OFF });
else if (args[0].equalsIgnoreCase(Commands.COMMAND_SOUNDS))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_ALL, Commands.COMMAND_SELF, Commands.COMMAND_OFF });
else if (args[0].equalsIgnoreCase(Commands.COMMAND_VERSION))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_CHANGELOG });
}
case 3: {
if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY)) {
if (args[1].equalsIgnoreCase(Commands.COMMAND_POSITION))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_TOP, Commands.COMMAND_BOTTOM });
}
}
case 4: {
if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY)) {
if (args[1].equalsIgnoreCase(Commands.COMMAND_POSITION)) {
if (args[2].equalsIgnoreCase(Commands.COMMAND_TOP) || args[2].equalsIgnoreCase(Commands.COMMAND_BOTTOM))
return getListOfStringsMatchingLastWord(args, new String[] { Commands.COMMAND_LEFT, Commands.COMMAND_RIGHT });
}
}
}
default: {
return null;
}
}
}
@Override
public void processCommand(ICommandSender commandSender, String[] args) {
if (args.length > 0) {
String commandName = args[0];
System.arraycopy(args, 1, args, 0, args.length - 1);
if (commandName.equalsIgnoreCase(Commands.COMMAND_OVERLAY)) {
CommandOverlay.processCommand(commandSender, args);
}
else if (commandName.equalsIgnoreCase(Commands.COMMAND_PARTICLES)) {
CommandParticles.processCommand(commandSender, args);
}
else if (commandName.equalsIgnoreCase(Commands.COMMAND_SOUNDS)) {
CommandSounds.processCommand(commandSender, args);
}
else if (commandName.equalsIgnoreCase(Commands.COMMAND_VERSION)) {
CommandVersion.processCommand(commandSender, args);
}
else
throw new WrongUsageException(Commands.COMMAND_EE3_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_EE3_USAGE, new Object[0]);
}
@Override
public String getCommandUsage(ICommandSender icommandsender) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,20 +0,0 @@
package com.pahimar.ee3.command;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
/**
* Equivalent-Exchange-3
*
* CommandHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandHandler {
public static void initCommands(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandEE());
}
}

View file

@ -1,143 +0,0 @@
package com.pahimar.ee3.command;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.LocalizationUtil;
import com.pahimar.ee3.lib.Commands;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* CommandOverlay
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandOverlay {
public static void processCommand(ICommandSender commandSender, String[] args) {
if (args.length > 0) {
String subCommand = args[0];
if (subCommand.equalsIgnoreCase(Commands.COMMAND_ON)) {
processOnCommand(commandSender);
}
else if (subCommand.equalsIgnoreCase(Commands.COMMAND_OFF)) {
processOffCommand(commandSender);
}
else if (subCommand.equalsIgnoreCase(Commands.COMMAND_OPACITY)) {
processOpacityCommand(commandSender, args);
}
else if (subCommand.equalsIgnoreCase(Commands.COMMAND_SCALE)) {
processScaleCommand(commandSender, args);
}
else if (subCommand.equalsIgnoreCase(Commands.COMMAND_POSITION)) {
processPositionCommand(commandSender, args);
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_USAGE, new Object[0]);
}
private static void processOnCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = true;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.TRUE);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_TURNED_ON));
}
private static void processOffCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = false;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, Strings.FALSE);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_TURNED_OFF));
}
private static void processScaleCommand(ICommandSender commandSender, String[] args) {
if (args.length > 2 && args.length < 4) {
try {
float scale = Float.parseFloat(args[1]);
if (scale <= 0F)
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]);
else {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = scale;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, args[1]);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_SCALE_UPDATED));
}
}
catch (Exception e) {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]);
}
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT), new Object[0]);
}
private static void processOpacityCommand(ICommandSender commandSender, String[] args) {
if (args.length > 2 && args.length < 4) {
try {
float opacity = Float.parseFloat(args[1]);
if (opacity < 0F || opacity > 1F)
throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]);
else {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = opacity;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, args[1]);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_OPACITY_UPDATED));
}
}
catch (Exception e) {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]);
}
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE + " " + LocalizationUtil.getLocalizedString(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT), new Object[0]);
}
private static void processPositionCommand(ICommandSender commandSender, String[] args) {
String yPosition, xPosition;
if (args.length > 2 && args.length < 5) {
yPosition = args[1];
xPosition = args[2];
if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 0;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "0");
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_TOP_LEFT));
}
else if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 1;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "1");
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_TOP_RIGHT));
}
else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 2;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "2");
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_LEFT));
}
else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 3;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "3");
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_RIGHT));
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_POSITION_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_POSITION_USAGE, new Object[0]);
}
}

View file

@ -1,56 +0,0 @@
package com.pahimar.ee3.command;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.lib.Commands;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* CommandParticles
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandParticles {
public static void processCommand(ICommandSender commandSender, String[] args) {
String subCommand;
if (args.length > 0) {
subCommand = args[0];
if (subCommand.toLowerCase().equals(Commands.COMMAND_ON)) {
processOnCommand(commandSender);
}
else if (subCommand.toLowerCase().equals(Commands.COMMAND_OFF)) {
processOffCommand(commandSender);
}
else
throw new WrongUsageException(Commands.COMMAND_PARTICLES_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_PARTICLES_USAGE, new Object[0]);
}
private static void processOnCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_PARTICLE_FX = true;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.TRUE);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_PARTICLES_TURNED_ON));
}
private static void processOffCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_PARTICLE_FX = false;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, Strings.FALSE);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_PARTICLES_TURNED_OFF));
}
}

View file

@ -1,65 +0,0 @@
package com.pahimar.ee3.command;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.lib.Commands;
/**
* Equivalent-Exchange-3
*
* CommandSounds
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandSounds {
public static void processCommand(ICommandSender commandSender, String[] args) {
String subCommand;
if (args.length > 0) {
subCommand = args[0];
if (subCommand.toLowerCase().equals(Commands.COMMAND_ALL)) {
processAllCommand(commandSender);
}
else if (subCommand.toLowerCase().equals(Commands.COMMAND_SELF)) {
processSelfCommand(commandSender);
}
else if (subCommand.toLowerCase().equals(Commands.COMMAND_OFF)) {
processOffCommand(commandSender);
}
else
throw new WrongUsageException(Commands.COMMAND_SOUNDS_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_SOUNDS_USAGE, new Object[0]);
}
private static void processAllCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_SOUNDS = Commands.ALL;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.ALL);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_SET_TO_ALL));
}
private static void processSelfCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_SOUNDS = Commands.SELF;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.SELF);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_SET_TO_SELF));
}
private static void processOffCommand(ICommandSender commandSender) {
ConfigurationSettings.ENABLE_SOUNDS = Commands.OFF;
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.OFF);
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(Commands.COMMAND_SOUNDS_TURNED_OFF));
}
}

View file

@ -1,50 +0,0 @@
package com.pahimar.ee3.command;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import com.pahimar.ee3.core.util.VersionHelper;
import com.pahimar.ee3.lib.Commands;
/**
* Equivalent-Exchange-3
*
* CommandVersion
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommandVersion {
public static void processCommand(ICommandSender commandSender, String[] args) {
String subCommand;
if (args.length > 0) {
subCommand = args[0];
if (subCommand.toLowerCase().equals(Commands.COMMAND_VERSION)) {
processVersionCommand(commandSender);
}
else if (subCommand.toLowerCase().equals(Commands.COMMAND_CHANGELOG)) {
processChangelogCommand(commandSender);
}
else
throw new WrongUsageException(Commands.COMMAND_VERSION_USAGE, new Object[0]);
}
else
throw new WrongUsageException(Commands.COMMAND_VERSION_USAGE, new Object[0]);
}
private static void processVersionCommand(ICommandSender commandSender) {
commandSender.sendChatToPlayer(ChatMessageComponent.func_111077_e(VersionHelper.getResultMessage()));
}
private static void processChangelogCommand(ICommandSender commandSender) {
}
}

View file

@ -1,138 +0,0 @@
package com.pahimar.ee3.configuration;
import static net.minecraftforge.common.Configuration.CATEGORY_GENERAL;
import java.io.File;
import java.util.logging.Level;
import net.minecraftforge.common.Configuration;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.BlockIds;
import com.pahimar.ee3.lib.ItemIds;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.common.FMLLog;
/**
* Equivalent-Exchange-3
*
* ConfigurationHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ConfigurationHandler {
public static Configuration configuration;
public static final String CATEGORY_KEYBIND = "keybindings";
public static final String CATEGORY_GRAPHICS = "graphics";
public static final String CATEGORY_AUDIO = "audio";
public static final String CATEGORY_TRANSMUTATION = "transmutation";
public static final String CATEGORY_BLOCK_PROPERTIES = Configuration.CATEGORY_BLOCK + Configuration.CATEGORY_SPLITTER + "properties";
public static final String CATEGORY_RED_WATER_PROPERTIES = CATEGORY_BLOCK_PROPERTIES + Configuration.CATEGORY_SPLITTER + "red_water";
public static final String CATEGORY_DURABILITY = Configuration.CATEGORY_ITEM + Configuration.CATEGORY_SPLITTER + "durability";
public static void init(File configFile) {
configuration = new Configuration(configFile);
try {
configuration.load();
/* General configs */
ConfigurationSettings.DISPLAY_VERSION_RESULT = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT).getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
ConfigurationSettings.LAST_DISCOVERED_VERSION = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).getString();
ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_DEFAULT).getString();
/* Graphic configs */
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT);
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT).getInt(ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT);
try {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT).getString());
if (ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE <= 0F) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT;
}
}
catch (Exception e) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT;
}
try {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT).getString());
if (ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY < 0F || ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY > 1F) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT;
}
}
catch (Exception e) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT;
}
/* Audio configs */
ConfigurationSettings.ENABLE_SOUNDS = configuration.get(CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT).getString();
/* Block configs */
BlockIds.CALCINATOR = configuration.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT).getInt(BlockIds.CALCINATOR_DEFAULT);
BlockIds.ALUDEL_BASE = configuration.getBlock(Strings.ALUDEL_NAME, BlockIds.ALUDEL_BASE_DEFAULT).getInt(BlockIds.ALUDEL_BASE_DEFAULT);
BlockIds.ALCHEMICAL_CHEST = configuration.getBlock(Strings.ALCHEMICAL_CHEST_NAME, BlockIds.ALCHEMICAL_CHEST_DEFAULT).getInt(BlockIds.ALCHEMICAL_CHEST_DEFAULT);
BlockIds.GLASS_BELL = configuration.getBlock(Strings.GLASS_BELL_NAME, BlockIds.GLASS_BELL_DEFAULT).getInt(BlockIds.GLASS_BELL_DEFAULT);
BlockIds.RED_WATER_STILL = configuration.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT).getInt(BlockIds.RED_WATER_STILL_DEFAULT);
/* Block property configs */
configuration.addCustomCategoryComment(CATEGORY_BLOCK_PROPERTIES, "Custom block properties");
/* Red Water configs */
configuration.addCustomCategoryComment(CATEGORY_RED_WATER_PROPERTIES, "Configuration settings for various properties of Red Water");
ConfigurationSettings.RED_WATER_DURATION_BASE = configuration.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT).getInt(ConfigurationSettings.RED_WATER_DURATION_BASE_DEFAULT);
ConfigurationSettings.RED_WATER_DURATION_MODIFIER = configuration.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT).getInt(ConfigurationSettings.RED_WATER_DURATION_MODIFIER_DEFAULT);
ConfigurationSettings.RED_WATER_RANGE_BASE = configuration.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_BASE_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT).getInt(ConfigurationSettings.RED_WATER_RANGE_BASE_DEFAULT);
ConfigurationSettings.RED_WATER_RANGE_MODIFIER = configuration.get(CATEGORY_RED_WATER_PROPERTIES, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_CONFIGNAME, ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT).getInt(ConfigurationSettings.RED_WATER_RANGE_MODIFIER_DEFAULT);
/* Item configs */
ItemIds.MINIUM_SHARD = configuration.getItem(Strings.MINIUM_SHARD_NAME, ItemIds.MINIUM_SHARD_DEFAULT).getInt(ItemIds.MINIUM_SHARD_DEFAULT);
ItemIds.INERT_STONE = configuration.getItem(Strings.INERT_STONE_NAME, ItemIds.INERT_STONE_DEFAULT).getInt(ItemIds.INERT_STONE_DEFAULT);
ItemIds.MINIUM_STONE = configuration.getItem(Strings.MINIUM_STONE_NAME, ItemIds.MINIUM_STONE_DEFAULT).getInt(ItemIds.MINIUM_STONE_DEFAULT);
ItemIds.PHILOSOPHERS_STONE = configuration.getItem(Strings.PHILOSOPHERS_STONE_NAME, ItemIds.PHILOSOPHERS_STONE_DEFAULT).getInt(ItemIds.PHILOSOPHERS_STONE_DEFAULT);
ItemIds.ALCHEMICAL_DUST = configuration.getItem(Strings.ALCHEMICAL_DUST_NAME, ItemIds.ALCHEMICAL_DUST_DEFAULT).getInt(ItemIds.ALCHEMICAL_DUST_DEFAULT);
ItemIds.ALCHEMICAL_BAG = configuration.getItem(Strings.ALCHEMICAL_BAG_NAME, ItemIds.ALCHEMICAL_BAG_DEFAULT).getInt(ItemIds.ALCHEMICAL_BAG_DEFAULT);
/* Item durability configs */
ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = configuration.get(CATEGORY_DURABILITY, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT).getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT);
ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY = configuration.get(CATEGORY_DURABILITY, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT).getInt(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT);
/* KeyBinding configs */
configuration.addCustomCategoryComment(CATEGORY_KEYBIND, "Keybindings for Equivalent Exchange 3. See http://www.minecraftwiki.net/wiki/Key_codes for mapping of key codes to keyboard keys");
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_EXTRA, configuration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_EXTRA, ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_CHARGE, configuration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_CHARGE, ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_TOGGLE, configuration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_TOGGLE, ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT));
EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_RELEASE, configuration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_RELEASE, ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT));
/* Transmutation configs */
ConfigurationSettings.TRANSMUTE_COST_ITEM = configuration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_ITEM_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT);
ConfigurationSettings.TRANSMUTE_COST_BLOCK = configuration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_BLOCK_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT);
ConfigurationSettings.TRANSMUTE_COST_MOB = configuration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_MOB_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT);
}
catch (Exception e) {
FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration");
}
finally {
configuration.save();
}
}
public static void set(String categoryName, String propertyName, String newValue) {
configuration.load();
if (configuration.getCategoryNames().contains(categoryName)) {
if (configuration.getCategory(categoryName).containsKey(propertyName)) {
configuration.getCategory(categoryName).get(propertyName).set(newValue);
}
}
configuration.save();
}
}

View file

@ -1,132 +0,0 @@
package com.pahimar.ee3.configuration;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* ConfigurationSettings
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ConfigurationSettings {
/*
* Version check related settings
*/
public static boolean DISPLAY_VERSION_RESULT;
public static final String DISPLAY_VERSION_RESULT_CONFIGNAME = "version_check.display_results";
public static final boolean DISPLAY_VERSION_RESULT_DEFAULT = true;
public static String LAST_DISCOVERED_VERSION;
public static final String LAST_DISCOVERED_VERSION_CONFIGNAME = "version_check.last_discovered_version";
public static final String LAST_DISCOVERED_VERSION_DEFAULT = "";
public static String LAST_DISCOVERED_VERSION_TYPE;
public static final String LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME = "version_check.last_discovered_version_type";
public static final String LAST_DISCOVERED_VERSION_TYPE_DEFAULT = "";
/*
* Audio config settings
*/
public static String ENABLE_SOUNDS;
public static final String ENABLE_SOUNDS_CONFIGNAME = "sounds.enabled";
public static final String ENABLE_SOUNDS_DEFAULT = "all";
/*
* Graphic config settings
*/
// Whether or not EE3 particle fx are enabled
public static boolean ENABLE_PARTICLE_FX;
public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "particle_fx.enabled";
public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true;
// Whether or not the in world transmutation overlays are enabled
public static boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION;
public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "world_transmutation_overlay.enabled";
public static final boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT = true;
public static int TARGET_BLOCK_OVERLAY_POSITION;
public static final String TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME = "block_overlay_position";
public static final int TARGET_BLOCK_OVERLAY_POSITION_DEFAULT = 3;
public static float TARGET_BLOCK_OVERLAY_OPACITY;
public static final String TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME = "block_overlay_opacity";
public static final float TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT = 0.75F;
public static float TARGET_BLOCK_OVERLAY_SCALE;
public static final String TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME = "block_overlay_scale";
public static final float TARGET_BLOCK_OVERLAY_SCALE_DEFAULT = 2.5F;
/*
* Block related config settings
*/
public static int RED_WATER_DURATION_BASE;
public static String RED_WATER_DURATION_BASE_CONFIGNAME = "duration.base";
public static final int RED_WATER_DURATION_BASE_DEFAULT = 5;
public static int RED_WATER_DURATION_MODIFIER;
public static String RED_WATER_DURATION_MODIFIER_CONFIGNAME = "duration.modifier";
public static final int RED_WATER_DURATION_MODIFIER_DEFAULT = 2;
public static int RED_WATER_RANGE_BASE;
public static String RED_WATER_RANGE_BASE_CONFIGNAME = "range.base";
public static final int RED_WATER_RANGE_BASE_DEFAULT = 1;
public static int RED_WATER_RANGE_MODIFIER;
public static String RED_WATER_RANGE_MODIFIER_CONFIGNAME = "range.modifier";
public static final int RED_WATER_RANGE_MODIFIER_DEFAULT = 3;
/*
* Item related config settings
*/
// The maximum durability for the Minium Stone
public static int MINIUM_STONE_MAX_DURABILITY;
public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME;
public static final int MINIUM_STONE_MAX_DURABILITY_DEFAULT = 1521;
// The maximum durability for the Philosophers Stone
public static int PHILOSOPHERS_STONE_MAX_DURABILITY;
public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHERS_STONE_NAME;
public static final int PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT = 10001;
/*
* Keybinding related config settings
*/
// Extra key
public static final String KEYBINDING_EXTRA = "key.extra";
public static final int KEYBINDING_EXTRA_DEFAULT = 46;
// Release key
public static final String KEYBINDING_RELEASE = "key.release";
public static final int KEYBINDING_RELEASE_DEFAULT = 19;
// Toggle key
public static final String KEYBINDING_TOGGLE = "key.toggle";
public static final int KEYBINDING_TOGGLE_DEFAULT = 34;
// Charge key
public static final String KEYBINDING_CHARGE = "key.charge";
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
/*
* Transmutation related config settings
*/
// The durability cost for each item transmutation
public static int TRANSMUTE_COST_ITEM;
public static final String TRANSMUTE_COST_ITEM_CONFIGNAME = Strings.TRANSMUTATION_COST_ITEM;
public static final int TRANSMUTE_COST_ITEM_DEFAULT = 1;
// The durability cost for each block transmutation
public static int TRANSMUTE_COST_BLOCK;
public static final String TRANSMUTE_COST_BLOCK_CONFIGNAME = Strings.TRANSMUTATION_COST_BLOCK;
public static final int TRANSMUTE_COST_BLOCK_DEFAULT = 1;
// The durability cost for each block transmutation
public static int TRANSMUTE_COST_MOB;
public static final String TRANSMUTE_COST_MOB_CONFIGNAME = Strings.TRANSMUTATION_COST_MOB;
public static final int TRANSMUTE_COST_MOB_DEFAULT = 1;
}

View file

@ -1,23 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraftforge.event.ForgeSubscribe;
import com.pahimar.ee3.event.ActionRequestEvent;
/**
* Equivalent-Exchange-3
*
* ActionRequestHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ActionRequestHandler {
@ForgeSubscribe
public void onModActionEvent(ActionRequestEvent event) {
}
}

View file

@ -1,18 +0,0 @@
package com.pahimar.ee3.core.handlers;
/**
* Equivalent-Exchange-3
*
* AddonHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class AddonHandler {
public static void init() {
}
}

View file

@ -1,75 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.common.ICraftingHandler;
/**
* Equivalent-Exchange-3
*
* CraftingHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CraftingHandler implements ICraftingHandler {
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
if (player.worldObj.isRemote) {
doPortableCrafting(player, craftMatrix);
}
}
@Override
public void onSmelting(EntityPlayer player, ItemStack item) {
}
/***
* Check to see if the crafting is occurring from the portable crafting
* interface. If so, do durability damage to the appropriate transmutation
* stone that was used for portable crafting.
*
* @param player
* The player that is completing the crafting
* @param craftMatrix
* The contents of the crafting matrix
*/
private void doPortableCrafting(EntityPlayer player, IInventory craftMatrix) {
ItemStack openStone = null;
for (ItemStack itemStack : player.inventory.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
openStone = itemStack;
}
}
}
ItemStack itemStack = null;
if (openStone != null) {
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
itemStack = craftMatrix.getStackInSlot(i);
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
openStone = itemStack;
}
}
}
}
if (openStone != null) {
openStone.damageItem(ConfigurationSettings.TRANSMUTE_COST_ITEM, player);
}
}
}

View file

@ -1,199 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.event.ForgeSubscribe;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.TransmutationHelper;
import com.pahimar.ee3.item.IChargeable;
import com.pahimar.ee3.item.ITransmutationStone;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* DrawBlockHighlightHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class DrawBlockHighlightHandler {
private static int pulse = 0;
private static boolean doInc = true;
@ForgeSubscribe
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
Minecraft minecraft = FMLClientHandler.instance().getClient();
if (event.currentItem != null) {
if (event.currentItem.getItem() instanceof ITransmutationStone) {
if (event.target.typeOfHit == EnumMovingObjectType.TILE) {
TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ);
if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) {
if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) {
drawInWorldTransmutationOverlay(event);
}
}
}
}
}
}
public void drawInWorldTransmutationOverlay(DrawBlockHighlightEvent event) {
double x = event.target.blockX + 0.5F;
double y = event.target.blockY + 0.5F;
double z = event.target.blockZ + 0.5F;
double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
float xScale = 1;
float yScale = 1;
float zScale = 1;
float xShift = 0.1F;
float yShift = 0.1F;
float zShift = 0.1F;
int chargeLevel;
int itemChargeLevel = 0;
if (event.currentItem.getItem() instanceof IChargeable) {
itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem);
}
chargeLevel = 1 + itemChargeLevel * 2;
ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);
switch (sideHit) {
case UP: {
xScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = 0;
zShift = 0;
break;
}
case DOWN: {
xScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = 0;
yShift = -yShift;
zShift = 0;
break;
}
case NORTH: {
xScale = chargeLevel + 0.1F;
yScale = chargeLevel + 0.1F;
xShift = 0;
yShift = 0;
zShift = -zShift;
break;
}
case SOUTH: {
xScale = chargeLevel + 0.1F;
yScale = chargeLevel + 0.1F;
xShift = 0;
yShift = 0;
break;
}
case EAST: {
yScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
yShift = 0;
zShift = 0;
break;
}
case WEST: {
yScale = chargeLevel + 0.1F;
zScale = chargeLevel + 0.1F;
xShift = -xShift;
yShift = 0;
zShift = 0;
break;
}
default:
break;
}
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
for (int i = 0; i < 6; i++) {
ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
int zCorrection = i == 2 ? -1 : 1;
GL11.glPushMatrix();
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
GL11.glTranslated(0, 0, 0.5f * zCorrection);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
renderPulsingQuad(Textures.EFFECT_WORLD_TRANSMUTATION, 0.75F);
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
}
public static void renderPulsingQuad(ResourceLocation texture, float maxTransparency) {
float pulseTransparency = getPulseValue() * maxTransparency / 3000f;
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(texture);
Tessellator tessellator = Tessellator.instance;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1, 1, 1, pulseTransparency);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(1, 1, 1, pulseTransparency);
tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1);
tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1);
tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, 0);
tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 0, 0);
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
private static int getPulseValue() {
if (doInc) {
pulse += 8;
}
else {
pulse -= 8;
}
if (pulse == 3000) {
doInc = false;
}
if (pulse == 0) {
doInc = true;
}
return pulse;
}
}

View file

@ -1,42 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import com.pahimar.ee3.core.util.ItemUtil;
/**
* Equivalent-Exchange-3
*
* EntityLivingHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EntityLivingHandler {
@ForgeSubscribe
public void onEntityLivingUpdate(LivingUpdateEvent event) {
}
@ForgeSubscribe
public void onEntityLivingDeath(LivingDeathEvent event) {
if (event.source.getDamageType().equals("player")) {
ItemUtil.dropMiniumShard((EntityPlayer) event.source.getSourceOfDamage(), event.entityLiving);
}
if (event.source.getSourceOfDamage() instanceof EntityArrow) {
if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity != null) {
if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity instanceof EntityPlayer) {
ItemUtil.dropMiniumShard((EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity, event.entityLiving);
}
}
}
}
}

View file

@ -1,254 +0,0 @@
package com.pahimar.ee3.core.handlers;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.core.util.GeneralHelper;
import com.pahimar.ee3.core.util.LogHelper;
/**
* Equivalent-Exchange-3
*
* EquivalencyHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EquivalencyHandler {
private static final EquivalencyHandler instance = new EquivalencyHandler();
private static ArrayList<ArrayList<ItemStack>> equivalencyList = new ArrayList<ArrayList<ItemStack>>();
public static EquivalencyHandler instance() {
return instance;
}
public ArrayList<ArrayList<ItemStack>> getAllLists() {
return equivalencyList;
}
public void addObjects(Object obj1, Object obj2) {
ItemStack stack1 = GeneralHelper.convertObjectToItemStack(obj1);
ItemStack stack2 = GeneralHelper.convertObjectToItemStack(obj2);
ArrayList<ItemStack> currentList = new ArrayList<ItemStack>();
Integer stack1Index = getIndexInList(stack1);
Integer stack2Index = getIndexInList(stack2);
if (stack1Index != null && stack2Index != null)
return;
else if (stack1Index != null && stack2Index == null) {
currentList = equivalencyList.get(stack1Index.intValue());
currentList.add(stack2);
equivalencyList.set(stack1Index.intValue(), currentList);
}
else if (stack1Index == null && stack2Index != null) {
currentList = equivalencyList.get(stack2Index.intValue());
currentList.add(stack1);
equivalencyList.set(stack2Index.intValue(), currentList);
}
else if (stack1Index == null && stack2Index == null) {
currentList.add(stack1);
currentList.add(stack2);
equivalencyList.add(currentList);
}
}
public void addObjects(Object... objList) {
if (objList.length < 2)
return;
for (int i = 0; i < objList.length - 1; i++) {
addObjects(objList[i], objList[i + 1]);
}
}
public Integer getIndexInList(Object obj) {
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
ArrayList<ItemStack> currentList;
int i = 0;
while (i < equivalencyList.size()) {
currentList = equivalencyList.get(i);
for (ItemStack currentStack : currentList) {
if (ItemStack.areItemStacksEqual(checkStack, currentStack))
return new Integer(i);
}
++i;
}
return null;
}
public Integer getIndexInList(int id, int meta) {
ArrayList<ItemStack> currentList;
int i = 0;
while (i < equivalencyList.size()) {
currentList = equivalencyList.get(i);
for (ItemStack currentStack : currentList) {
if (id == currentStack.itemID && meta == currentStack.getItemDamage())
return new Integer(i);
}
++i;
}
return null;
}
public ArrayList<ItemStack> getEquivalencyList(Object obj) {
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
if (checkStack == null)
return null;
for (ArrayList<ItemStack> list : equivalencyList) {
for (ItemStack currentStack : list) {
if (ItemStack.areItemStacksEqual(checkStack, currentStack))
return list;
}
}
return null;
}
public ArrayList<ItemStack> getEquivalencyList(int id, int meta) {
for (ArrayList<ItemStack> list : equivalencyList) {
for (ItemStack currentStack : list) {
if (id == currentStack.itemID && meta == currentStack.getItemDamage())
return list;
}
}
return null;
}
public ItemStack getNextInList(Object obj) {
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
if (checkStack != null)
return getNextInList(checkStack.itemID, checkStack.getItemDamage());
return null;
}
public ItemStack getNextInList(int id, int meta) {
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
ItemStack currentStack;
ItemStack returnStack = null;
int i = 0;
if (list != null) {
if (list.size() == 1)
return list.get(i);
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 ItemStack getPrevInList(Object obj) {
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
if (checkStack != null)
return getPrevInList(checkStack.itemID, checkStack.getItemDamage());
return null;
}
public ItemStack getPrevInList(int id, int meta) {
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
ItemStack currentStack;
ItemStack returnStack = null;
int i = 0;
if (list != null) {
if (list.size() == 1)
return list.get(i);
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);
break;
}
++i;
}
}
return returnStack;
}
public boolean areEquivalent(Object obj1, Object obj2) {
if (getEquivalencyList(obj1) != null && getEquivalencyList(obj2) != null) {
// TODO This could be cleaner
if (GeneralHelper.convertObjectToItemStack(obj1).itemID == GeneralHelper.convertObjectToItemStack(obj2).itemID && GeneralHelper.convertObjectToItemStack(obj1).getItemDamage() == GeneralHelper.convertObjectToItemStack(obj2).getItemDamage())
return true;
else
return getEquivalencyList(obj1).equals(getEquivalencyList(obj2));
}
else
return false;
}
/* Ignores stack size for world transmutation */
public boolean areWorldEquivalent(Object obj1, Object obj2) {
ItemStack first = GeneralHelper.convertObjectToItemStack(obj1);
if (first == null)
return false;
ItemStack second = GeneralHelper.convertObjectToItemStack(obj2);
if (second == null)
return false;
if (getEquivalencyList(first.itemID, first.getItemDamage()) != null && getEquivalencyList(second.itemID, second.getItemDamage()) != null) {
if (first.itemID == second.itemID && first.getItemDamage() == second.getItemDamage())
return true;
else
return getEquivalencyList(first.itemID, first.getItemDamage()).equals(getEquivalencyList(second.itemID, second.getItemDamage()));
}
else
return false;
}
public void debug() {
int i = 0;
for (ArrayList<ItemStack> list : equivalencyList) {
LogHelper.info("equivalencyList[" + i + "]: " + list.toString());
++i;
}
}
}

View file

@ -1,24 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler;
/**
* Equivalent-Exchange-3
*
* FuelHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class FuelHandler implements IFuelHandler {
@Override
public int getBurnTime(ItemStack fuel) {
// TODO Add in fuel values for EE3 fuel related items
return 0;
}
}

View file

@ -1,98 +0,0 @@
package com.pahimar.ee3.core.handlers;
import java.util.List;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import com.pahimar.ee3.core.util.LogHelper;
import com.pahimar.ee3.emc.EmcBlackList;
import com.pahimar.ee3.item.CustomWrappedStack;
import com.pahimar.ee3.item.crafting.RecipeRegistry;
import com.pahimar.ee3.lib.InterModComms;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
public class InterModCommsHandler {
public static void processIMCMessages(IMCEvent event) {
for (IMCMessage imcMessage : event.getMessages()) {
if (imcMessage.getMessageType() == NBTTagCompound.class) {
if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_RECIPE)) {
processAddRecipeMessage(imcMessage);
}
else if (imcMessage.key.equalsIgnoreCase(InterModComms.ADD_BLACKLIST_ENTRY)) {
processAddBlackListMessage(imcMessage);
}
else if (imcMessage.key.equalsIgnoreCase(InterModComms.REMOVE_BLACKLIST_ENTRY)) {
processRemoveBlackListMessage(imcMessage);
}
else if (imcMessage.key.equalsIgnoreCase(InterModComms.SET_EMC_VALUE)) {
processSetEmcValueMessage(imcMessage);
}
}
else {
LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' sent a message with key '" + imcMessage.key + "' with an invalid argument type (received " + imcMessage.getMessageType().getSimpleName() + ", expected NBTTagCompound)");
}
}
}
private static void processAddRecipeMessage(IMCMessage imcMessage) {
NBTTagCompound encodedRecipe = imcMessage.getNBTValue();
Map<CustomWrappedStack, List<CustomWrappedStack>> decodedRecipe = NBTHelper.decodeRecipeFromNBT(encodedRecipe);
if (!decodedRecipe.isEmpty()) {
for (CustomWrappedStack key : decodedRecipe.keySet()) {
RecipeRegistry.getInstance().addRecipe(key, decodedRecipe.get(key));
LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added recipe with output '" + key.toString() + "' and inputs '" + decodedRecipe.get(key) + "'");
}
}
else {
LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempting to add a NBT encoded recipe to the recipe registry, but the encoded recipe is invalid");
}
}
private static void processAddBlackListMessage(IMCMessage imcMessage) {
NBTTagCompound encodedStack = imcMessage.getNBTValue();
CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack);
if (decodedStack != null) {
if (EmcBlackList.getInstance().add(decodedStack)) {
LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' added object '" + decodedStack.toString() + "' to the EMC blacklist");
}
else {
LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to add an object to the EMC blacklist that already existed");
}
}
}
private static void processRemoveBlackListMessage(IMCMessage imcMessage) {
NBTTagCompound encodedStack = imcMessage.getNBTValue();
CustomWrappedStack decodedStack = NBTHelper.decodeStackFromNBT(encodedStack);
if (decodedStack != null) {
if (EmcBlackList.getInstance().remove(decodedStack)) {
LogHelper.info("[IMC] Mod '" + imcMessage.getSender() + "' removed object '" + decodedStack.toString() + "' from the EMC blacklist");
}
else {
LogHelper.severe("[IMC] Mod '" + imcMessage.getSender() + "' attempted to remove an object to the EMC blacklist that was not present");
}
}
}
private static void processSetEmcValueMessage(IMCMessage imcMessage) {
// TODO Set an EMC Value via IMC
}
}

View file

@ -1,66 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.entity.item.EntityItem;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
/**
* Equivalent-Exchange-3
*
* ItemEventHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemEventHandler {
@ForgeSubscribe
public void onItemPickup(EntityItemPickupEvent event) {
if (NBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
NBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
NBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
@ForgeSubscribe
public void onItemToss(ItemTossEvent event) {
if (NBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
NBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
NBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
@ForgeSubscribe
public void onPlayerDrop(PlayerDropsEvent event) {
for (EntityItem entityItem : event.drops) {
if (NBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
NBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
}
else if (NBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
NBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
}
}

View file

@ -1,78 +0,0 @@
package com.pahimar.ee3.core.handlers;
import java.util.EnumSet;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.core.util.KeyBindingUtil;
import com.pahimar.ee3.item.IKeyBound;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.network.PacketTypeHandler;
import com.pahimar.ee3.network.packet.PacketKeyPressed;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
/**
* Equivalent-Exchange-3
*
* KeyBindingHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler {
public KeyBindingHandler() {
super(KeyBindingUtil.gatherKeyBindings(), KeyBindingUtil.gatherIsRepeating());
}
@Override
public String getLabel() {
return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
}
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
// Only operate at the end of the tick
if (tickEnd) {
// If we are not in a GUI of any kind, continue execution
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
if (player != null) {
ItemStack currentItem = FMLClientHandler.instance().getClient().thePlayer.getCurrentEquippedItem();
if (currentItem != null) {
if (currentItem.getItem() instanceof IKeyBound) {
if (!KeyBindingUtil.isClientSided(kb.keyDescription)) {
PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketKeyPressed(kb.keyDescription)));
}
else {
((IKeyBound) currentItem.getItem()).doKeyBindingAction(player, currentItem, kb.keyDescription);
}
}
}
}
}
}
}
@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT);
}
}

View file

@ -1,30 +0,0 @@
package com.pahimar.ee3.core.handlers;
import com.pahimar.ee3.core.util.LocalizationUtil;
import com.pahimar.ee3.lib.Localizations;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Equivalent-Exchange-3
*
* LocalizationHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class LocalizationHandler {
/***
* Loads in all the localization files from the Localizations library class
*/
public static void loadLanguages() {
// For every file specified in the Localization library class, load them into the Language Registry
for (String localizationFile : Localizations.localeFiles) {
LanguageRegistry.instance().loadLocalization(localizationFile, LocalizationUtil.getLocaleFromFileName(localizationFile), LocalizationUtil.isXMLLanguageFile(localizationFile));
}
}
}

View file

@ -1,24 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
/**
* Equivalent-Exchange-3
*
* PlayerDestroyItemHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class PlayerDestroyItemHandler {
@ForgeSubscribe
public void onPlayerDestroyItemEvent(PlayerDestroyItemEvent event) {
// TODO Come back and actually do what I want here
}
}

View file

@ -1,149 +0,0 @@
package com.pahimar.ee3.core.handlers;
import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.pahimar.ee3.client.renderer.RenderUtils;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.TransmutationHelper;
import com.pahimar.ee3.item.ITransmutationStone;
import com.pahimar.ee3.lib.Reference;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TransmutationTargetOverlayHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TransmutationTargetOverlayHandler implements ITickHandler {
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
Minecraft minecraft = FMLClientHandler.instance().getClient();
EntityPlayer player = minecraft.thePlayer;
ItemStack currentItemStack = null;
if (type.contains(TickType.RENDER)) {
if (player != null) {
currentItemStack = player.inventory.getCurrentItem();
if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) {
if (currentItemStack != null && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) {
renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]);
}
}
}
}
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
}
@Override
public String getLabel() {
return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
}
private static void renderStoneHUD(Minecraft minecraft, EntityPlayer player, ItemStack stack, float partialTicks) {
float overlayScale = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE;
float blockScale = overlayScale / 2;
float overlayOpacity = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY;
GL11.glPushMatrix();
ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
GL11.glClear(256);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
GL11.glPushMatrix();
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glEnable(GL11.GL_LIGHTING);
int hudOverlayX = 0;
int hudOverlayY = 0;
int hudBlockX = 0;
int hudBlockY = 0;
switch (ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION) {
case 0: {
hudOverlayX = 0;
hudBlockX = (int) (16 * overlayScale / 2 - 8);
hudOverlayY = 0;
hudBlockY = (int) (16 * overlayScale / 2 - 8);
break;
}
case 1: {
hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale);
hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8);
hudOverlayY = 0;
hudBlockY = (int) (16 * overlayScale / 2 - 8);
break;
}
case 2: {
hudOverlayX = 0;
hudBlockX = (int) (16 * overlayScale / 2 - 8);
hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale);
hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8);
break;
}
case 3: {
hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale);
hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8);
hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale);
hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8);
break;
}
default: {
break;
}
}
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale);
if (TransmutationHelper.targetBlockStack != null && TransmutationHelper.targetBlockStack.getItem() instanceof ItemBlock) {
RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, TransmutationHelper.targetBlockStack, hudBlockX, hudBlockY, -90, blockScale);
}
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}

View file

@ -1,71 +0,0 @@
package com.pahimar.ee3.core.handlers;
import java.util.EnumSet;
import net.minecraftforge.common.Configuration;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.VersionHelper;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
/**
* Equivalent-Exchange-3
*
* VersionCheckTickHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class VersionCheckTickHandler implements ITickHandler {
private static boolean initialized = false;
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
if (ConfigurationSettings.DISPLAY_VERSION_RESULT) {
if (!initialized) {
for (TickType tickType : type) {
if (tickType == TickType.CLIENT) {
if (FMLClientHandler.instance().getClient().currentScreen == null) {
if (VersionHelper.getResult() != VersionHelper.UNINITIALIZED || VersionHelper.getResult() != VersionHelper.FINAL_ERROR) {
initialized = true;
if (VersionHelper.getResult() == VersionHelper.OUTDATED) {
FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(VersionHelper.getResultMessageForClient());
ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, Strings.FALSE);
}
}
}
}
}
}
}
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT);
}
@Override
public String getLabel() {
return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
}
}

View file

@ -1,181 +0,0 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.TransmutationHelper;
import com.pahimar.ee3.event.ActionEvent;
import com.pahimar.ee3.event.ActionEvent.ActionResult;
import com.pahimar.ee3.event.ActionRequestEvent;
import com.pahimar.ee3.event.WorldTransmutationEvent;
import com.pahimar.ee3.lib.ActionTypes;
import com.pahimar.ee3.lib.ItemUpdateTypes;
import com.pahimar.ee3.lib.Particles;
import com.pahimar.ee3.lib.Sounds;
import com.pahimar.ee3.network.PacketTypeHandler;
import com.pahimar.ee3.network.packet.PacketItemUpdate;
import com.pahimar.ee3.network.packet.PacketSoundEvent;
import com.pahimar.ee3.network.packet.PacketSpawnParticle;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
/**
* Equivalent-Exchange-3
*
* WorldTransmutationHandler
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class WorldTransmutationHandler {
public static void handleWorldTransmutation(EntityPlayer thePlayer, int originX, int originY, int originZ, byte rangeX, byte rangeY, byte rangeZ, byte sideHit, String data) {
ActionRequestEvent actionRequestEvent = null;
ActionEvent actionEvent = null;
int lowerBoundX = -1 * rangeX / 2;
int upperBoundX = -1 * lowerBoundX;
int lowerBoundY = -1 * rangeY / 2;
int upperBoundY = -1 * lowerBoundY;
int lowerBoundZ = -1 * rangeZ / 2;
int upperBoundZ = -1 * lowerBoundZ;
boolean anySuccess = false;
double xShift = 0;
double yShift = 0;
double zShift = 0;
int xSign = 1;
int ySign = 1;
int zSign = 1;
switch (ForgeDirection.getOrientation(sideHit)) {
case UP: {
yShift = 1.5D;
break;
}
case DOWN: {
yShift = 0.1D;
ySign = -1;
break;
}
case NORTH: {
zShift = 1D;
zSign = -1;
break;
}
case SOUTH: {
zShift = 1D;
break;
}
case EAST: {
xShift = 1D;
break;
}
case WEST: {
xShift = 1D;
xSign = -1;
break;
}
case UNKNOWN: {
break;
}
default:
break;
}
for (int x = lowerBoundX; x <= upperBoundX; x++) {
for (int y = lowerBoundY; y <= upperBoundY; y++) {
for (int z = lowerBoundZ; z <= upperBoundZ; z++) {
actionEvent = new WorldTransmutationEvent(ActionTypes.TRANSMUTATION, thePlayer.getCurrentEquippedItem(), thePlayer, thePlayer.worldObj, originX + x, originY + y, originZ + z, false, data);
if (actionEvent != null) {
actionRequestEvent = new ActionRequestEvent(thePlayer, actionEvent, originX + x, originY + y, originZ + z, sideHit);
MinecraftForge.EVENT_BUS.post(actionRequestEvent);
if (actionRequestEvent.allowEvent != Result.DENY) {
MinecraftForge.EVENT_BUS.post(actionEvent);
}
if (actionEvent.actionResult == ActionResult.SUCCESS) {
if (!anySuccess) {
anySuccess = true;
}
PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.LARGE_SMOKE, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign)));
PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.LARGE_EXPLODE, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.15D * ySign, 0D * zSign)));
}
else if (actionEvent.actionResult == ActionResult.FAILURE) {
if (!(actionEvent.world.getBlockId(originX + x, originY + y, originZ + z) == 0)) {
// TODO Fancy particle motion
PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.RED_DUST, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign)));
PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.WITCH_MAGIC, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign)));
}
}
}
}
}
}
if (anySuccess) {
PacketDispatcher.sendPacketToAllAround(originX, originY, originZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.TRANSMUTE, originX, originY, originZ, 0.5F, 1.0F)));
}
else {
PacketDispatcher.sendPacketToAllAround(originX, originY, originZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.FAIL, originX, originY, originZ, 1.5F, 1.5F)));
}
}
@ForgeSubscribe
public void onWorldTransmutationEvent(WorldTransmutationEvent event) {
int id = event.world.getBlockId(event.x, event.y, event.z);
int meta = event.world.getBlockMetadata(event.x, event.y, event.z);
boolean result = false;
Block currentBlock = Block.blocksList[id];
if (currentBlock != null) {
meta = currentBlock.damageDropped(meta);
}
ItemStack worldStack = new ItemStack(id, 1, meta);
ItemStack targetStack = new ItemStack(event.targetID, 1, event.targetMeta);
if (!worldStack.isItemEqual(targetStack)) {
if (EquivalencyHandler.instance().areWorldEquivalent(worldStack, targetStack)) {
if (event.itemStack != null) {
if (event.itemStack.getItemDamage() <= event.itemStack.getMaxDamage()) {
result = TransmutationHelper.transmuteInWorld(event.world, event.player, event.player.getCurrentEquippedItem(), event.x, event.y, event.z, event.targetID, event.targetMeta);
}
}
}
}
if (result) {
event.actionResult = ActionResult.SUCCESS;
int currentSlot = event.player.inventory.currentItem;
event.itemStack.damageItem(ConfigurationSettings.TRANSMUTE_COST_BLOCK, event.player);
if (event.itemStack.stackSize < 1) {
event.player.inventory.setInventorySlotContents(currentSlot, null);
PacketDispatcher.sendPacketToPlayer(PacketTypeHandler.populatePacket(new PacketItemUpdate((byte) currentSlot, ItemUpdateTypes.DESTROYED)), (Player) event.player);
event.player.worldObj.playSoundAtEntity(event.player, "random.break", 0.8F, 0.8F + event.player.worldObj.rand.nextFloat() * 0.4F);
}
}
else {
event.actionResult = ActionResult.FAILURE;
}
}
}

View file

@ -1,224 +0,0 @@
package com.pahimar.ee3.core.proxy;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.client.audio.SoundHandler;
import com.pahimar.ee3.client.renderer.item.ItemAlchemicalChestRenderer;
import com.pahimar.ee3.client.renderer.item.ItemAludelRenderer;
import com.pahimar.ee3.client.renderer.item.ItemCalcinatorRenderer;
import com.pahimar.ee3.client.renderer.item.ItemGlassBellRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityAlchemicalChestRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityAludelRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityCalcinatorRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer;
import com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler;
import com.pahimar.ee3.core.handlers.KeyBindingHandler;
import com.pahimar.ee3.core.handlers.TransmutationTargetOverlayHandler;
import com.pahimar.ee3.core.util.ItemUtil;
import com.pahimar.ee3.core.util.KeyBindingUtil;
import com.pahimar.ee3.core.util.TransmutationHelper;
import com.pahimar.ee3.item.IChargeable;
import com.pahimar.ee3.lib.ActionTypes;
import com.pahimar.ee3.lib.BlockIds;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.network.PacketTypeHandler;
import com.pahimar.ee3.network.packet.PacketRequestEvent;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileCalcinator;
import com.pahimar.ee3.tileentity.TileEE;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* Equivalent-Exchange-3
*
* ClientProxy
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ClientProxy extends CommonProxy {
@Override
public void registerKeyBindingHandler() {
KeyBindingRegistry.registerKeyBinding(new KeyBindingHandler());
}
@Override
public void registerRenderTickHandler() {
TickRegistry.registerTickHandler(new TransmutationTargetOverlayHandler(), Side.CLIENT);
}
@Override
public void registerDrawBlockHighlightHandler() {
MinecraftForge.EVENT_BUS.register(new DrawBlockHighlightHandler());
}
@Override
public void setKeyBinding(String name, int value) {
KeyBindingUtil.addKeyBinding(name, value);
KeyBindingUtil.addIsRepeating(false);
}
@Override
public void registerSoundHandler() {
MinecraftForge.EVENT_BUS.register(new SoundHandler());
}
@Override
public void initRenderingAndTextures() {
RenderIds.calcinatorRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.aludelRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.alchemicalChestRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.glassBellId = RenderingRegistry.getNextAvailableRenderId();
MinecraftForgeClient.registerItemRenderer(BlockIds.CALCINATOR, new ItemCalcinatorRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.ALUDEL_BASE, new ItemAludelRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.ALCHEMICAL_CHEST, new ItemAlchemicalChestRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.GLASS_BELL, new ItemGlassBellRenderer());
}
@Override
public void registerTileEntities() {
super.registerTileEntities();
ClientRegistry.bindTileEntitySpecialRenderer(TileCalcinator.class, new TileEntityCalcinatorRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAludel.class, new TileEntityAludelRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemicalChest.class, new TileEntityAlchemicalChestRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileGlassBell.class, new TileEntityGlassBellRenderer());
}
@Override
public void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketRequestEvent(eventType, originX, originY, originZ, sideHit, rangeX, rangeY, rangeZ, data)));
}
@Override
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z);
if (tileEntity != null) {
if (tileEntity instanceof TileEE) {
((TileEE) tileEntity).setOrientation(orientation);
((TileEE) tileEntity).setState(state);
((TileEE) tileEntity).setCustomName(customName);
}
}
}
@Override
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
World world = FMLClientHandler.instance().getClient().theWorld;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
this.handleTileEntityPacket(x, y, z, orientation, state, customName);
if (tileEntity != null) {
if (tileEntity instanceof TileGlassBell) {
ItemStack itemStack = new ItemStack(itemID, stackSize, metaData);
if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) {
ItemUtil.setColor(itemStack, color);
}
((TileGlassBell) tileEntity).setInventorySlotContents(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, itemStack);
world.updateAllLightTypes(x, y, z);
}
else if (tileEntity instanceof TileAludel) {
ItemStack itemStack = new ItemStack(itemID, stackSize, metaData);
if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) {
ItemUtil.setColor(itemStack, color);
}
((TileAludel) tileEntity).setInventorySlotContents(TileAludel.INPUT_INVENTORY_INDEX, itemStack);
world.updateAllLightTypes(x, y, z);
}
}
}
@Override
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) {
if (TransmutationHelper.targetBlockStack != null) {
if (itemStack != null) {
int pnX = 1;
int pnY = 1;
int pnZ = 1;
if (itemStack.getItem() instanceof IChargeable) {
int charge = ((IChargeable) itemStack.getItem()).getCharge(itemStack) * 2;
switch (ForgeDirection.getOrientation(sideHit)) {
case UP: {
pnX = 1 + charge;
pnZ = 1 + charge;
break;
}
case DOWN: {
pnX = 1 + charge;
pnZ = 1 + charge;
break;
}
case NORTH: {
pnX = 1 + charge;
pnY = 1 + charge;
break;
}
case SOUTH: {
pnX = 1 + charge;
pnY = 1 + charge;
break;
}
case EAST: {
pnY = 1 + charge;
pnZ = 1 + charge;
break;
}
case WEST: {
pnY = 1 + charge;
pnZ = 1 + charge;
break;
}
case UNKNOWN: {
pnX = 0;
pnY = 0;
pnZ = 0;
break;
}
default:
break;
}
}
EquivalentExchange3.proxy.sendRequestEventPacket(ActionTypes.TRANSMUTATION, x, y, z, (byte) sideHit, (byte) pnX, (byte) pnY, (byte) pnZ, TransmutationHelper.formatTargetBlockInfo(TransmutationHelper.targetBlockStack));
}
}
}
}

View file

@ -1,151 +0,0 @@
package com.pahimar.ee3.core.proxy;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalBag;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest;
import com.pahimar.ee3.client.gui.inventory.GuiAludel;
import com.pahimar.ee3.client.gui.inventory.GuiCalcinator;
import com.pahimar.ee3.client.gui.inventory.GuiGlassBell;
import com.pahimar.ee3.client.gui.inventory.GuiPortableCrafting;
import com.pahimar.ee3.client.gui.inventory.GuiPortableTransmutation;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.inventory.ContainerAludel;
import com.pahimar.ee3.inventory.ContainerCalcinator;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
import com.pahimar.ee3.inventory.ContainerPortableTransmutation;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileCalcinator;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* Equivalent-Exchange-3
*
* CommonProxy
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CommonProxy implements IGuiHandler {
public void registerKeyBindingHandler() {
}
public void registerRenderTickHandler() {
}
public void registerDrawBlockHighlightHandler() {
}
public void setKeyBinding(String name, int value) {
}
public void registerSoundHandler() {
}
public void initRenderingAndTextures() {
}
public void registerTileEntities() {
GameRegistry.registerTileEntity(TileCalcinator.class, Strings.TE_CALCINATOR_NAME);
GameRegistry.registerTileEntity(TileAludel.class, Strings.TE_ALUDEL_NAME);
GameRegistry.registerTileEntity(TileAlchemicalChest.class, Strings.TE_ALCHEMICAL_CHEST_NAME);
GameRegistry.registerTileEntity(TileGlassBell.class, Strings.TE_GLASS_BELL_NAME);
}
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) {
}
public void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
}
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
}
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == GuiIds.PORTABLE_CRAFTING)
return new ContainerPortableCrafting(player.inventory, world, x, y, z);
else if (ID == GuiIds.PORTABLE_TRANSMUTATION)
return new ContainerPortableTransmutation();
else if (ID == GuiIds.CALCINATOR) {
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
return new ContainerCalcinator(player.inventory, tileCalcinator);
}
else if (ID == GuiIds.ALCHEMICAL_CHEST) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
return new ContainerAlchemicalChest(player.inventory, tileAlchemicalChest);
}
else if (ID == GuiIds.ALCHEMICAL_BAG)
// TODO Alchemical Bag inventory work is incomplete
return new ContainerAlchemicalBag(player.inventory);
else if (ID == GuiIds.ALUDEL) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new ContainerAludel(player.inventory, tileAludel);
}
else if (ID == GuiIds.GLASS_BELL) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
return new ContainerGlassBell(player.inventory, tileGlassBell);
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == GuiIds.PORTABLE_CRAFTING)
return new GuiPortableCrafting(player, world, x, y, z);
else if (ID == GuiIds.PORTABLE_TRANSMUTATION)
return new GuiPortableTransmutation(null);
else if (ID == GuiIds.CALCINATOR) {
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
return new GuiCalcinator(player.inventory, tileCalcinator);
}
else if (ID == GuiIds.ALCHEMICAL_CHEST) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
return new GuiAlchemicalChest(player.inventory, tileAlchemicalChest);
}
else if (ID == GuiIds.ALCHEMICAL_BAG)
// TODO Alchemical Bag inventory work is incomplete
return new GuiAlchemicalBag(player.inventory);
else if (ID == GuiIds.ALUDEL) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new GuiAludel(player.inventory, tileAludel);
}
else if (ID == GuiIds.GLASS_BELL) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
return new GuiGlassBell(player.inventory, tileGlassBell);
}
return null;
}
}

View file

@ -1,49 +0,0 @@
package com.pahimar.ee3.core.util;
public class EnergyStack {
public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits";
public static final int VANILLA_SMELTING_ENERGY_THRESHOLD = 200;
public String energyName;
public int stackSize;
public EnergyStack(String energyName, int stackSize) {
this.energyName = energyName;
this.stackSize = stackSize;
}
public EnergyStack() {
this("", 0);
}
public EnergyStack(String energyName) {
this(energyName, 1);
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyName));
return stringBuilder.toString();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof EnergyStack)) {
return false;
}
EnergyStack energyStack = (EnergyStack) object;
return (this.stackSize == energyStack.stackSize && this.energyName.equalsIgnoreCase(energyStack.energyName));
}
}

View file

@ -1,55 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
*
* GeneralHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class GeneralHelper {
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 boolean isHostileEntity(EntityLivingBase entity) {
if (entity instanceof IMob)
return true;
else
return false;
}
}

View file

@ -1,204 +0,0 @@
package com.pahimar.ee3.core.util;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import com.pahimar.ee3.item.ModItems;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
/**
* Equivalent-Exchange-3
*
* ItemDropHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemUtil {
private static double rand;
public static String toString(ItemStack itemStack) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("ItemStack(");
if (itemStack != null) {
stringBuilder.append(String.format("%s", encodeItemStackAsString(itemStack)));
if (itemStack.hasTagCompound()) {
stringBuilder.append(String.format("%s%s", Strings.TOKEN_DELIMITER, NBTHelper.encodeNBTAsString((itemStack.getTagCompound()))));
}
}
else {
stringBuilder.append("null");
}
stringBuilder.append(")");
return stringBuilder.toString();
}
public static String encodeItemStackAsString(ItemStack itemStack) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%s%s%s", itemStack.itemID, Strings.TOKEN_DELIMITER, itemStack.getItemDamage()));
return stringBuilder.toString();
}
public static ItemStack decodeItemStackFromString(String encodedItemStack) {
ItemStack decodedItemStack = null;
final int UNDEFINED = -1;
final int ERROR = -2;
int itemId = UNDEFINED;
int meta = UNDEFINED;
String[] splitString = encodedItemStack.split(Strings.TOKEN_DELIMITER);
// Grab itemId
if (splitString.length >= 1) {
try {
itemId = Integer.parseInt(splitString[0]);
} catch (NumberFormatException e) {
itemId = ERROR;
}
}
// Grab meta
if (splitString.length >= 2) {
try {
meta = Integer.parseInt(splitString[1]);
} catch (NumberFormatException e) {
meta = ERROR;
}
}
if (meta == UNDEFINED) {
meta = OreDictionary.WILDCARD_VALUE;
}
if (itemId != UNDEFINED && itemId != ERROR) {
if (meta != ERROR) {
decodedItemStack = new ItemStack(itemId, 1, meta);
}
}
return decodedItemStack;
}
/**
* Compares two ItemStacks for equality, testing itemID, metaData,
* stackSize, and their NBTTagCompounds (if they are present)
*
* @param first
* The first ItemStack being tested for equality
* @param second
* The second ItemStack being tested for equality
* @return true if the two ItemStacks are equivalent, false otherwise
*/
public static boolean compare(ItemStack first, ItemStack second) {
// Check to see if either argument is null
if ((first != null) && (second != null)) {
// Check the item IDs
if (first.itemID == second.itemID) {
// Check the meta data
if ((first.getItemDamage() == OreDictionary.WILDCARD_VALUE) || (second.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
//return true;
}
if (first.getItemDamage() == second.getItemDamage()) {
// Check the stack size
if (first.stackSize == second.stackSize) {
// If at least one of the ItemStacks has a NBTTagCompound, test for equality
if (first.hasTagCompound() || second.hasTagCompound()) {
// If one of the stacks has a tag compound, but not both, they are not equal
if (!(first.hasTagCompound() && second.hasTagCompound())) {
return false;
}
// Otherwise, they both have tag compounds and we need to test them for equality
else {
return first.getTagCompound().equals(second.getTagCompound());
}
}
// Otherwise, they must be equal if we have gotten this far (item IDs, meta data, and stack size all match)
else {
return true;
}
}
}
}
}
return false;
}
public static boolean hasColor(ItemStack itemStack) {
return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR);
}
public static int getColor(ItemStack itemStack) {
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
if (nbtTagCompound == null)
return Integer.parseInt(Colours.PURE_WHITE, 16);
else {
NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY);
return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16);
}
}
public static void setColor(ItemStack itemStack, int color) {
if (itemStack != null) {
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
if (nbtTagCompound == null) {
nbtTagCompound = new NBTTagCompound();
itemStack.setTagCompound(nbtTagCompound);
}
NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY);
if (!nbtTagCompound.hasKey(Strings.NBT_ITEM_DISPLAY)) {
nbtTagCompound.setCompoundTag(Strings.NBT_ITEM_DISPLAY, colourTagCompound);
}
colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color);
}
}
public static void dropMiniumShard(EntityPlayer player, EntityLivingBase entity) {
if (GeneralHelper.isHostileEntity(entity)) {
rand = Math.random();
if (rand < 0.15d) {
entity.dropItem(ModItems.miniumShard.itemID, 1);
}
}
}
}

View file

@ -1,65 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.ArrayList;
import net.minecraft.client.settings.KeyBinding;
import com.pahimar.ee3.configuration.ConfigurationSettings;
/**
* Equivalent-Exchange-3
*
* KeyBindingHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class KeyBindingUtil {
public static ArrayList<KeyBinding> keyBindingsList;
public static ArrayList<Boolean> isRepeatingList;
public static void addKeyBinding(String name, int value) {
if (keyBindingsList == null) {
keyBindingsList = new ArrayList<KeyBinding>();
}
keyBindingsList.add(new KeyBinding(name, value));
}
public static void addIsRepeating(boolean value) {
if (isRepeatingList == null) {
isRepeatingList = new ArrayList<Boolean>();
}
isRepeatingList.add(value);
}
public static KeyBinding[] gatherKeyBindings() {
return keyBindingsList.toArray(new KeyBinding[keyBindingsList.size()]);
}
public static boolean[] gatherIsRepeating() {
boolean[] isRepeating = new boolean[isRepeatingList.size()];
for (int x = 0; x < isRepeating.length; x++) {
isRepeating[x] = isRepeatingList.get(x).booleanValue();
}
return isRepeating;
}
// TODO Still not ideal, won't work for every case. Specifically, make it context sensitive
public static boolean isClientSided(String keybinding) {
if (keybinding.equalsIgnoreCase(ConfigurationSettings.KEYBINDING_TOGGLE))
return true;
else
return false;
}
}

View file

@ -1,46 +0,0 @@
package com.pahimar.ee3.core.util;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Equivalent-Exchange-3
*
* LocalizationHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class LocalizationUtil {
/***
* Simple test to determine if a specified file name represents a XML file
* or not
*
* @param fileName
* String representing the file name of the file in question
* @return True if the file name represents a XML file, false otherwise
*/
public static boolean isXMLLanguageFile(String fileName) {
return fileName.endsWith(".xml");
}
/***
* Returns the locale from file name
*
* @param fileName
* String representing the file name of the file in question
* @return String representation of the locale snipped from the file name
*/
public static String getLocaleFromFileName(String fileName) {
return fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.'));
}
public static String getLocalizedString(String key) {
return LanguageRegistry.instance().getStringLocalization(key);
}
}

View file

@ -1,72 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.pahimar.ee3.lib.Reference;
import cpw.mods.fml.common.FMLLog;
/**
* Equivalent-Exchange-3
*
* LogHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class LogHelper {
private static Logger eeLogger = Logger.getLogger(Reference.MOD_ID);
public static void init() {
eeLogger.setParent(FMLLog.getLogger());
}
public static void log(Level logLevel, String message) {
eeLogger.log(logLevel, message);
}
public static void severe(String message) {
log(Level.SEVERE, message);
}
public static void debug(String message) {
log(Level.WARNING, "[DEBUG] " + message);
}
public static void warning(String message) {
log(Level.WARNING, message);
}
public static void info(String message) {
log(Level.INFO, message);
}
public static void config(String message) {
log(Level.CONFIG, message);
}
public static void fine(String message) {
log(Level.FINE, message);
}
public static void finer(String message) {
log(Level.FINER, message);
}
public static void finest(String message) {
log(Level.FINEST, message);
}
}

View file

@ -1,97 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.ArrayList;
import java.util.Comparator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class OreStack implements Comparator<OreStack> {
public String oreName;
public int stackSize;
public OreStack() {
stackSize = 0;
oreName = null;
}
public OreStack(String oreName, int stackSize) {
this.oreName = oreName;
this.stackSize = stackSize;
}
public OreStack(String oreName) {
this(oreName, 1);
}
public OreStack(int oreID) {
this(OreDictionary.getOreName(oreID));
}
public OreStack(int oreID, int stackSize) {
this(OreDictionary.getOreName(oreID), stackSize);
}
public OreStack(ItemStack itemStack) {
this(OreDictionary.getOreID(itemStack), itemStack.stackSize);
}
public ArrayList<ItemStack> getOres() {
return OreDictionary.getOres(oreName);
}
public int getOreID() {
return OreDictionary.getOreID(oreName);
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreName));
return stringBuilder.toString();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof OreStack))
return false;
OreStack oreStackObject = (OreStack) object;
return stackSize == oreStackObject.stackSize && oreName.equals(oreStackObject.oreName);
}
@Override
public int compare(OreStack oreStack1, OreStack oreStack2) {
if (oreStack1 != null && oreStack2 != null) {
if (oreStack1.oreName.equals(oreStack2.oreName))
return 0;
}
return -1;
}
public static boolean compareStacks(OreStack oreStack1, OreStack oreStack2) {
return oreStack1.compareToStack(oreStack2);
}
public boolean compareToStack(OreStack oreStack) {
return compare(this, oreStack) == 0;
}
}

View file

@ -1,40 +0,0 @@
package com.pahimar.ee3.core.util;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
*
* QualityHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class QualityHelper {
private static int[][] dustTable = { { 0, 0, 0, 1, 1, 1 }, { 0, 1, 1, 1, 2, 2 }, { 0, 1, 2, 2, 2, 2 }, { 1, 1, 2, 3, 3, 3 }, { 1, 2, 2, 3, 4, 4 }, { 1, 2, 2, 3, 4, 5 }, };
public static int getItemTierQuality(ItemStack item) {
// TODO Return the 'Tier' level of the given ItemStack
return -1;
}
public static int getFuelTierQuality(ItemStack fuel) {
// TODO Return the 'Tier' level of the given ItemStack
return -1;
}
public static int getDustTierQuality(ItemStack item, ItemStack fuel) {
if (getItemTierQuality(item) >= 0 && getItemTierQuality(item) <= 5) {
if (getFuelTierQuality(fuel) >= 0 && getFuelTierQuality(fuel) <= 5)
return dustTable[getItemTierQuality(item)][getFuelTierQuality(fuel)];
}
return -1;
}
}

View file

@ -1,175 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.pahimar.ee3.item.CustomWrappedStack;
/**
* Equivalent-Exchange-3
*
* RecipeHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class RecipeHelper {
/**
* Discovers all instances of ItemStacks with wild card meta values in the
* vanilla Crafting Manager
*
* @return A list of CustomWrappedStacks that contains all wild card meta
* ItemStacks in the vanilla Crafting Manager
*/
public static ArrayList<CustomWrappedStack> populateWildCards() {
ArrayList<CustomWrappedStack> wildCards = new ArrayList<CustomWrappedStack>();
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
if (recipe instanceof IRecipe) {
if (((IRecipe) recipe).getRecipeOutput() instanceof ItemStack) {
CustomWrappedStack recipeOutput = new CustomWrappedStack(((IRecipe) recipe).getRecipeOutput());
ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs((IRecipe) recipe);
ItemStack itemStack = null;
if (recipeOutput.getWrappedStack() instanceof ItemStack) {
itemStack = (ItemStack) recipeOutput.getWrappedStack();
if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(recipeOutput)) {
wildCards.add(recipeOutput);
}
}
for (CustomWrappedStack inputStack : recipeInputs) {
if (inputStack.getWrappedStack() instanceof ItemStack) {
itemStack = (ItemStack) inputStack.getWrappedStack();
if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !wildCards.contains(inputStack)) {
wildCards.add(inputStack);
}
}
}
}
}
}
return wildCards;
}
/**
* Returns a list of elements that constitute the input in a crafting recipe
*
* @param recipe
* The IRecipe being examined
* @return List of elements that constitute the input of the given IRecipe.
* Could be an ItemStack or an Arraylist
*/
public static ArrayList<CustomWrappedStack> getRecipeInputs(IRecipe recipe) {
ArrayList<CustomWrappedStack> recipeInputs = new ArrayList<CustomWrappedStack>();
if (recipe instanceof ShapedRecipes) {
ShapedRecipes shapedRecipe = (ShapedRecipes) recipe;
for (int i = 0; i < shapedRecipe.recipeItems.length; i++) {
if (shapedRecipe.recipeItems[i] instanceof ItemStack) {
ItemStack itemStack = shapedRecipe.recipeItems[i].copy();
if (itemStack.stackSize > 1) {
itemStack.stackSize = 1;
}
recipeInputs.add(new CustomWrappedStack(itemStack));
}
}
}
else if (recipe instanceof ShapelessRecipes) {
ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe;
for (Object object : shapelessRecipe.recipeItems) {
if (object instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) object).copy();
if (itemStack.stackSize > 1) {
itemStack.stackSize = 1;
}
recipeInputs.add(new CustomWrappedStack(itemStack));
}
}
}
else if (recipe instanceof ShapedOreRecipe) {
ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe;
for (int i = 0; i < shapedOreRecipe.getInput().length; i++) {
/*
* If the element is a list, then it is an OreStack
*/
if (shapedOreRecipe.getInput()[i] instanceof ArrayList) {
CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]);
if (oreStack.getWrappedStack() instanceof OreStack) {
recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i]));
}
}
else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy();
if (itemStack.stackSize > 1) {
itemStack.stackSize = 1;
}
recipeInputs.add(new CustomWrappedStack(itemStack));
}
}
}
else if (recipe instanceof ShapelessOreRecipe) {
ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe;
for (Object object : shapelessOreRecipe.getInput()) {
if (object instanceof ArrayList) {
recipeInputs.add(new CustomWrappedStack(object));
}
else if (object instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) object).copy();
if (itemStack.stackSize > 1) {
itemStack.stackSize = 1;
}
recipeInputs.add(new CustomWrappedStack(itemStack));
}
}
}
return recipeInputs;
}
}

View file

@ -1,13 +0,0 @@
package com.pahimar.ee3.core.util;
import com.pahimar.ee3.lib.Reference;
import net.minecraft.util.ResourceLocation;
public class ResourceLocationHelper {
public static ResourceLocation getResourceLocation(String path) {
return new ResourceLocation(Reference.MOD_ID.toLowerCase(), path);
}
}

View file

@ -1,146 +0,0 @@
package com.pahimar.ee3.core.util;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.pahimar.ee3.core.handlers.EquivalencyHandler;
/**
* Equivalent-Exchange-3
*
* TransmutationHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class TransmutationHelper {
public static ItemStack previousBlockStack = null;
public static ItemStack currentBlockStack = null;
public static ItemStack targetBlockStack = null;
public static boolean transmuteInWorld(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int targetID, int targetMeta) {
if (Block.blocksList[targetID] != null) {
world.setBlock(x, y, z, targetID, targetMeta, 2);
return true;
}
return false;
}
public static String formatTargetBlockInfo(ItemStack targetBlock) {
if (targetBlock != null)
return TransmutationHelper.targetBlockStack.itemID + ":" + TransmutationHelper.targetBlockStack.getItemDamage();
else
return "";
}
public static void updateTargetBlock(World world, int x, int y, int z) {
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
Block currentBlock = Block.blocksList[id];
if (currentBlock != null) {
meta = currentBlock.damageDropped(meta);
currentBlockStack = new ItemStack(id, 1, meta);
if (previousBlockStack == null) {
previousBlockStack = currentBlockStack;
targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage());
}
else {
if (!EquivalencyHandler.instance().areEquivalent(TransmutationHelper.previousBlockStack, currentBlockStack)) {
previousBlockStack = currentBlockStack;
targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage());
}
}
}
}
public static ItemStack getNextBlock(int id, int meta) {
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(id, meta);
ItemStack nextStack = null;
if (list != null)
return getNextBlock(id, meta, id, meta);
return nextStack;
}
private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta) {
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(id, meta);
ItemStack nextStack = null;
if (list != null) {
nextStack = EquivalencyHandler.instance().getNextInList(id, meta);
nextStack.stackSize = 1;
/*
* If the current item is the same as the original one we started
* with, then we have recursed through the entire list and not found
* a next block so return the original. This is the "base case" for
* the recursion.
*/
if (nextStack.itemID == origId && nextStack.getItemDamage() == origMeta)
return nextStack;
else {
if (nextStack.getItem() instanceof ItemBlock)
return nextStack;
else
return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta);
}
}
// In the event the list is null, return null
return nextStack;
}
public static ItemStack getPreviousBlock(int itemID, int meta) {
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(itemID, meta);
ItemStack prevStack = null;
if (list != null)
return getPreviousBlock(itemID, meta, itemID, meta);
return prevStack;
}
private static ItemStack getPreviousBlock(int id, int meta, int origId, int origMeta) {
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(id, meta);
ItemStack prevStack = null;
if (list != null) {
prevStack = EquivalencyHandler.instance().getPrevInList(id, meta);
prevStack.stackSize = 1;
if (prevStack.itemID == origId && prevStack.getItemDamage() == origMeta)
return prevStack;
else {
if (prevStack.getItem() instanceof ItemBlock)
return prevStack;
else
return getPreviousBlock(prevStack.itemID, prevStack.getItemDamage(), origId, origMeta);
}
}
// In the event the list is null, return null
return prevStack;
}
}

View file

@ -1,224 +0,0 @@
package com.pahimar.ee3.core.util;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import net.minecraftforge.common.Configuration;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Equivalent-Exchange-3
*
* VersionHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class VersionHelper implements Runnable {
private static VersionHelper instance = new VersionHelper();
// The (publicly available) remote version number authority file
private static final String REMOTE_VERSION_XML_FILE = "https://raw.github.com/pahimar/Equivalent-Exchange-3/master/version.xml";
public static Properties remoteVersionProperties = new Properties();
// All possible results of the remote version number check
public static final byte UNINITIALIZED = 0;
public static final byte CURRENT = 1;
public static final byte OUTDATED = 2;
public static final byte ERROR = 3;
public static final byte FINAL_ERROR = 4;
public static final byte MC_VERSION_NOT_FOUND = 5;
// Var to hold the result of the remote version check, initially set to uninitialized
private static byte result = UNINITIALIZED;
public static String remoteVersion = null;
public static String remoteUpdateLocation = null;
/***
* Checks the version of the currently running instance of the mod against
* the remote version authority, and sets the result of the check
* appropriately
*/
public static void checkVersion() {
InputStream remoteVersionRepoStream = null;
result = UNINITIALIZED;
try {
URL remoteVersionURL = new URL(REMOTE_VERSION_XML_FILE);
remoteVersionRepoStream = remoteVersionURL.openStream();
remoteVersionProperties.loadFromXML(remoteVersionRepoStream);
String remoteVersionProperty = remoteVersionProperties.getProperty(Loader.instance().getMCVersionString());
if (remoteVersionProperty != null) {
String[] remoteVersionTokens = remoteVersionProperty.split("\\|");
if (remoteVersionTokens.length >= 2) {
remoteVersion = remoteVersionTokens[0];
remoteUpdateLocation = remoteVersionTokens[1];
}
else {
result = ERROR;
}
if (remoteVersion != null) {
if (!ConfigurationSettings.LAST_DISCOVERED_VERSION.equalsIgnoreCase(remoteVersion)) {
ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, remoteVersion);
}
if (remoteVersion.equalsIgnoreCase(getVersionForCheck())) {
result = CURRENT;
}
else {
result = OUTDATED;
}
}
}
else {
result = MC_VERSION_NOT_FOUND;
}
}
catch (Exception e) {
}
finally {
if (result == UNINITIALIZED) {
result = ERROR;
}
try {
if (remoteVersionRepoStream != null) {
remoteVersionRepoStream.close();
}
}
catch (Exception ex) {
}
}
}
private static String getVersionForCheck() {
String[] versionTokens = Reference.VERSION_NUMBER.split(" ");
if (versionTokens.length >= 1)
return versionTokens[0];
else
return Reference.VERSION_NUMBER;
}
public static void logResult() {
if (result == CURRENT || result == OUTDATED) {
LogHelper.info(getResultMessage());
}
else {
LogHelper.warning(getResultMessage());
}
}
public static String getResultMessage() {
if (result == UNINITIALIZED)
return LanguageRegistry.instance().getStringLocalization(Strings.UNINITIALIZED_MESSAGE);
else if (result == CURRENT) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.CURRENT_MESSAGE);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
return returnString;
}
else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation);
return returnString;
}
else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation);
return returnString;
}
else if (result == ERROR)
return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE);
else if (result == FINAL_ERROR)
return LanguageRegistry.instance().getStringLocalization(Strings.FINAL_ERROR_MESSAGE);
else if (result == MC_VERSION_NOT_FOUND) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.MC_VERSION_NOT_FOUND);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
return returnString;
}
else {
result = ERROR;
return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE);
}
}
public static String getResultMessageForClient() {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@MINECRAFT_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE);
return returnString;
}
public static byte getResult() {
return result;
}
@Override
public void run() {
int count = 0;
LogHelper.info(LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE);
try {
while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) {
checkVersion();
count++;
logResult();
if (result == UNINITIALIZED || result == ERROR) {
Thread.sleep(10000);
}
}
if (result == ERROR) {
result = FINAL_ERROR;
logResult();
}
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void execute() {
new Thread(instance).start();
}
}

View file

@ -1,36 +0,0 @@
package com.pahimar.ee3.creativetab;
import net.minecraft.creativetab.CreativeTabs;
import com.pahimar.ee3.lib.ItemIds;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* CreativeTabEE3
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CreativeTabEE3 extends CreativeTabs {
public CreativeTabEE3(int par1, String par2Str) {
super(par1, par2Str);
}
@Override
@SideOnly(Side.CLIENT)
/**
* the itemID for the item to be displayed on the tab
*/
public int getTabIconItemIndex() {
return ItemIds.MINIUM_SHARD;
}
}

View file

@ -1,161 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import com.google.common.collect.Multimap;
import com.pahimar.ee3.core.util.LogHelper;
import com.pahimar.ee3.emc.graph.WeightedDirectedGraph;
import com.pahimar.ee3.emc.graph.WeightedEdge;
import com.pahimar.ee3.item.CustomWrappedStack;
import com.pahimar.ee3.item.crafting.RecipeRegistry;
public class DynEMC {
private static DynEMC dynEMC = null;
private RecipeRegistry recipeRegistry;
private WeightedDirectedGraph<CustomWrappedStack> graph;
private DynEMC() {
recipeRegistry = RecipeRegistry.getInstance();
graph = new WeightedDirectedGraph<CustomWrappedStack>();
init();
}
public static DynEMC getInstance() {
if (dynEMC == null) {
dynEMC = new DynEMC();
}
return dynEMC;
}
private void init() {
populateGraph();
}
private void populateGraph() {
for (CustomWrappedStack discoveredStack : recipeRegistry.getDiscoveredStacks()) {
graph.addNode(discoveredStack);
}
Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipeMappings = recipeRegistry.getRecipeMappings();
Set<CustomWrappedStack> recipeKeySet = recipeMappings.keySet();
Iterator<CustomWrappedStack> recipeKeySetIterator = recipeKeySet.iterator();
CustomWrappedStack recipeOutput = null;
while (recipeKeySetIterator.hasNext()) {
recipeOutput = recipeKeySetIterator.next();
for (List<CustomWrappedStack> recipeInputs : recipeMappings.get(recipeOutput)) {
CustomWrappedStack unWrappedRecipeOutput = new CustomWrappedStack(recipeOutput.getWrappedStack());
if (graph.nodeExists(unWrappedRecipeOutput)) {
for (CustomWrappedStack recipeInput : recipeInputs) {
// Unwrapped the wrapped stacks so that we actually find them in the graph
CustomWrappedStack unWrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack());
if (graph.nodeExists(unWrappedRecipeInput)) {
if (recipeOutput.getStackSize() != 0) {
try {
graph.addEdge(unWrappedRecipeOutput, unWrappedRecipeInput, (recipeInput.getStackSize() * 1.0f) / recipeOutput.getStackSize());
} catch (NoSuchElementException e) {
LogHelper.severe(e.getLocalizedMessage());
}
}
}
else {
LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' exists in the crafting relationship graph");
LogHelper.debug("Recipe input '" + unWrappedRecipeInput.toString() + "' does not exist in the crafting relationship graph");
}
}
}
else {
LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' does not exist in the crafting relationship graph");
}
}
}
}
public List<CustomWrappedStack> getCriticalNodes() {
return graph.getCriticalNodes();
}
public int size() {
return graph.size();
}
public void printDebugDump() {
LogHelper.debug("Total node count: " + graph.getAllNodes().size());
LogHelper.debug("Critical node count: " + graph.getCriticalNodes().size());
LogHelper.debug("Orphan node count: " + graph.getOrphanNodes().size());
List<CustomWrappedStack> critsMinusOrphans = graph.getCriticalNodes();
critsMinusOrphans.removeAll(graph.getOrphanNodes());
LogHelper.debug("[Critical - Orphans] node count: " + critsMinusOrphans.size());
LogHelper.debug("***** START NODES *****");
Iterator<CustomWrappedStack> nodeIter = graph.iterator();
while (nodeIter.hasNext()) {
CustomWrappedStack node = nodeIter.next();
LogHelper.debug("Node: " + node);
}
LogHelper.debug("***** END NODES *****");
LogHelper.debug("***** START EDGES FROM *****");
nodeIter = graph.iterator();
while (nodeIter.hasNext()) {
CustomWrappedStack node = nodeIter.next();
Set<WeightedEdge<CustomWrappedStack>> edgesFrom = graph.edgesFrom(node);
for (WeightedEdge<CustomWrappedStack> edge : edgesFrom) {
LogHelper.debug("Crafting Output: " + node);
LogHelper.debug("Crafting Input: " + edge.getTarget());
LogHelper.debug("Weight: " + edge.getWeight());
LogHelper.debug("");
}
}
LogHelper.debug("***** END EDGES FROM *****");
LogHelper.debug("***** START EDGES TO *****");
nodeIter = graph.iterator();
while (nodeIter.hasNext()) {
CustomWrappedStack node = nodeIter.next();
Set<WeightedEdge<CustomWrappedStack>> edgesTo = graph.edgesTo(node);
Iterator<WeightedEdge<CustomWrappedStack>> edgeIter = edgesTo.iterator();
while (edgeIter.hasNext()) {
WeightedEdge<CustomWrappedStack> edge = edgeIter.next();
LogHelper.debug("From: " + node);
LogHelper.debug("To: " + edge.getTarget());
LogHelper.debug("Weight: " + edge.getWeight());
LogHelper.debug("");
}
}
LogHelper.debug("***** END EDGES TO *****");
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("DynEMC Node Count: %s", graph.size()));
return stringBuilder.toString();
}
}

View file

@ -1,119 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import com.pahimar.ee3.item.CustomWrappedStack;
public class EmcBlackList {
private static EmcBlackList emcBlackList = null;
private ArrayList<CustomWrappedStack> stackBlackList = new ArrayList<CustomWrappedStack>();
private EmcBlackList() {
}
public static EmcBlackList getInstance() {
if (emcBlackList == null) {
emcBlackList = new EmcBlackList();
emcBlackList.init();
}
return emcBlackList;
}
public List<CustomWrappedStack> getBlackList() {
return stackBlackList;
}
public boolean add(Object object) {
boolean wasAdded = false;
if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1);
if (!stackBlackList.contains(wrappedStack)) {
stackBlackList.add(wrappedStack);
wasAdded = true;
}
}
return wasAdded;
}
public boolean contains(Object object) {
if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1);
return stackBlackList.contains(wrappedStack);
}
return false;
}
public boolean remove(Object object) {
boolean wasRemoved = false;
if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1);
if (stackBlackList.contains(wrappedStack)) {
stackBlackList.remove(wrappedStack);
wasRemoved = true;
}
}
return wasRemoved;
}
private void init() {
add(Block.bed);
add(Block.pistonExtension);
add(Block.pistonMoving);
add(Block.mobSpawner);
add(Block.redstoneWire);
add(Block.crops);
add(Block.furnaceBurning);
add(Block.signPost);
add(Block.doorWood);
add(Block.signWall);
add(Block.doorIron);
add(Block.torchRedstoneIdle);
add(Block.reed);
add(Block.portal);
add(Block.cake);
add(Block.redstoneRepeaterIdle);
add(Block.redstoneRepeaterActive);
add(Block.lockedChest);
add(Block.pumpkinStem);
add(Block.melonStem);
add(Block.netherStalk);
add(Block.brewingStand);
add(Block.cauldron);
add(Block.endPortal);
add(Block.redstoneLampActive);
add(Block.commandBlock);
add(Block.carrot);
add(Block.potato);
add(Block.skull);
add(Block.redstoneComparatorIdle);
add(Block.redstoneComparatorActive);
}
}

View file

@ -1,46 +0,0 @@
package com.pahimar.ee3.emc;
public class EmcComponent {
private final EmcType emcType;
private final float percentage;
public EmcComponent(EmcType emcType, float percentage) {
this.emcType = emcType;
this.percentage = percentage;
}
public EmcType getEmcType() {
return emcType;
}
public float getPercentage() {
return percentage;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof EmcComponent)) {
return false;
}
EmcComponent emcBreakDown = (EmcComponent) object;
return ((this.emcType == emcBreakDown.emcType) && (this.percentage == emcBreakDown.percentage));
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("<EMC Type: %s, Percentage: %s>", emcType, (percentage * 100)));
return stringBuilder.toString();
}
}

View file

@ -1,15 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.HashMap;
import java.util.List;
import com.pahimar.ee3.item.CustomWrappedStack;
public class EmcDefaultValues {
private static HashMap<CustomWrappedStack, List<CustomWrappedStack>> defaultEmcValues = new HashMap<CustomWrappedStack, List<CustomWrappedStack>>();
public static void init() {
}
}

View file

@ -1,37 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.HashMap;
import com.pahimar.ee3.item.CustomWrappedStack;
public class EmcMap {
private static EmcMap emcMap = null;
private HashMap<CustomWrappedStack, EmcValue> emcMappings;
private EmcMap() {
emcMappings = new HashMap<CustomWrappedStack, EmcValue>();
}
public static EmcMap getInstance() {
if (emcMap == null) {
emcMap = new EmcMap();
}
return emcMap;
}
public EmcValue getEmcValue(Object object) {
EmcValue emcValue = null;
if (CustomWrappedStack.canBeWrapped(object)) {
return emcMappings.get(new CustomWrappedStack(object));
}
return emcValue;
}
}

View file

@ -1,5 +0,0 @@
package com.pahimar.ee3.emc;
public enum EmcType {
CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID, OMNI;
}

View file

@ -1,161 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.ArrayList;
import java.util.List;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* EMCEntry
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class EmcValue {
private float value, recoveryPercentage;
private List<EmcComponent> emcComponents;
public EmcValue() {
value = 0F;
recoveryPercentage = 1F;
emcComponents = new ArrayList<EmcComponent>();
}
public EmcValue(float value) {
this.value = value;
recoveryPercentage = 1F;
emcComponents = new ArrayList<EmcComponent>();
}
public EmcValue(float value, float recoveryPercentage) {
this.value = value;
this.recoveryPercentage = recoveryPercentage;
emcComponents = new ArrayList<EmcComponent>();
}
public EmcValue(float value, float recoveryPercentage, List<EmcComponent> emcComponents) {
this.value = value;
this.recoveryPercentage = recoveryPercentage;
this.emcComponents = emcComponents;
}
public float getValue() {
return value;
}
public float getRecoveryPercentage() {
return recoveryPercentage;
}
public List<EmcComponent> getComponents() {
return emcComponents;
}
public EmcComponent getComponent(EmcType emcType) {
for (EmcComponent emcComponent : emcComponents) {
if (emcComponent.getEmcType().equals(emcType)) {
return emcComponent;
}
}
return null;
}
public boolean containsEmcType(EmcType emcType) {
for (EmcComponent emcComponent : emcComponents) {
if (emcComponent.getEmcType().equals(emcType)) {
return true;
}
}
return false;
}
public void setValue(float cost) {
this.value = cost;
}
public void setRecoveryPercentage(float recoveryPercentage) {
this.recoveryPercentage = recoveryPercentage;
}
public void addEmcComponent(EmcComponent emcComponent) {
if (!containsEmcType(emcComponent.getEmcType())) {
emcComponents.add(emcComponent);
}
}
public void addEmcComponent(EmcType emcType, float percentage) {
addEmcComponent(new EmcComponent(emcType, percentage));
}
@Override
public boolean equals(Object object) {
if (!(object instanceof EmcValue)) {
return false;
}
EmcValue emcValue = (EmcValue) object;
if (value == emcValue.value) {
if (recoveryPercentage == emcValue.recoveryPercentage) {
return emcComponents.equals(emcValue.getComponents());
}
}
return false;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("V:%s", value));
stringBuilder.append(Strings.TOKEN_DELIMITER);
stringBuilder.append(String.format("RP:%s", recoveryPercentage));
stringBuilder.append(Strings.TOKEN_DELIMITER);
stringBuilder.append("[");
for (int i = 0; i < emcComponents.size(); i++) {
if (i > 0) {
stringBuilder.append(Strings.TOKEN_DELIMITER);
}
stringBuilder.append(String.format("%s:%s", emcComponents.get(i).getEmcType(), emcComponents.get(i).getPercentage()));
}
stringBuilder.append("]");
return stringBuilder.toString();
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 37 * hashCode + Float.floatToIntBits(value);
hashCode = 37 * hashCode + Float.floatToIntBits(recoveryPercentage);
hashCode = 37 * hashCode + emcComponents.hashCode();
return hashCode;
}
}

View file

@ -1,113 +0,0 @@
package com.pahimar.ee3.emc;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.item.CustomWrappedStack;
public class EquivalencyGroup {
private List<CustomWrappedStack> equivalentItems;
public EquivalencyGroup() {
equivalentItems = new ArrayList<CustomWrappedStack>();
}
public EquivalencyGroup(List<ItemStack> equivalentItems) {
this.equivalentItems = new ArrayList<CustomWrappedStack>();
for (ItemStack itemStack : equivalentItems) {
this.equivalentItems.add(new CustomWrappedStack(itemStack));
}
}
public List<CustomWrappedStack> getMembers() {
return equivalentItems;
}
public boolean containsMember(ItemStack itemStack) {
return containsMember(new CustomWrappedStack(itemStack));
}
public boolean containsMember(CustomWrappedStack customWrappedStack) {
return equivalentItems.contains(customWrappedStack);
}
public void addMember(ItemStack itemStack) {
this.addMember(new CustomWrappedStack(itemStack));
}
public void addMember(CustomWrappedStack customWrappedStack) {
if (!containsMember(customWrappedStack)) {
equivalentItems.add(customWrappedStack);
}
}
public void setEquivalentItems(List<CustomWrappedStack> equivalentItems) {
this.equivalentItems = equivalentItems;
}
public void removeMember(ItemStack itemStack) {
removeMember(new CustomWrappedStack(itemStack));
}
public void removeMember(CustomWrappedStack customWrappedStack) {
while (containsMember(customWrappedStack)) {
equivalentItems.remove(customWrappedStack);
}
}
public void clearMembers() {
equivalentItems = new ArrayList<CustomWrappedStack>();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof EquivalencyGroup)) {
return false;
}
EquivalencyGroup equivalencyGroup = (EquivalencyGroup) object;
return (equivalentItems.equals(equivalencyGroup.equivalentItems));
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Equivalent Group Members: ");
for (CustomWrappedStack customWrappedStack : equivalentItems) {
stringBuilder.append(String.format("%s ", customWrappedStack));
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
int hashCode = 1;
for (CustomWrappedStack customWrappedStack : equivalentItems) {
hashCode = 37 * hashCode + customWrappedStack.hashCode();
}
return hashCode;
}
}

View file

@ -1,272 +0,0 @@
package com.pahimar.ee3.emc.graph;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.logging.Logger;
import com.pahimar.ee3.core.util.LogHelper;
public class WeightedDirectedGraph<T> implements Iterable<T> {
private final Map<T, SortedSet<WeightedEdge<T>>> graph = new HashMap<T, SortedSet<WeightedEdge<T>>>();
private List<T> orderedNodes = new ArrayList<T>();
public boolean addNode(T node) {
// Ignore nodes already added
if (graph.containsKey(node))
return false;
orderedNodes.add(node);
graph.put(node, new TreeSet<WeightedEdge<T>>(new Comparator<WeightedEdge<T>>() {
@Override
public int compare(WeightedEdge<T> o1, WeightedEdge<T> o2) {
return orderedNodes.indexOf(o1.getTarget()) - orderedNodes.indexOf(o2.getTarget());
}
}));
return true;
}
public void addEdge(T from, T to) {
addEdge(from, to, 1);
}
public void addEdge(T from, T to, float weight) {
if (!(graph.containsKey(from) && graph.containsKey(to))) {
if (!graph.containsKey(from)) {
LogHelper.severe("From node doesn't exist: " + from.toString());
LogHelper.severe("To node: " + to.toString());
}
if (!graph.containsKey(to)) {
LogHelper.severe("From node: " + from.toString());
LogHelper.severe("To node doesn't exist: " + to.toString());
}
throw new NoSuchElementException("Missing nodes from graph");
}
// If a directed edge of the same weight doesn't already exist, add the new edge
if (!edgeExists(from, to, weight)) {
graph.get(from).add(new WeightedEdge<T>(weight, to));
}
}
public boolean edgeExists(T from, T to) {
if (!(graph.containsKey(from) && graph.containsKey(to)))
throw new NoSuchElementException("Missing nodes from graph");
Iterator<WeightedEdge<T>> edgeIterator = graph.get(from).iterator();
while (edgeIterator.hasNext()) {
if (edgeIterator.next().getTarget().equals(to))
return true;
}
return false;
}
public boolean edgeExists(T from, T to, float weight) {
if (!(graph.containsKey(from) && graph.containsKey(to))) {
if (!graph.containsKey(from)) {
LOGGER.severe("From node doesn't exist: " + from.toString());
LOGGER.severe("To node: " + to.toString());
}
if (!graph.containsKey(to)) {
LOGGER.severe("To node doesn't exist: " + to.toString());
LOGGER.severe("From node: " + from.toString());
}
throw new NoSuchElementException("Missing nodes from graph");
}
return graph.get(from).contains(new WeightedEdge<T>(weight, to));
}
public boolean nodeExists(T node) {
return graph.containsKey(node);
}
public Set<WeightedEdge<T>> edgesFrom(T from) {
if (!graph.containsKey(from))
throw new NoSuchElementException("Missing node from graph");
return Collections.unmodifiableSortedSet(graph.get(from));
}
public Set<WeightedEdge<T>> edgesTo(T to) {
if (!graph.containsKey(to))
throw new NoSuchElementException("Missing node from graph");
Set<WeightedEdge<T>> edgesTo = new TreeSet<WeightedEdge<T>>(new Comparator<WeightedEdge<T>>() {
@Override
public int compare(WeightedEdge<T> o1, WeightedEdge<T> o2) {
return o1.hashCode() - o2.hashCode();
}
});
for (T node : graph.keySet()) {
if (!node.equals(to)) {
Set<WeightedEdge<T>> edgesFrom = edgesFrom(node);
for (WeightedEdge<T> fromEdge : edgesFrom) {
if (fromEdge.getTarget().equals(to)) {
edgesTo.add(new WeightedEdge<T>(fromEdge.getWeight(), node));
}
}
}
}
return Collections.unmodifiableSet(edgesTo);
}
public void removeNode(T node) {
if (!graph.containsKey(node))
throw new NoSuchElementException("Missing node from graph");
// Remove all edges from and to the node
removeAllEdgesFrom(node);
removeAllEdgesTo(node);
// Remove the node
graph.remove(node);
}
public void removeEdge(T from, T to) {
removeEdge(from, to, 1);
}
public void removeEdge(T from, T to, float weight) {
if (!(graph.containsKey(from) && graph.containsKey(to)))
throw new NoSuchElementException("Missing nodes from graph");
graph.get(from).remove(new WeightedEdge<T>(weight, to));
}
public void removeAllEdgesFrom(T node) {
if (!graph.containsKey(node))
throw new NoSuchElementException("Missing node from graph");
graph.get(node).clear();
}
public void removeAllEdgesTo(T node) {
if (!graph.containsKey(node))
throw new NoSuchElementException("Missing node from graph");
for (T aNode : graph.keySet()) {
Set<WeightedEdge<T>> edgesFrom = edgesFrom(aNode);
for (WeightedEdge<T> fromEdge : edgesFrom) {
if (fromEdge.getTarget().equals(node)) {
graph.get(aNode).remove(fromEdge);
}
}
}
}
public void removeAllEdgesBetween(T firstNode, T secondNode) {
if (!(graph.containsKey(firstNode) && graph.containsKey(secondNode)))
throw new NoSuchElementException("Missing nodes from graph");
for (WeightedEdge<T> edgeFrom : edgesFrom(firstNode)) {
if (edgeFrom.getTarget().equals(secondNode)) {
graph.get(firstNode).remove(edgeFrom);
}
}
for (WeightedEdge<T> edgeFrom : edgesFrom(secondNode)) {
if (edgeFrom.getTarget().equals(firstNode)) {
graph.get(secondNode).remove(edgeFrom);
}
}
}
public List<T> getAllNodes() {
return orderedNodes;
}
public List<T> getCriticalNodes() {
ArrayList<T> criticalNodes = new ArrayList<T>();
Iterator<T> nodeIter = orderedNodes.iterator();
while (nodeIter.hasNext()) {
T currentNode = nodeIter.next();
if (this.edgesFrom(currentNode).size() == 0) {
criticalNodes.add(currentNode);
}
}
return criticalNodes;
}
public List<T> getOrphanNodes() {
ArrayList<T> orphanedNodes = new ArrayList<T>();
Iterator<T> nodeIter = orderedNodes.iterator();
while (nodeIter.hasNext()) {
T currentNode = nodeIter.next();
if (this.edgesFrom(currentNode).size() == 0 && this.edgesTo(currentNode).size() == 0) {
orphanedNodes.add(currentNode);
}
}
return orphanedNodes;
}
@Override
public Iterator<T> iterator() {
return orderedNodes.iterator();
}
public int size() {
return graph.size();
}
public boolean isEmpty() {
return graph.isEmpty();
}
@Override
public String toString() {
return graph.toString();
}
private static final Logger LOGGER = Logger.getLogger(WeightedDirectedGraph.class.getName());
}

View file

@ -1,55 +0,0 @@
package com.pahimar.ee3.emc.graph;
public class WeightedEdge<T> {
private float weight;
private T target;
public WeightedEdge(float weight, T target) {
this.weight = weight;
this.target = target;
}
public float getWeight() {
return weight;
}
public T getTarget() {
return target;
}
public void setWeight(float weight) {
this.weight = weight;
}
public void setTarget(T target) {
this.target = target;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof WeightedEdge<?>)) {
return false;
}
WeightedEdge<?> edge = (WeightedEdge<?>) object;
return ((this.weight == edge.weight) && (target.equals(edge.target)));
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("Weight: %s, Target: %s ", weight, target));
return stringBuilder.toString();
}
}

View file

@ -1,45 +0,0 @@
package com.pahimar.ee3.event;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.Event;
/**
* Equivalent-Exchange-3
*
* ActionEvent
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ActionEvent extends Event {
public enum ActionResult {
SUCCESS, DEFAULT, FAILURE
}
public final byte actionType;
public ItemStack itemStack;
public final EntityPlayer player;
public final World world;
public final int x, y, z;
public final boolean hasActionOccured;
public final String data;
public ActionResult actionResult;
public ActionEvent(byte actionType, ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, boolean hasActionOccured, String data) {
this.actionType = actionType;
this.itemStack = itemStack;
this.player = player;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.hasActionOccured = hasActionOccured;
this.data = data;
}
}

View file

@ -1,46 +0,0 @@
package com.pahimar.ee3.event;
import static net.minecraftforge.event.Event.Result.DEFAULT;
import static net.minecraftforge.event.Event.Result.DENY;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.entity.player.PlayerEvent;
/**
* Equivalent-Exchange-3
*
* ActionRequestEvent
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@Cancelable
public class ActionRequestEvent extends PlayerEvent {
public final ActionEvent modEvent;
public final int x, y, z;
public final int sideHit;
public Result allowEvent;
public ActionRequestEvent(EntityPlayer player, ActionEvent modEvent, int x, int y, int z, int sideHit) {
super(player);
this.modEvent = modEvent;
this.x = x;
this.y = y;
this.z = z;
this.sideHit = sideHit;
if (sideHit == -1) {
allowEvent = DENY;
}
}
@Override
public void setCanceled(boolean cancel) {
super.setCanceled(cancel);
allowEvent = cancel ? DENY : allowEvent == DENY ? DENY : DEFAULT;
}
}

View file

@ -1,28 +0,0 @@
package com.pahimar.ee3.event;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Equivalent-Exchange-3
*
* WorldTransmutationEvent
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class WorldTransmutationEvent extends ActionEvent {
public int targetID, targetMeta;
public WorldTransmutationEvent(byte actionType, ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, boolean hasActionOccured, String data) {
super(actionType, itemStack, player, world, x, y, z, hasActionOccured, data);
targetID = Integer.parseInt(data.substring(0, data.indexOf(":")));
targetMeta = Integer.parseInt(data.substring(data.indexOf(":") + 1));
actionResult = ActionResult.DEFAULT;
}
}

View file

@ -1,94 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
/**
* Equivalent-Exchange-3
*
* ContainerAlchemicalBag
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerAlchemicalBag extends Container {
private final int BAG_INVENTORY_ROWS = 4;
private final int BAG_INVENTORY_COLUMNS = 13;
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerAlchemicalBag(InventoryPlayer inventoryPlayer) {
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * PLAYER_INVENTORY_COLUMNS + PLAYER_INVENTORY_COLUMNS, 44 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 162));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
if (!player.worldObj.isRemote) {
InventoryPlayer invPlayer = player.inventory;
for (ItemStack itemStack : invPlayer.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
}
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack newItemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack()) {
ItemStack itemStack = slot.getStack();
newItemStack = itemStack.copy();
if (slotIndex < BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS) {
if (!this.mergeItemStack(itemStack, BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS, inventorySlots.size(), false))
return null;
}
else if (!this.mergeItemStack(itemStack, 0, BAG_INVENTORY_ROWS * BAG_INVENTORY_COLUMNS, false))
return null;
if (itemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return newItemStack;
}
}

View file

@ -1,99 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
/**
* Equivalent-Exchange-3
*
* ContainerAlchemicalChest
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerAlchemicalChest extends Container {
private TileAlchemicalChest tileAlchemicalChest;
private final int CHEST_INVENTORY_ROWS = 4;
private final int CHEST_INVENTORY_COLUMNS = 13;
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest) {
this.tileAlchemicalChest = tileAlchemicalChest;
tileAlchemicalChest.openChest();
// Add the Alchemical Chest slots to the container
for (int chestRowIndex = 0; chestRowIndex < CHEST_INVENTORY_ROWS; ++chestRowIndex) {
for (int chestColumnIndex = 0; chestColumnIndex < CHEST_INVENTORY_COLUMNS; ++chestColumnIndex) {
this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * 13, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18));
}
}
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 162));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
/**
* Callback for when the crafting gui is closed.
*/
@Override
public void onContainerClosed(EntityPlayer entityPlayer) {
super.onContainerClosed(entityPlayer);
tileAlchemicalChest.closeChest();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack newItemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack()) {
ItemStack itemStack = slot.getStack();
newItemStack = itemStack.copy();
if (slotIndex < CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS) {
if (!this.mergeItemStack(itemStack, CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS, inventorySlots.size(), false))
return null;
}
else if (!this.mergeItemStack(itemStack, 0, CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS, false))
return null;
if (itemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return newItemStack;
}
}

View file

@ -1,119 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import com.pahimar.ee3.item.ItemAlchemicalDust;
import com.pahimar.ee3.tileentity.TileAludel;
/**
* Equivalent-Exchange-3
*
* ContainerAludel
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerAludel extends Container {
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) {
this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.INPUT_INVENTORY_INDEX, 44, 18));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.DUST_INVENTORY_INDEX, 44, 39));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.OUTPUT_INVENTORY_INDEX, 120, 39));
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 106 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 164));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack()) {
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
/**
* If we are shift-clicking an item out of the Aludel's container,
* attempt to put it in the first available slot in the player's
* inventory
*/
if (slotIndex < TileAludel.INVENTORY_SIZE) {
if (!this.mergeItemStack(slotItemStack, TileAludel.INVENTORY_SIZE, inventorySlots.size(), false)) {
return null;
}
}
else {
/**
* If the stack being shift-clicked into the Aludel's container
* is a fuel, first try to put it in the fuel slot. If it cannot
* be merged into the fuel slot, try to put it in the input
* slot.
*/
if (TileEntityFurnace.isItemFuel(slotItemStack)) {
if (!this.mergeItemStack(slotItemStack, TileAludel.FUEL_INVENTORY_INDEX, TileAludel.INPUT_INVENTORY_INDEX, false)) {
return null;
}
}
/**
* If the stack being shift-clicked into the Aludel's container
* is a dust, first try to put it in the dust slot. If it cannot
* be merged into the dust slot, try to put it in the input
* slot.
*/
else if (slotItemStack.getItem() instanceof ItemAlchemicalDust) {
if (!this.mergeItemStack(slotItemStack, TileAludel.DUST_INVENTORY_INDEX, TileAludel.OUTPUT_INVENTORY_INDEX, false)) {
return null;
}
}
/**
* Finally, attempt to put stack into the input slot
*/
else if (!this.mergeItemStack(slotItemStack, TileAludel.INPUT_INVENTORY_INDEX, TileAludel.DUST_INVENTORY_INDEX, false)) {
return null;
}
}
if (slotItemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -1,108 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import com.pahimar.ee3.tileentity.TileCalcinator;
/**
* Equivalent-Exchange-3
*
* ContainerCalcinator
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerCalcinator extends Container {
public ContainerCalcinator(InventoryPlayer inventoryPlayer, TileCalcinator calcinator) {
// Add the fuel slot to the container
this.addSlotToContainer(new Slot(calcinator, TileCalcinator.FUEL_INVENTORY_INDEX, 56, 62));
// Add the input slot to the container
this.addSlotToContainer(new Slot(calcinator, TileCalcinator.INPUT_INVENTORY_INDEX, 56, 17));
// Add the output results slot to the container
this.addSlotToContainer(new SlotCalcinator(calcinator, TileCalcinator.OUTPUT_INVENTORY_INDEX, 116, 35));
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 94 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 152));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack()) {
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
/**
* If we are shift-clicking an item out of the Aludel's container,
* attempt to put it in the first available slot in the player's
* inventory
*/
if (slotIndex < TileCalcinator.INVENTORY_SIZE) {
if (!this.mergeItemStack(slotItemStack, TileCalcinator.INVENTORY_SIZE, inventorySlots.size(), false)) {
return null;
}
}
else {
/**
* If the stack being shift-clicked into the Aludel's container
* is a fuel, first try to put it in the fuel slot. If it cannot
* be merged into the fuel slot, try to put it in the input
* slot.
*/
if (TileEntityFurnace.isItemFuel(slotItemStack)) {
if (!this.mergeItemStack(slotItemStack, TileCalcinator.FUEL_INVENTORY_INDEX, TileCalcinator.OUTPUT_INVENTORY_INDEX, false)) {
return null;
}
}
/**
* Finally, attempt to put stack into the input slot
*/
else if (!this.mergeItemStack(slotItemStack, TileCalcinator.INPUT_INVENTORY_INDEX, TileCalcinator.OUTPUT_INVENTORY_INDEX, false)) {
return null;
}
}
if (slotItemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -1,80 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.tileentity.TileGlassBell;
/**
* Equivalent-Exchange-3
*
* ContainerGlassBell
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerGlassBell extends Container {
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) {
this.addSlotToContainer(new Slot(tileGlassBell, TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, 80, 22));
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 58 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 116));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack()) {
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
if (slotIndex < TileGlassBell.INVENTORY_SIZE) {
if (!this.mergeItemStack(slotItemStack, 1, inventorySlots.size(), true)) {
return null;
}
}
else {
if (!this.mergeItemStack(slotItemStack, 0, TileGlassBell.INVENTORY_SIZE, false)) {
return null;
}
}
if (slotItemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -1,51 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
/**
* Equivalent-Exchange-3
*
* ContainerPortableCrafting
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerPortableCrafting extends ContainerWorkbench {
public ContainerPortableCrafting(InventoryPlayer inventoryPlayer, World world, int x, int y, int z) {
super(inventoryPlayer, world, x, y, z);
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
if (!player.worldObj.isRemote) {
InventoryPlayer invPlayer = player.inventory;
for (ItemStack itemStack : invPlayer.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN);
}
}
}
}
}
}

View file

@ -1,45 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
/**
* Equivalent-Exchange-3
*
* ContainerPortableTransmutation
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerPortableTransmutation extends Container {
@Override
public boolean canInteractWith(EntityPlayer var1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
if (!player.worldObj.isRemote) {
InventoryPlayer invPlayer = player.inventory;
for (ItemStack itemStack : invPlayer.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
}
}
}
}
}

View file

@ -1,29 +0,0 @@
package com.pahimar.ee3.inventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
*
* SlotCalcinator
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class SlotCalcinator extends Slot {
public SlotCalcinator(IInventory inventory, int x, int y, int z) {
super(inventory, x, y, z);
}
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
return false;
}
}

View file

@ -1,130 +0,0 @@
package com.pahimar.ee3.inventory;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.WorldSavedData;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* WorldSavedDataEE
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class WorldSavedDataEE extends WorldSavedData implements IInventory {
public UUID uuid;
public ItemStack[] inventory;
private final int INVENTORY_SIZE = 13 * 4;
public WorldSavedDataEE(String filePath) {
super(filePath);
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public void readFromNBT(NBTTagCompound var1) {
// TODO Auto-generated method stub
}
@Override
public void writeToNBT(NBTTagCompound var1) {
// TODO Auto-generated method stub
}
@Override
public int getSizeInventory() {
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inventory[slot];
}
@Override
public ItemStack decrStackSize(int var1, int var2) {
// TODO Auto-generated method stub
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setInventorySlotContents(int var1, ItemStack var2) {
// TODO Auto-generated method stub
}
@Override
public String getInvName() {
return "worldsaveddata" + "." + Strings.ALCHEMICAL_BAG_NAME;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public void onInventoryChanged() {
// TODO Auto-generated method stub
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public boolean isInvNameLocalized() {
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return false;
}
}

View file

@ -1,290 +0,0 @@
package com.pahimar.ee3.item;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import com.pahimar.ee3.core.util.EnergyStack;
import com.pahimar.ee3.core.util.ItemUtil;
import com.pahimar.ee3.core.util.OreStack;
import com.pahimar.ee3.lib.Reference;
public class CustomWrappedStack {
private int stackSize;
private ItemStack itemStack;
private OreStack oreStack;
private EnergyStack energyStack;
/**
* Creates a new CustomWrappedStack object which wraps the given input.
* Valid inputs would be ItemStacks or OreStacks. If something other than an
* ItemStack or an OreStack is used as input, nothing is wrapped and the
* size of the wrapped stack is set to -1 to indicate an invalid wrapped
* stack.
*
* @param object
* The newly created wrapped stack object
*/
public CustomWrappedStack(Object object) {
/*
* If we are given an Item or a Block, convert it to an ItemStack for further inspection
*/
if (object instanceof Item) {
object = new ItemStack((Item) object);
}
else if (object instanceof Block) {
object = new ItemStack((Block) object);
}
/*
* We are given an ItemStack to wrap
*/
if (object instanceof ItemStack) {
ItemStack itemStack = (ItemStack) object;
/*
* If the ItemStack does not exist in the OreDictionary, wrap it as
* an ItemStack
*/
if (OreDictionary.getOreID(itemStack) == Reference.ORE_DICTIONARY_NOT_FOUND) {
this.itemStack = itemStack.copy();
oreStack = null;
energyStack = null;
stackSize = this.itemStack.stackSize;
this.itemStack.stackSize = 1;
}
/*
* Else the ItemStack exists in the OreDictionary, so wrap it as an
* OreStack instead of an ItemStack
*/
else {
this.itemStack = null;
oreStack = new OreStack(itemStack);
energyStack = null;
stackSize = oreStack.stackSize;
oreStack.stackSize = 1;
}
}
/*
* Or we are given an OreStack to wrap
*/
else if (object instanceof OreStack) {
itemStack = null;
oreStack = (OreStack) object;
energyStack = null;
stackSize = oreStack.stackSize;
oreStack.stackSize = 1;
}
else if (object instanceof ArrayList) {
itemStack = null;
ArrayList<?> objectList = (ArrayList<?>) object;
if (!objectList.isEmpty()) {
for (Object listElement : objectList) {
if (listElement instanceof ItemStack) {
ItemStack stack = (ItemStack) listElement;
if (OreDictionary.getOreID(stack) != Reference.ORE_DICTIONARY_NOT_FOUND) {
oreStack = new OreStack(stack);
stackSize = oreStack.stackSize;
oreStack.stackSize = 1;
break;
}
}
}
}
energyStack = null;
}
/*
* Or we are given an EnergyStack to wrap
*/
else if (object instanceof EnergyStack) {
itemStack = null;
oreStack = null;
energyStack = (EnergyStack) object;
stackSize = energyStack.stackSize;
energyStack.stackSize = 1;
}
else if (object instanceof CustomWrappedStack) {
CustomWrappedStack wrappedStack = (CustomWrappedStack) object;
itemStack = wrappedStack.itemStack;
oreStack = wrappedStack.oreStack;
energyStack = wrappedStack.energyStack;
stackSize = wrappedStack.stackSize;
}
/*
* Else, we are given something we cannot wrap
*/
else {
stackSize = -1;
}
}
/**
* Returns the stack size of the wrapped stack, or -1 if we wrapped an
* invalid input
*
* @return The size of the wrapped stack
*/
public int getStackSize() {
return stackSize;
}
/**
* Sets the size of the wrapped stack
*
* @param stackSize
* The new size of the wrapped stack
*/
public void setStackSize(int stackSize) {
this.stackSize = stackSize;
}
/**
* Returns the wrapped stack
*
* @return The wrapped ItemStack, OreStack, or EnergyStack, or null if
* something other than an ItemStack, OreStack, or EnergyStack was
* used to create this object
*/
public Object getWrappedStack() {
if (itemStack != null) {
return itemStack;
}
else if (oreStack != null) {
return oreStack;
}
else if (energyStack != null) {
return energyStack;
}
return null;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof CustomWrappedStack))
return false;
CustomWrappedStack customWrappedStack = (CustomWrappedStack) object;
if (itemStack != null) {
if (customWrappedStack.itemStack != null)
return ItemUtil.compare(itemStack, customWrappedStack.itemStack) && stackSize == customWrappedStack.itemStack.stackSize;
else if (customWrappedStack.oreStack != null) {
for (ItemStack oreDictItemStack : OreDictionary.getOres(customWrappedStack.oreStack.oreName)) {
if (ItemUtil.compare(itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize)
return true;
}
}
}
else if (oreStack != null) {
if (customWrappedStack.itemStack != null) {
for (ItemStack oreDictItemStack : OreDictionary.getOres(oreStack.oreName)) {
if (ItemUtil.compare(customWrappedStack.itemStack, oreDictItemStack) && stackSize == customWrappedStack.stackSize)
return true;
}
}
else if (customWrappedStack.oreStack != null)
return oreStack.oreName.equalsIgnoreCase(customWrappedStack.oreStack.oreName) && stackSize == customWrappedStack.stackSize;
}
else if (energyStack != null) {
if (customWrappedStack.energyStack != null) {
return energyStack.energyName.equalsIgnoreCase(customWrappedStack.energyStack.energyName) && stackSize == customWrappedStack.stackSize;
}
}
return false;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
if (itemStack != null) {
stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName()));
}
else if (oreStack != null) {
stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName));
}
else if (energyStack != null) {
stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName));
}
else {
stringBuilder.append("null");
}
return stringBuilder.toString();
}
public String encodeAsPropertyKey() {
StringBuilder stringBuilder = new StringBuilder();
if (itemStack != null) {
stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", this.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getItemName(), itemStack.getItem().getClass().getCanonicalName()));
}
else if (oreStack != null) {
stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName));
}
else if (energyStack != null) {
stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName));
}
return stringBuilder.toString();
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 37 * hashCode + stackSize;
if (itemStack != null) {
hashCode = 37 * hashCode + itemStack.itemID;
if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
hashCode = 37 * hashCode;
}
else {
hashCode = 37 * hashCode + itemStack.getItemDamage();
}
try {
hashCode = 37 * hashCode + itemStack.getItemName().hashCode();
} catch (ArrayIndexOutOfBoundsException e) {
}
}
else if (oreStack != null) {
hashCode = 37 * hashCode + oreStack.oreName.hashCode();
}
else if (energyStack != null) {
hashCode = 37 * hashCode + energyStack.energyName.hashCode();
}
return hashCode;
}
public static boolean canBeWrapped(Object object) {
return (object instanceof CustomWrappedStack || object instanceof ItemStack || object instanceof OreStack || object instanceof EnergyStack || object instanceof Item || object instanceof Block);
}
}

View file

@ -1,24 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
*
* IChargeable
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface IChargeable {
public abstract short getCharge(ItemStack stack);
public abstract void setCharge(ItemStack stack, short charge);
public abstract void increaseCharge(ItemStack stack);
public abstract void decreaseCharge(ItemStack stack);
}

View file

@ -1,19 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
*
* IKeyBound
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface IKeyBound {
public abstract void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding);
}

View file

@ -1,24 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Equivalent-Exchange-3
*
* ITransmutationStone
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public interface ITransmutationStone {
public abstract void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack);
public abstract void openPortableTransmutationGUI(EntityPlayer thePlayer, ItemStack itemStack);
public abstract void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit);
}

View file

@ -1,154 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.core.util.ItemUtil;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemAlchemicalBag
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemAlchemicalBag extends ItemEE {
private static final String[] ALCHEMICAL_BAG_SUBTYPES = new String[] { "Open", "OpenDrawString", "Closed", "ClosedDrawString" };
@SideOnly(Side.CLIENT)
private Icon[] icons;
public ItemAlchemicalBag(int id) {
super(id);
this.setUnlocalizedName(Strings.ALCHEMICAL_BAG_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[ALCHEMICAL_BAG_SUBTYPES.length];
for (int i = 0; i < ALCHEMICAL_BAG_SUBTYPES.length; ++i) {
icons[i] = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + Strings.ALCHEMICAL_BAG_NAME + ALCHEMICAL_BAG_SUBTYPES[i]);
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (!world.isRemote) {
NBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN, true);
entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_BAG, entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
}
return itemStack;
}
@Override
public boolean getShareTag() {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public Icon getIcon(ItemStack itemStack, int renderPass) {
// If the bag is open
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
if (renderPass != 1)
return icons[0];
else
return icons[1];
}
// Else, the bag is closed
else {
if (renderPass != 1)
return icons[2];
else
return icons[3];
}
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int renderPass) {
if (renderPass == 1)
return Integer.parseInt(Colours.PURE_WHITE, 16);
else {
int bagColor = this.getColor(itemStack);
if (bagColor < 0) {
bagColor = Integer.parseInt(Colours.PURE_WHITE, 16);
}
return bagColor;
}
}
public boolean hasColor(ItemStack itemStack) {
return ItemUtil.hasColor(itemStack);
}
public int getColor(ItemStack itemStack) {
return ItemUtil.getColor(itemStack);
}
public void setColor(ItemStack itemStack, int color) {
if (itemStack != null) {
if (!(itemStack.getItem() instanceof ItemAlchemicalBag))
// TODO Localize
throw new UnsupportedOperationException("Can\'t dye non-bags!");
else {
ItemUtil.setColor(itemStack, color);
}
}
}
public void removeColor(ItemStack itemStack) {
if (itemStack != null) {
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
if (nbtTagCompound != null) {
NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY);
if (displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR)) {
displayTagCompound.removeTag(Strings.NBT_ITEM_COLOR);
}
}
}
}
}

View file

@ -1,117 +0,0 @@
package com.pahimar.ee3.item;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemAlchemicalDust
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemAlchemicalDust extends ItemEE {
private static final String[] ALCHEMICAL_DUST_NAMES = new String[] { "Ash", "Minium", "Verdant", "Azure", "Amaranthine", "Iridescent" };
@SideOnly(Side.CLIENT)
private Icon[] icons;
public ItemAlchemicalDust(int id) {
super(id);
this.setHasSubtypes(true);
this.setUnlocalizedName(Strings.ALCHEMICAL_DUST_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
maxStackSize = 64;
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + ALCHEMICAL_DUST_NAMES[meta];
}
@Override
@SideOnly(Side.CLIENT)
/**
* Gets an icon index based on an item's damage value
*/
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, 5);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[ALCHEMICAL_DUST_NAMES.length];
for (int i = 0; i < ALCHEMICAL_DUST_NAMES.length; ++i) {
icons[i] = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + Strings.ALCHEMICAL_DUST_NAME + ALCHEMICAL_DUST_NAMES[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack) {
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 5);
if (meta == 5)
return true;
else
return false;
}
@Override
public String getItemDisplayName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
switch (meta) {
case 0:
return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
case 1:
return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
case 2:
return EnumChatFormatting.GREEN + super.getItemDisplayName(itemStack);
case 3:
return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack);
case 4:
return EnumChatFormatting.DARK_PURPLE + super.getItemDisplayName(itemStack);
case 5:
return EnumChatFormatting.GOLD + super.getItemDisplayName(itemStack);
default:
return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
}
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs creativeTab, List list) {
for (int meta = 0; meta < 6; ++meta) {
list.add(new ItemStack(id, 1, meta));
}
}
}

View file

@ -1,35 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import com.pahimar.ee3.lib.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemEE
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemEE extends Item {
public ItemEE(int id) {
super(id - Reference.SHIFTED_ID_RANGE_CORRECTION);
maxStackSize = 1;
setNoRepair();
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
}
}

View file

@ -1,23 +0,0 @@
package com.pahimar.ee3.item;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* ItemInertStone
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemInertStone extends ItemEE {
public ItemInertStone(int id) {
super(id);
this.setUnlocalizedName(Strings.INERT_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
}

View file

@ -1,24 +0,0 @@
package com.pahimar.ee3.item;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.Strings;
/**
* Equivalent-Exchange-3
*
* ItemMiniumShard
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemMiniumShard extends ItemEE {
public ItemMiniumShard(int id) {
super(id);
this.setUnlocalizedName(Strings.MINIUM_SHARD_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
maxStackSize = 64;
}
}

View file

@ -1,129 +0,0 @@
package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.util.TransmutationHelper;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.nbt.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemMiniumStone
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemMiniumStone extends ItemEE
implements ITransmutationStone, IKeyBound {
public ItemMiniumStone(int id) {
super(id);
this.setUnlocalizedName(Strings.MINIUM_STONE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setMaxDamage(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY - 1);
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack itemStack) {
return NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
@Override
public String getItemDisplayName(ItemStack itemStack) {
return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack);
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) {
return false;
}
@Override
public boolean getShareTag() {
return true;
}
@Override
public ItemStack getContainerItemStack(ItemStack itemStack) {
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + 1);
// Hacky hacky hack hack
copiedStack.stackSize = 1;
return copiedStack;
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) {
if (world.isRemote) {
transmuteBlock(itemStack, entityPlayer, world, x, y, z, sideHit);
}
return true;
}
@Override
public void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack) {
NBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN, true);
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void openPortableTransmutationGUI(EntityPlayer thePlayer, ItemStack itemStack) {
NBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN, true);
thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_TRANSMUTATION, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ);
}
@Override
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) {
EquivalentExchange3.proxy.transmuteBlock(itemStack, player, world, x, y, z, sideHit);
}
@Override
public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) {
if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) {
if (!thePlayer.isSneaking()) {
openPortableCraftingGUI(thePlayer, itemStack);
}
else {
openPortableTransmutationGUI(thePlayer, itemStack);
}
}
else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_TOGGLE)) {
if (TransmutationHelper.targetBlockStack != null) {
if (!thePlayer.isSneaking()) {
TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage());
}
else {
TransmutationHelper.targetBlockStack = TransmutationHelper.getPreviousBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage());
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show more