991 files modified. GG ME. Still not done though

This is the first commit of the rewrite. A lot has been done, but it's
not over.
This commit is contained in:
Tombenpotter committed 2014-09-27 22:54:43 +02:00
1 parent 621fb17840
commit 766aa180ae
569 files changed
+4065 -6321

No files matched your search

+19 -12
View File
@@ -1,33 +1,40 @@
package baubles.api;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import java.lang.reflect.Method;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import cpw.mods.fml.common.FMLLog;
/**
* @author Azanor
*/
public class BaublesApi {
public class BaublesApi
{
static Method getBaubles;
/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player) {
public static IInventory getBaubles(EntityPlayer player)
{
IInventory ot = null;
try {
if(getBaubles == null) {
Class fake = Class.forName("baubles.common.lib.PlayerHandler");
try
{
if(getBaubles == null)
{
Class<?> fake = Class.forName("baubles.common.lib.PlayerHandler");
getBaubles = fake.getMethod("getPlayerBaubles", EntityPlayer.class);
}
ot = (IInventory) getBaubles.invoke(null, player);
} catch(Exception ex) {
}
catch(Exception ex)
{
FMLLog.warning("[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}
return ot;
}
+1 -1
View File
@@ -1,3 +1,3 @@
@API(apiVersion = "1.0.0.16", owner = "Baubles", provides = "Baubles|API")
@API(apiVersion = "1.7.10-1.0.1.5", owner = "Baubles", provides = "Baubles|API")
package baubles.api;
import cpw.mods.fml.common.API;
@@ -1,147 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.client;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraftforge.client.event.RenderPlayerEvent;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
public class CapeEventHandler {
private final String serverLocation = "https://raw.github.com/Tombenpotter/Electro-Magic-Tools/master/capes.txt";
private final int timeout = 1000;
private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics();
private HashMap<String, String> cloaks = new HashMap<String, String>();
private ArrayList<AbstractClientPlayer> capePlayers = new ArrayList<AbstractClientPlayer>();
public static CapeEventHandler instance;
public CapeEventHandler() {
buildCloakURLDatabase();
instance = this;
}
@SubscribeEvent
public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) {
if (Loader.isModLoaded("shadersmod")) {
return;
}
if (event.entityPlayer instanceof AbstractClientPlayer) {
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer;
if (!capePlayers.contains(abstractClientPlayer)) {
String cloakURL = cloaks.get(event.entityPlayer.getCommandSenderName());
if (cloakURL == null) {
return;
}
capePlayers.add(abstractClientPlayer);
ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), false, new String[]{"textureUploaded", "field_110559_g"});
new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
event.renderCape = true;
}
}
}
public void buildCloakURLDatabase() {
URL url;
try {
url = new URL(serverLocation);
URLConnection con = url.openConnection();
con.setConnectTimeout(timeout);
con.setReadTimeout(timeout);
InputStream io = con.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(io));
String str;
int linetracker = 1;
while ((str = br.readLine()) != null) {
if (!str.startsWith("--")) {
if (str.contains(":")) {
String nick = str.substring(0, str.indexOf(":"));
String link = str.substring(str.indexOf(":") + 1);
new Thread(new CloakPreload(link)).start();
cloaks.put(nick, link);
} else {
System.err.println("[Electro-Magic Tools] [skins.txt] Syntax error on line " + linetracker + ": " + str);
}
}
linetracker++;
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private class CloakThread implements Runnable {
AbstractClientPlayer abstractClientPlayer;
String cloakURL;
public CloakThread(AbstractClientPlayer player, String cloak) {
abstractClientPlayer = player;
cloakURL = cloak;
}
@Override
public void run() {
try {
Image cape = new ImageIcon(new URL(cloakURL)).getImage();
BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
bo.getGraphics().drawImage(cape, 0, 0, null);
ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), bo, new String[]{"bufferedImage", "field_110560_d"});
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
private class CloakPreload implements Runnable {
String cloakURL;
public CloakPreload(String link) {
cloakURL = link;
}
@Override
public void run() {
try {
TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
}
@@ -1,49 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common;
import cpw.mods.fml.common.registry.GameRegistry;
public class TileEntityRegistry {
public static void registerEMTTileEntites() {
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPotentiaGenerator.class, "tileentityessentiagenerator");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIgnisGenerator.class, "tileentityignisgenerator");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityAuramGenerator.class, "tileentityauramgenerator");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityArborGenerator.class, "tileentityarborgenerator");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge.class, "tileentityindustrialwandrecharge");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityCompressedSolar.class, "tileentitycompressedsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleCompressedSolar.class, "tileentitydoublecompressedsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleCompressedSolar.class, "tileentitytriplecompressedsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator.class, "tileentityetherealmacerator");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityWaterSolar.class, "tileentitywatersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleWaterSolar.class, "tileentitydoublewatersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleWaterSolar.class, "tileentitytriplewatersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDarkSolar.class, "tileentitydarksolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleDarkSolar.class, "tileentitydoubledarksolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleDarkSolar.class, "tileentitytripledarksolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityOrderSolar.class, "tileentityordersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleOrderSolar.class, "tileentitydoubleordersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleOrderSolar.class, "tileentitytripleordersolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityFireSolar.class, "tileentityfiresolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleFireSolar.class, "tileentitydoublefiresolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleFireSolar.class, "tileentitytriplefiresolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityAirSolar.class, "tileentityairsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleAirSolar.class, "tileentitydoubleairsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleAirSolar.class, "tileentitytripleairsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityEarthSolar.class, "tileentityearthsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityDoubleEarthSolar.class, "tileentitydoubleearthsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.TileEntityTripleEarthSolar.class, "tileentitytripleearthsolar");
GameRegistry.registerTileEntity(electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityPortableNode.class, "tileentityportablenode");
}
}
@@ -1,176 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.List;
public class BlockEMTSolars extends BlockEMT {
public BlockEMTSolars() {
super(Material.iron);
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setHardness(4.0F);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ri) {
this.top[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/solartop");
this.top[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/doublesolartop");
this.top[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/triplesolartop");
this.top[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/solartop");
this.top[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/doublesolartop");
this.top[5] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/triplesolartop");
this.top[6] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/solartop");
this.top[7] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/doublesolartop");
this.top[8] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/triplesolartop");
this.top[9] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/solartop");
this.top[10] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/doublesolartop");
this.top[11] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/triplesolartop");
this.top[12] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/solartop");
this.top[13] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/doublesolartop");
this.top[14] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/triplesolartop");
this.top[15] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/solartop");
this.bottom[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/bottom");
this.bottom[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/bottom");
this.bottom[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/bottom");
this.bottom[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterbottom");
this.bottom[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterbottom");
this.bottom[5] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterbottom");
this.bottom[6] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkbottom");
this.bottom[7] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkbottom");
this.bottom[8] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkbottom");
this.bottom[9] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderbottom");
this.bottom[10] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderbottom");
this.bottom[11] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderbottom");
this.bottom[12] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/firebottom");
this.bottom[13] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/firebottom");
this.bottom[14] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/firebottom");
this.bottom[15] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airbottom");
this.frontOff[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.frontOff[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.frontOff[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.frontOff[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.frontOff[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.frontOff[5] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.frontOff[6] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.frontOff[7] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.frontOff[8] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.frontOff[9] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.frontOff[10] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.frontOff[11] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.frontOff[12] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.frontOff[13] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.frontOff[14] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.frontOff[15] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
this.side[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.side[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.side[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/side");
this.side[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.side[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.side[5] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/water/waterside");
this.side[6] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.side[7] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.side[8] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/dark/darkside");
this.side[9] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.side[10] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.side[11] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/order/orderside");
this.side[12] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.side[13] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.side[14] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/fire/fireside");
this.side[15] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
}
@SideOnly(Side.CLIENT)
@SuppressWarnings({"unchecked", "rawtypes"})
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
for (int i = 0; i <= 15; i++) {
list.add(new ItemStack(id, 1, i));
}
}
@Override
public TileEntity createTileEntity(World world, int meta) {
if (meta == 0) {
return new TileEntityCompressedSolar();
}
if (meta == 1) {
return new TileEntityDoubleCompressedSolar();
}
if (meta == 2) {
return new TileEntityTripleCompressedSolar();
}
if (meta == 3) {
return new TileEntityWaterSolar();
}
if (meta == 4) {
return new TileEntityDoubleWaterSolar();
}
if (meta == 5) {
return new TileEntityTripleWaterSolar();
}
if (meta == 6) {
return new TileEntityDarkSolar();
}
if (meta == 7) {
return new TileEntityDoubleDarkSolar();
}
if (meta == 8) {
return new TileEntityTripleDarkSolar();
}
if (meta == 9) {
return new TileEntityOrderSolar();
}
if (meta == 10) {
return new TileEntityDoubleOrderSolar();
}
if (meta == 11) {
return new TileEntityTripleOrderSolar();
}
if (meta == 12) {
return new TileEntityFireSolar();
}
if (meta == 13) {
return new TileEntityDoubleFireSolar();
}
if (meta == 14) {
return new TileEntityTripleFireSolar();
}
if (meta == 15) {
return new TileEntityAirSolar();
}
return super.createTileEntity(world, meta);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
world.removeTileEntity(x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
}
@@ -1,99 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.solars.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.List;
public class BlockEMTSolars2 extends BlockEMT {
public BlockEMTSolars2() {
super(Material.iron);
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setHardness(4.0F);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ri) {
this.top[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/doublesolartop");
this.top[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/triplesolartop");
this.top[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/solartop");
this.top[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/doublesolartop");
this.top[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/triplesolartop");
this.bottom[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airbottom");
this.bottom[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airbottom");
this.bottom[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthbottom");
this.bottom[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthbottom");
this.bottom[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthbottom");
this.frontOff[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
this.frontOff[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
this.frontOff[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
this.frontOff[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
this.frontOff[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
this.side[0] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
this.side[1] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/air/airside");
this.side[2] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
this.side[3] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
this.side[4] = ri.registerIcon(ElectricMagicTools.texturePath + ":solars/earth/earthside");
}
@SideOnly(Side.CLIENT)
@SuppressWarnings({"unchecked", "rawtypes"})
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
for (int i = 0; i <= 4; i++) {
list.add(new ItemStack(id, 1, i));
}
}
@Override
public TileEntity createTileEntity(World world, int meta) {
if (meta == 0) {
return new TileEntityDoubleAirSolar();
}
if (meta == 1) {
return new TileEntityTripleAirSolar();
}
if (meta == 2) {
return new TileEntityEarthSolar();
}
if (meta == 3) {
return new TileEntityDoubleEarthSolar();
}
if (meta == 4) {
return new TileEntityTripleEarthSolar();
}
return super.createTileEntity(world, meta);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
world.removeTileEntity(x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
}
@@ -1,103 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
*
* Attention: this class originally belongs to the ThaumicTinkerer mod.
* All I did was modifying it to fulfill my needs.
*
* ThaumicTinkerer is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* http://www.minecraftforum.net/topic/1813058-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.armor.boots;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import thaumcraft.api.aspects.Aspect;
import java.util.List;
public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller {
public int maxCharge = 500000;
public ItemNanoBootsTraveller(int par3, int par4) {
super(par3, par4);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":nanobootstravel");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return ElectricMagicTools.texturePath + ":textures/models/nanobootstravel.png";
}
@Override
public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {
return 4;
}
@Override
void tickPlayer(EntityPlayer player) {
if (player.worldObj.isRemote)
player.stepHeight = player.isSneaking() ? 0.5F : 1F;
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
player.moveFlying(0F, 1F, (float) (player.capabilities.isFlying ? 0.075F : Config.nanoBootsSpeed));
player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F;
player.fallDistance = 0F;
}
@SubscribeEvent
@Override
public void onPlayerJump(LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
if (hasArmor) {
player.motionY += Config.nanoBootsJump;
}
}
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 1000;
}
public int getEnergyPerDamage() {
return 200;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
list.add("Vis discount: 4%");
}
}
@@ -1,103 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
*
* Attention: this class originally belongs to the ThaumicTinkerer mod.
* All I did was modifying it to fulfill my needs.
*
* ThaumicTinkerer is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* http://www.minecraftforum.net/topic/1813058-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.armor.boots;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import thaumcraft.api.aspects.Aspect;
import java.util.List;
public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller {
public int maxCharge = 1000000;
public ItemQuantumBootsTraveller(int par3, int par4) {
super(par3, par4);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":quantumbootstravel");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return ElectricMagicTools.texturePath + ":textures/models/quantumbootstravel.png";
}
@Override
public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {
return 5;
}
@Override
void tickPlayer(EntityPlayer player) {
if (player.worldObj.isRemote)
player.stepHeight = player.isSneaking() ? 0.5F : 1F;
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
player.moveFlying(0F, 1F, (float) (player.capabilities.isFlying ? 0.075F : Config.quantumBootsSpeed));
player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F;
player.fallDistance = 0F;
}
@SubscribeEvent
@Override
public void onPlayerJump(LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
if (hasArmor) {
player.motionY += Config.quantumBootsJump;
}
}
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 1000;
}
public int getEnergyPerDamage() {
return 200;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
list.add("Vis discount: 5%");
}
}
@@ -1,73 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.armor.goggles;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import thaumcraft.api.aspects.Aspect;
import java.util.List;
public class ItemElectricGoggles extends ItemQuantumThaumicHelmet {
public int maxCharge = 10000;
public ItemElectricGoggles(int par3, int par4) {
super(par3, par4);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":electricgoggles");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return ElectricMagicTools.texturePath + ":textures/models/electricgoggles.png";
}
@Override
public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {
return 5;
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
public int getEnergyPerDamage() {
return 100;
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 10;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
list.add("Vis discount: 5%");
}
}
@@ -1,246 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.armor.goggles;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IMetalArmor;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import thaumcraft.api.IGoggles;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.nodes.IRevealer;
import java.util.*;
public class ItemQuantumThaumicHelmet extends ItemArmor implements IElectricItem, IVisDiscountGear, IGoggles, IRevealer, IMetalArmor, ISpecialArmor {
@SuppressWarnings({"unchecked", "rawtypes"})
private static final Map<Integer, Integer> potionCost = new HashMap();
public ItemQuantumThaumicHelmet(int par3, int par4) {
super(ArmorMaterial.DIAMOND, par3, par4);
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setMaxDamage(27);
this.setMaxStackSize(1);
potionCost.put(Integer.valueOf(Potion.poison.id), Integer.valueOf(10000));
potionCost.put(Integer.valueOf(Potion.wither.id), Integer.valueOf(15000));
potionCost.put(Integer.valueOf(Potion.confusion.id), Integer.valueOf(5000));
}
public int maxCharge = 10000000;
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":quantumthaumichelmet");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return ElectricMagicTools.texturePath + ":textures/models/thaumicquantumhelmet.png";
}
@Override
public boolean canProvideEnergy(ItemStack itemStack) {
return false;
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTier(ItemStack itemStack) {
return 2;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
int refill = player.getAir();
if (ElectricItem.manager.canUse(itemStack, 1000) && refill < 100) {
player.setAir(refill + 200);
ElectricItem.manager.use(itemStack, 1000, null);
}
Iterator i$ = (new LinkedList(player.getActivePotionEffects())).iterator();
do {
if (!i$.hasNext()) {
break;
}
{
PotionEffect effect = (PotionEffect) i$.next();
int id = effect.getPotionID();
Integer cost = (Integer) potionCost.get(Integer.valueOf(id));
if (cost != null) {
cost = Integer.valueOf(cost.intValue() * (effect.getAmplifier() + 1));
if (ElectricItem.manager.canUse(itemStack, cost.intValue())) {
ElectricItem.manager.use(itemStack, cost.intValue(), null);
ItemStack milk = (new ItemStack(Items.milk_bucket));
player.curePotionEffects(milk);
}
}
}
} while (true);
if (Config.nightVisionOff == false) {
if (ElectricItem.manager.canUse(itemStack, 1 / 1000)) {
int x = MathHelper.floor_double(player.posX);
int z = MathHelper.floor_double(player.posZ);
int y = MathHelper.floor_double(player.posY);
int lightlevel = player.worldObj.getBlockLightValue(x, y, z);
if (lightlevel >= 0)
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, -3));
ElectricItem.manager.use(itemStack, 1 / 1000, player);
} else {
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 0, true));
}
}
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 10000;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged);
}
if (getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
@Override
public boolean isRepairable() {
return false;
}
@Override
public int getItemEnchantability() {
if (Config.enchanting == false) {
return 0;
} else {
return 4;
}
}
@Override
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) {
if (Config.enchanting == false) {
return false;
} else {
return true;
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
list.add("Vis discount: 8%");
}
@Override
public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {
return 8;
}
@Override
public boolean showNodes(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@Override
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@Override
public boolean isMetalArmor(ItemStack itemstack, EntityPlayer player) {
return true;
}
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
if (source.isUnblockable()) {
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 0);
} else {
double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
int energyPerDamage = getEnergyPerDamage();
int damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage;
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, absorptionRatio, damageLimit);
}
}
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) {
return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio());
} else {
return 0;
}
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false);
}
public double getDamageAbsorptionRatio() {
return 1.1000000000000001D;
}
public int getEnergyPerDamage() {
return 10000;
}
private double getBaseAbsorptionRatio() {
return 0.14999999999999999D;
}
@Override
public Item getChargedItem(ItemStack itemStack) {
return this;
}
@Override
public Item getEmptyItem(ItemStack itemStack) {
return this;
}
}
@@ -1,107 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.tools;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import ic2.api.item.ElectricItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.List;
public class ItemDiamondChainsaw extends ItemThaumiumChainsaw {
public int maxCharge = 40000;
private final int cost = 200;
private final int hitCost = 300;
public ItemDiamondChainsaw() {
super();
this.efficiencyOnProperMaterial = 16F;
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setMaxDamage(27);
this.setMaxStackSize(1);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":diamondchainsaw");
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 300;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
ElectricItem.manager.use(stack, cost, entityLiving);
return true;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack) {
return Items.diamond_axe.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack);
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!ElectricItem.manager.canUse(stack, cost)) {
return 1.0F;
}
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F) {
return efficiencyOnProperMaterial;
} else {
return super.getDigSpeed(stack, block, meta);
}
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F);
}
return false;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged);
}
if (getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.tools;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import ic2.api.item.ElectricItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.List;
public class ItemOmnitoolDiamond extends ItemOmnitoolIron {
public int maxCharge = 70000;
private int cost;
private final int hitCost = 250;
public ItemOmnitoolDiamond() {
super();
this.efficiencyOnProperMaterial = 16F;
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setMaxStackSize(1);
if (Config.toolsInBore == false) {
this.setMaxDamage(27);
} else {
this.setMaxDamage(350);
}
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":diamondomnitool");
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 400;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
if (Config.toolsInBore == false) {
cost = 200;
} else {
cost = 1;
}
ElectricItem.manager.use(stack, cost, entityLiving);
return true;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack) {
return Items.diamond_axe.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack) || Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack) || Items.shears.canHarvestBlock(block, stack);
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!ElectricItem.manager.canUse(stack, cost)) {
return 1.0F;
}
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F || Items.shears.getDigSpeed(stack, block, meta) > 1.0F) {
return efficiencyOnProperMaterial;
} else {
return super.getDigSpeed(stack, block, meta);
}
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 10F);
}
return false;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged);
}
if (getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.tools;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import ic2.api.item.ElectricItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.List;
public class ItemOmnitoolThaumium extends ItemOmnitoolDiamond {
public int maxCharge = 140000;
private int cost;
private final int hitCost = 650;
public ItemOmnitoolThaumium() {
super();
this.efficiencyOnProperMaterial = 21F;
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setMaxStackSize(1);
if (Config.toolsInBore == false) {
this.setMaxDamage(27);
} else {
this.setMaxDamage(467);
}
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":thaumiumomnitool");
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 800;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
if (Config.toolsInBore == false) {
cost = 300;
} else {
cost = 1;
}
ElectricItem.manager.use(stack, cost, entityLiving);
return true;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack) {
return Items.diamond_axe.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack) || Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack) || Items.shears.canHarvestBlock(block, stack);
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!ElectricItem.manager.canUse(stack, cost)) {
return 1.0F;
}
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F || Items.shears.getDigSpeed(stack, block, meta) > 1.0F) {
return efficiencyOnProperMaterial;
} else {
return super.getDigSpeed(stack, block, meta);
}
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 10F);
}
return false;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged);
}
if (getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
}
@@ -1,200 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
*
* This class originally belongs to Azanor, but with his permission I took it, and modified it to make it work as I wanted to.
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.items.tools;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.CreativeTab;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.lib.Utils;
import thaumcraft.common.lib.network.fx.PacketFXBlockBubble;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class ItemStreamChainsaw extends ItemAxe implements IElectricItem {
boolean alternateServer;
boolean alternateClient;
@SuppressWarnings("rawtypes")
public static ArrayList oreDictLogs = new ArrayList();
public int maxCharge = 900000;
private final int cost = 400;
private final int hitCost = 500;
public ItemStreamChainsaw() {
super(ToolMaterial.EMERALD);
this.efficiencyOnProperMaterial = 25F;
alternateServer = false;
alternateClient = false;
setCreativeTab(CreativeTab.tabTombenpotter);
this.maxStackSize = 1;
this.setMaxDamage(27);
}
public EnumAction getItemUseAction(ItemStack itemstack) {
return EnumAction.bow;
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
Block bi = world.getBlock(x, y, z);
if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
if (!world.isRemote) {
if (Utils.breakFurthestBlock(world, x, y, z, bi, player)) {
world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
ElectricItem.manager.use(itemstack, cost, player);
this.alternateServer = (!this.alternateServer);
}
} else {
player.swingItem();
ElectricItem.manager.use(itemstack, cost, player);
this.alternateClient = (!this.alternateClient);
}
}
return super.onItemUse(itemstack, player, world, x, y, z, par7, par8, par9, par10);
}
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
World world = player.worldObj;
Block bi = world.getBlock(x, y, z);
if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
if (!world.isRemote) {
Utils.breakFurthestBlock(world, x, y, z, bi, player);
Thaumcraft.packetPipeline.sendToAllAround(new PacketFXBlockBubble(x, y, z, new Color(0.33F, 0.33F, 1.0F).getRGB()), new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D));
world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
}
ElectricItem.manager.use(itemstack, cost, player);
return true;
}
return super.onBlockStartBreak(itemstack, x, y, z, player);
}
@Override
public boolean canProvideEnergy(ItemStack itemStack) {
return false;
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTier(ItemStack itemStack) {
return 3;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 900;
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(ElectricMagicTools.texturePath + ":streamchainsaw");
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged);
}
if (getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack) {
return Items.diamond_axe.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack);
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!ElectricItem.manager.canUse(stack, cost)) {
return 1.0F;
}
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F) {
return efficiencyOnProperMaterial;
} else {
return super.getDigSpeed(stack, block, meta);
}
}
@Override
public boolean isRepairable() {
return false;
}
@Override
public int getItemEnchantability() {
if (Config.enchanting == false) {
return 0;
} else {
return 4;
}
}
@Override
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) {
if (Config.enchanting == false) {
return false;
} else {
return true;
}
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F);
}
return false;
}
@Override
public Item getChargedItem(ItemStack itemStack) {
return this;
}
@Override
public Item getEmptyItem(ItemStack itemStack) {
return this;
}
}
@@ -1,40 +0,0 @@
package electricMagicTools.tombenpotter.electricmagictools.common.lib;
public class TextHelper {
/**
* Color Coding *
*/
public static String black = "�0";
public static String darkBlue = "�1";
public static String darkGreen = "�2";
public static String darkAqua = "�3";
public static String darkRed = "�4";
public static String darkPurple = "�5";
public static String gold = "�6";
public static String gray = "�7";
public static String darkGray = "�8";
public static String blue = "�9";
public static String green = "�a";
public static String aqua = "�b";
public static String red = "�c";
public static String lightPurple = "�d";
public static String yellow = "�e";
public static String white = "�f";
/**
* Text Formating *
*/
public static String obfuscated = "�k";
public static String bold = "�l";
public static String strikethrough = "�m";
public static String underline = "�n";
public static String italics = "�o";
public static String resetFormatting = "�r";
/**
* Useful Tooltips *
*/
public static String shiftForMoreInfo = darkGreen + italics + "Press Shift for more information";
}
@@ -1,312 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.recipes;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.registry.GameRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.ItemRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.lib.CraftingAspects;
import ic2.api.item.IC2Items;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.Recipes;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.crafting.CrucibleRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
import thaumcraft.api.crafting.ShapedArcaneRecipe;
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import java.util.Iterator;
public class EMTPostInitRecipes {
public static void add() {
/** Infusion Recipes **/
thaumiumDrill = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Drill", new ItemStack(ItemRegistry.thaumiumDrill), 5, CraftingAspects.thaumiumDrillCrafting, new ItemStack(IC2Items.getItem("diamondDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(Items.diamond), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), IC2Items.getItem("denseplateiron")});
thaumiumChainsaw = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Chainsaw", new ItemStack(ItemRegistry.thaumiumChainsaw), 5, CraftingAspects.thaumiumChainsawCrafting, new ItemStack(ItemRegistry.diamondChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(Items.diamond), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), IC2Items.getItem("denseplateiron")});
thaumicQuantumHelmet = ThaumcraftApi.addInfusionCraftingRecipe("Quantum Goggles of Revealing", new ItemStack(ItemRegistry.quantumThaumicHelmet), 6, CraftingAspects.thaumicQuantumHelmetCrafting, new ItemStack(ItemRegistry.nanoThaumicHelmet, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(Items.milk_bucket), new ItemStack(IC2Items.getItem("quantumHelmet").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("advancedCircuit")});
thaumicNanoHelmet = ThaumcraftApi.addInfusionCraftingRecipe("Nanosuit Goggles of Revealing", new ItemStack(ItemRegistry.nanoThaumicHelmet), 5, CraftingAspects.thaumicNanoHelmetCrafting, new ItemStack(ItemRegistry.electricGoggles, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(Items.gold_ingot), new ItemStack(IC2Items.getItem("nanoHelmet").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), IC2Items.getItem("carbonPlate"), IC2Items.getItem("electronicCircuit")});
thaumiumOmnitool = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Omnitool", new ItemStack(ItemRegistry.thaumiumOmnitool), 6, CraftingAspects.thaumiumOmnitoolCrafting, new ItemStack(ItemRegistry.thaumiumChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(ItemRegistry.thaumiumDrill, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), IC2Items.getItem("carbonPlate"), IC2Items.getItem("plateobsidian")});
diamondOmnitoolToThaumium = ThaumcraftApi.addInfusionCraftingRecipe("Thaumium Omnitool", new ItemStack(ItemRegistry.thaumiumOmnitool), 6, CraftingAspects.thaumiumOmnitoolCrafting, new ItemStack(ItemRegistry.diamondOmnitool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Blocks.diamond_block), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(IC2Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("carbonPlate"), IC2Items.getItem("advancedCircuit")});
explosionFocus = ThaumcraftApi.addInfusionCraftingRecipe("Explosion Focus", new ItemStack(ItemRegistry.explosionFocus), 6, CraftingAspects.laserFocusCrafting, new ItemStack(ConfigItems.itemFocusHellbat, 1), new ItemStack[]{new ItemStack(IC2Items.getItem("miningLaser").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.arrow), new ItemStack(Items.gunpowder), new ItemStack(Items.firework_charge), new ItemStack(ConfigItems.itemResource, 1, 1)});
shieldFocus = ThaumcraftApi.addInfusionCraftingRecipe("Shield Focus", new ItemStack(ItemRegistry.shieldFocus), 4, CraftingAspects.shieldFocusCrafting, new ItemStack(ConfigItems.itemFocusPortableHole, 1), new ItemStack[]{IC2Items.getItem("reinforcedStone"), IC2Items.getItem("reinforcedGlass"), IC2Items.getItem("reinforcedStone"), IC2Items.getItem("reinforcedGlass"), new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.obsidian), new ItemStack(Blocks.obsidian)});
potentiaGenerator = ThaumcraftApi.addInfusionCraftingRecipe("Potentia Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 0), 6, CraftingAspects.potentiaGeneratorCrafting, IC2Items.getItem("semifluidGenerator"), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(ConfigItems.itemFocusTrade), new ItemStack(Blocks.hopper), new ItemStack(ConfigBlocks.blockJar), IC2Items.getItem("mvTransformer"), IC2Items.getItem("advancedMachine"), IC2Items.getItem("orewashingplant"), IC2Items.getItem("scrap")});
streamChainsaw = ThaumcraftApi.addInfusionCraftingRecipe("Chainsaw of the Stream", new ItemStack(ItemRegistry.streamChainsaw), 6, CraftingAspects.streamChaisnawCrafting, new ItemStack(ItemRegistry.thaumiumChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.water_bucket), new ItemStack(ConfigItems.itemAxeElemental), new ItemStack(ConfigBlocks.blockMagicalLog), new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("compressedPlantBall"), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("overclockerUpgrade")});
rockbreakerDrill = ThaumcraftApi.addInfusionCraftingRecipe("Drill of the Rockbreaker", new ItemStack(ItemRegistry.rockbreakerDrill), 6, CraftingAspects.rockbreakerDrillCrafting, new ItemStack(ItemRegistry.thaumiumDrill, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.flint_and_steel), new ItemStack(Items.fire_charge), new ItemStack(ConfigItems.itemPickElemental), new ItemStack(ConfigItems.itemShovelElemental), new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("reinforcedStone"), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("overclockerUpgrade")});
thorHammer = ThaumcraftApi.addInfusionCraftingRecipe("Mjolnir", new ItemStack(ItemRegistry.thorHammer), 7, CraftingAspects.thorHammerCrafting, new ItemStack(ItemRegistry.taintedThorHammer, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 6), new ItemStack(ItemRegistry.itemEMTItems, 1, 6), new ItemStack(ConfigItems.itemSwordElemental), new ItemStack(ConfigItems.itemResource, 1, 1), new ItemStack(ConfigItems.itemFocusShock), IC2Items.getItem("rubber")});
superchargedThorHammer = ThaumcraftApi.addInfusionCraftingRecipe("Supercharged Mjolnir", new ItemStack(ItemRegistry.electricThorHammer), 10, CraftingAspects.superchargedThorHammerCrafting, new ItemStack(ItemRegistry.thorHammer, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 6), new ItemStack(ItemRegistry.itemEMTItems, 1, 6), new ItemStack(Blocks.web), new ItemStack(ConfigItems.itemFocusHellbat), new ItemStack(ConfigItems.itemSwordElemental), new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("iridiumPlate"), new ItemStack(IC2Items.getItem("nanoSaber").getItem(), 1, OreDictionary.WILDCARD_VALUE)});
wandRecharger = ThaumcraftApi.addInfusionCraftingRecipe("Industrial Wand Charging Station", new ItemStack(BlockRegistry.emtMachines, 1, 0), 6, CraftingAspects.wandCharger, new ItemStack(ConfigBlocks.blockStoneDevice, 1, 5), new ItemStack[]{IC2Items.getItem("replicator"), IC2Items.getItem("iridiumPlate"), new ItemStack(Blocks.diamond_block), new ItemStack(ConfigItems.itemShard, 1, 5), new ItemStack(ConfigBlocks.blockJar)});
solarHelmetRevealing = ThaumcraftApi.addInfusionCraftingRecipe("Solar Helmet of Revealing", new ItemStack(ItemRegistry.solarHelmetRevealing), 5, CraftingAspects.solarHelmetRevealing, new ItemStack(ItemRegistry.quantumThaumicHelmet, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(BlockRegistry.emtSolars, 1, 1), IC2Items.getItem("glassFiberCableItem"), new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemShard, 1, 4)});
electricBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Electric Boots of the Traveller", new ItemStack(ItemRegistry.electricBootsTraveller), 2, CraftingAspects.electricBootsTravel, new ItemStack(ConfigItems.itemBootsTraveller), new ItemStack[]{new ItemStack(Items.diamond), IC2Items.getItem("elemotor"), IC2Items.getItem("coil"), IC2Items.getItem("hazmatBoots"), new ItemStack(IC2Items.getItem("advBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE)});
nanoBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Nano Boots of the Traveller", new ItemStack(ItemRegistry.nanoBootsTraveller), 2, CraftingAspects.nanoBootsTravel, new ItemStack(ItemRegistry.electricBootsTraveller, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Items.diamond), new ItemStack(IC2Items.getItem("nanoBoots").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(IC2Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE)});
quantumBootsTravel = ThaumcraftApi.addInfusionCraftingRecipe("Quantum Boots of the Traveller", new ItemStack(ItemRegistry.quantumBootsTraveller), 2, CraftingAspects.quantumBootsTravel, new ItemStack(ItemRegistry.nanoBootsTraveller, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{new ItemStack(Blocks.diamond_block), new ItemStack(IC2Items.getItem("quantumBoots").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("iridiumPlate")});
etheralProcessor = ThaumcraftApi.addInfusionCraftingRecipe("Etheral Processor", new ItemStack(BlockRegistry.emtMachines, 1, 1), 3, CraftingAspects.etherealProcessor, IC2Items.getItem("macerator"), new ItemStack[]{IC2Items.getItem("electroFurnace"), new ItemStack(ConfigBlocks.blockMetalDevice, 1, 9), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.iron_block), new ItemStack(Blocks.iron_block), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5)});
tripleCompressedSolar = ThaumcraftApi.addInfusionCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 2), 2, CraftingAspects.compressedSolars, new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack[]{new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 1)});
electricHoeGrowth = ThaumcraftApi.addInfusionCraftingRecipe("Electric Hoe of Growth", new ItemStack(ItemRegistry.electricHoeGrowth), 4, CraftingAspects.electricHoeGrowth, new ItemStack(ConfigItems.itemHoeElemental), new ItemStack[]{new ItemStack(IC2Items.getItem("lapotronCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(IC2Items.getItem("electricHoe").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.dye, 1, 15), IC2Items.getItem("elemotor"), IC2Items.getItem("coil"), new ItemStack(Blocks.sapling, 1, OreDictionary.WILDCARD_VALUE)});
chargeFocus = ThaumcraftApi.addInfusionCraftingRecipe("Wand Focus: Charging", new ItemStack(ItemRegistry.chargeFocus), 4, CraftingAspects.chargeFocus, new ItemStack(IC2Items.getItem("advBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{IC2Items.getItem("generator"), IC2Items.getItem("batBox"), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ItemRegistry.itemEMTItems, 1, 5), new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE)});
wandChargeFocus = ThaumcraftApi.addInfusionCraftingRecipe("Wand Focus: Wand Charging", new ItemStack(ItemRegistry.wandChargeFocus), 5, CraftingAspects.wandChargeFocus, new ItemStack(BlockRegistry.emtMachines, 1, 0), new ItemStack[]{new ItemStack(ItemRegistry.chargeFocus), new ItemStack(IC2Items.getItem("energyPack").getItem(), 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("iridiumPlate")});
inventoryChargingRing = ThaumcraftApi.addInfusionCraftingRecipe("Inventory Charging Ring", new ItemStack(ItemRegistry.emtBauble, 1, 1), 6, CraftingAspects.inventoryChargingRing, new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), new ItemStack[]{new ItemStack(ItemRegistry.thaumiumDrill, 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("generator"), IC2Items.getItem("geothermalGenerator"), IC2Items.getItem("waterMill"), IC2Items.getItem("solarPanel"), IC2Items.getItem("windMill"), IC2Items.getItem("nuclearReactor")});
armorChargingRing = ThaumcraftApi.addInfusionCraftingRecipe("Armor Charging Ring", new ItemStack(ItemRegistry.emtBauble, 1, 0), 6, CraftingAspects.armorChargingRing, new ItemStack(ConfigItems.itemBaubleBlanks, 1, 1), new ItemStack[]{new ItemStack(ItemRegistry.electricBootsTraveller, 1, OreDictionary.WILDCARD_VALUE), IC2Items.getItem("generator"), IC2Items.getItem("geothermalGenerator"), IC2Items.getItem("waterMill"), IC2Items.getItem("solarPanel"), IC2Items.getItem("windMill"), IC2Items.getItem("nuclearReactor")});
nanoWings = ThaumcraftApi.addInfusionCraftingRecipe("Nanosuit Wings", new ItemStack(ItemRegistry.nanoWing), 4, CraftingAspects.nanoWing, new ItemStack(ItemRegistry.thaumiumWing), new ItemStack[]{IC2Items.getItem("carbonPlate"), IC2Items.getItem("carbonPlate"), IC2Items.getItem("carbonPlate"), new ItemStack(IC2Items.getItem("nanoBodyarmor").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemResource, 1, 1)});
quantumWings = ThaumcraftApi.addInfusionCraftingRecipe("Quantum Wings", new ItemStack(ItemRegistry.quantumWing), 6, CraftingAspects.quantumWing, new ItemStack(ItemRegistry.nanoWing, 1, OreDictionary.WILDCARD_VALUE), new ItemStack[]{IC2Items.getItem("iridiumPlate"), IC2Items.getItem("iridiumPlate"), IC2Items.getItem("iridiumPlate"), new ItemStack(IC2Items.getItem("quantumBodyarmor").getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ConfigItems.itemResource, 1, 1)});
/** Arcane Worktable Recipes **/
diamondOmnitool = ThaumcraftApi.addShapelessArcaneCraftingRecipe("Diamond Omnitool", new ItemStack(ItemRegistry.diamondOmnitool), CraftingAspects.diamondOmnitoolCrafting, new ItemStack(ItemRegistry.diamondChainsaw, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(IC2Items.getItem("diamondDrill").getItem(), 1, OreDictionary.WILDCARD_VALUE));
ironOmnitoolToDiamond = ThaumcraftApi.addArcaneCraftingRecipe("Diamond Omnitool", new ItemStack(ItemRegistry.diamondOmnitool), CraftingAspects.diamondOmnitoolCrafting, "XAX", "XBX", "XAX", 'X', new ItemStack(Items.diamond), 'A', IC2Items.getItem("advancedCircuit"), 'B', new ItemStack(ItemRegistry.ironOmnitool, 1, OreDictionary.WILDCARD_VALUE));
christmasFocus = ThaumcraftApi.addArcaneCraftingRecipe("Kris-tmas Focus", new ItemStack(ItemRegistry.christmasFocus), CraftingAspects.christmasFocusCrafting, "XYX", "YZY", "XYX", 'X', new ItemStack(Blocks.snow), 'Y', new ItemStack(Blocks.pumpkin), 'Z', new ItemStack(ConfigItems.itemFocusFrost));
electricGoggles = ThaumcraftApi.addArcaneCraftingRecipe("Electric Goggles", new ItemStack(ItemRegistry.electricGoggles), CraftingAspects.electricGogglesCrafting, " Y ", "AZA", "BXB", 'Z', new ItemStack(ConfigItems.itemGoggles), 'X', IC2Items.getItem("electronicCircuit"), 'Y', new ItemStack(Items.diamond_helmet), 'A', new ItemStack(IC2Items.getItem("chargedReBattery").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'B', Items.repeater);
shieldBlock = ThaumcraftApi.addArcaneCraftingRecipe("Shield Blocks", new ItemStack(BlockRegistry.shield, 8), CraftingAspects.shieldBlockCrafting, "XYX", "X X", "XYX", 'X', new ItemStack(Blocks.glass), 'Y', new ItemStack(Blocks.obsidian));
tinyUranium = ThaumcraftApi.addShapelessArcaneCraftingRecipe("Tiny Uranium", new ItemStack(IC2Items.getItem("smallUran235").getItem(), 7), CraftingAspects.tinyUraniumCrafting, IC2Items.getItem("Uran238"));
compressedSolar = ThaumcraftApi.addArcaneCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.compressedSolars, "XXX", "XXX", "XXX", 'X', IC2Items.getItem("solarPanel"));
doubleCompressedSolar = ThaumcraftApi.addArcaneCraftingRecipe("Compressed Solars", new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.compressedSolars, "XXX", "XXX", "XXX", 'X', new ItemStack(BlockRegistry.emtSolars, 1, 0));
electricScribingTools = ThaumcraftApi.addArcaneCraftingRecipe("Electric Scribing Tools", new ItemStack(ItemRegistry.electricScribingTools), CraftingAspects.electricScribingTools, "YXY", "XZX", "YXY", 'Y', IC2Items.getItem("electronicCircuit"), 'X', new ItemStack(ConfigItems.itemInkwell), 'Z', new ItemStack(IC2Items.getItem("energyCrystal").getItem(), 1, OreDictionary.WILDCARD_VALUE));
thaumiumWing = ThaumcraftApi.addArcaneCraftingRecipe("Thaumium Reinforced Wings", new ItemStack(ItemRegistry.itemEMTItems, 1, 15), CraftingAspects.thaumiumWing, "XYZ", "XYZ", "XYZ", 'X', new ItemStack(ItemRegistry.itemEMTItems, 1, 14), 'Y', new ItemStack(ItemRegistry.itemEMTItems, 1, 5), 'Z', new ItemStack(ItemRegistry.itemEMTItems, 1, 13));
thaumiumWings = ThaumcraftApi.addArcaneCraftingRecipe("Thaumium Reinforced Wings", new ItemStack(ItemRegistry.thaumiumWing), CraftingAspects.thaumiumWing, "XX", 'X', new ItemStack(ItemRegistry.itemEMTItems, 1, 15));
/** Crucible Recipes **/
ignisGenerator = ThaumcraftApi.addCrucibleRecipe("Ignis Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 1), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.ignisGeneratorCrafting);
auramGenerator = ThaumcraftApi.addCrucibleRecipe("Auram Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 2), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.auramGeneratorCrafting);
arborGenerator = ThaumcraftApi.addCrucibleRecipe("Arbor Generator", new ItemStack(BlockRegistry.essentiaGens, 1, 3), new ItemStack(BlockRegistry.essentiaGens, 1, 0), CraftingAspects.arborGeneratorCrafting);
waterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 3), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.waterSolars);
doubleWaterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 4), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.waterSolars);
tripleWaterSolar = ThaumcraftApi.addCrucibleRecipe("Water Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 5), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.waterSolars);
darkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 6), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.darkSolars);
doubleDarkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 7), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.darkSolars);
tripleDarkSolar = ThaumcraftApi.addCrucibleRecipe("Entropy Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 8), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.darkSolars);
orderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 9), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.orderSolars);
doubleOrderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 10), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.orderSolars);
tripleOrderSolar = ThaumcraftApi.addCrucibleRecipe("Order Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 11), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.orderSolars);
fireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 12), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.fireSolars);
doubleFireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 13), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.fireSolars);
tripleFireSolar = ThaumcraftApi.addCrucibleRecipe("Fire Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 14), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.fireSolars);
airSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars, 1, 15), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.airSolars);
doubleAirSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 0), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.airSolars);
tripleAirSolar = ThaumcraftApi.addCrucibleRecipe("Air Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 1), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.airSolars);
earthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 2), new ItemStack(BlockRegistry.emtSolars, 1, 0), CraftingAspects.earthSolars);
doubleEarthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 3), new ItemStack(BlockRegistry.emtSolars, 1, 1), CraftingAspects.earthSolars);
tripleEarthSolar = ThaumcraftApi.addCrucibleRecipe("Earth Infused Solar Panels", new ItemStack(BlockRegistry.emtSolars2, 1, 4), new ItemStack(BlockRegistry.emtSolars, 1, 2), CraftingAspects.earthSolars);
portableNode = ThaumcraftApi.addCrucibleRecipe("Portable Node", new ItemStack(BlockRegistry.portableNode), new ItemStack(ConfigItems.itemJarFilled), CraftingAspects.portableNode);
/** IC2 Stuff related recipes **/
/* Ore Clusters Macerator Recipes */
ItemStack ironClusterRecipe = IC2Items.getItem("smallIronDust").copy();
ironClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 16)), null, ironClusterRecipe);
ItemStack goldClusterRecipe = IC2Items.getItem("smallGoldDust").copy();
goldClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 31)), null, goldClusterRecipe);
ItemStack copperClusterRecipe = IC2Items.getItem("smallCopperDust").copy();
copperClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 17)), null, copperClusterRecipe);
ItemStack tinClusterRecipe = IC2Items.getItem("smallTinDust").copy();
tinClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 18)), null, tinClusterRecipe);
ItemStack silverClusterRecipe = IC2Items.getItem("smallSilverDust").copy();
silverClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 19)), null, silverClusterRecipe);
ItemStack leadClusterRecipe = IC2Items.getItem("smallLeadDust").copy();
leadClusterRecipe.stackSize = 22;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemNugget, 1, 20)), null, leadClusterRecipe);
/* Thaumium Plates Recipes */
thaumiumPlate = GameRegistry.addShapedRecipe(new ItemStack(ItemRegistry.itemEMTItems, 1, 5), "X", "Y", "Z", 'Y', new ItemStack(ConfigItems.itemResource, 1, 2), 'X', new ItemStack(IC2Items.getItem("ForgeHammer").getItem(), 1, OreDictionary.WILDCARD_VALUE), 'Z', new ItemStack(Blocks.obsidian));
Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigItems.itemResource, 1, 2)), null, new ItemStack(ItemRegistry.itemEMTItems, 1, 5));
/* Iron Sheet Recipe */
Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(IC2Items.getItem("denseplateiron")), null, new ItemStack(ItemRegistry.itemEMTItems, 1, 13));
/* Ore Processing for Amber and Cinnabar */
if (Config.removeAmberAndCinnabarMacerating == true) {
for (Iterator<IRecipeInput> it = Recipes.macerator.getRecipes().keySet().iterator(); it.hasNext(); ) {
IRecipeInput input = it.next();
if (input.matches(new ItemStack(ConfigBlocks.blockCustomOre, 1, 7))) {
it.remove();
FMLLog.info("[EMT] Electro-Magic Tools : Removing conflicting amber macerating recipe(s)");
}
}
for (Iterator<IRecipeInput> it = Recipes.macerator.getRecipes().keySet().iterator(); it.hasNext(); ) {
IRecipeInput input = it.next();
if (input.matches(new ItemStack(ConfigBlocks.blockCustomOre, 1, 0))) {
it.remove();
FMLLog.info("[EMT] Electro-Magic Tools : Removing Conflicting cinnabar macerating recipe(s)");
}
}
}
ItemStack crushedAmberRecipe = new ItemStack(ItemRegistry.itemEMTItems, 1, 1);
crushedAmberRecipe.stackSize = 2;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigBlocks.blockCustomOre, 1, 7)), null, crushedAmberRecipe);
ItemStack crushedCinnabarRecipe = new ItemStack(ItemRegistry.itemEMTItems, 1, 3);
crushedCinnabarRecipe.stackSize = 2;
Recipes.macerator.addRecipe(new RecipeInputItemStack(new ItemStack(ConfigBlocks.blockCustomOre, 1, 0)), null, crushedCinnabarRecipe);
NBTTagCompound waterAmount = new NBTTagCompound();
waterAmount.setInteger("amount", 1000);
ItemStack smallCopperDust = IC2Items.getItem("smallCopperDust");
smallCopperDust.stackSize = 2;
ItemStack smallTinDust = IC2Items.getItem("smallTinDust");
smallCopperDust.stackSize = 2;
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 1)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 2), smallCopperDust, IC2Items.getItem("stoneDust")});
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 3)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 4), smallTinDust, IC2Items.getItem("stoneDust")});
NBTTagCompound heatAmount = new NBTTagCompound();
heatAmount.setInteger("minHeat", 1000);
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 2)), heatAmount, new ItemStack[]{IC2Items.getItem("smallCopperDust"), new ItemStack(ConfigItems.itemResource, 1, 6)});
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 4)), heatAmount, new ItemStack[]{IC2Items.getItem("smallTinDust"), new ItemStack(ConfigItems.itemResource, 1, 3)});
}
public static InfusionRecipe thaumiumDrill;
public static InfusionRecipe thaumiumChainsaw;
public static InfusionRecipe thaumicQuantumHelmet;
public static InfusionRecipe thaumiumOmnitool;
public static InfusionRecipe thaumicNanoHelmet;
public static InfusionRecipe explosionFocus;
public static InfusionRecipe shieldFocus;
public static InfusionRecipe potentiaGenerator;
public static InfusionRecipe streamChainsaw;
public static InfusionRecipe rockbreakerDrill;
public static InfusionRecipe thorHammer;
public static InfusionRecipe superchargedThorHammer;
public static InfusionRecipe wandRecharger;
public static InfusionRecipe solarHelmetRevealing;
public static InfusionRecipe electricBootsTravel;
public static InfusionRecipe nanoBootsTravel;
public static InfusionRecipe quantumBootsTravel;
public static InfusionRecipe diamondOmnitoolToThaumium;
public static InfusionRecipe etheralProcessor;
public static InfusionRecipe tripleCompressedSolar;
public static InfusionRecipe electricHoeGrowth;
public static InfusionRecipe chargeFocus;
public static InfusionRecipe wandChargeFocus;
public static InfusionRecipe inventoryChargingRing;
public static InfusionRecipe armorChargingRing;
public static InfusionRecipe nanoWings;
public static InfusionRecipe quantumWings;
public static ShapelessArcaneRecipe diamondOmnitool;
public static ShapelessArcaneRecipe tinyUranium;
public static ShapedArcaneRecipe christmasFocus;
public static ShapedArcaneRecipe electricGoggles;
public static ShapedArcaneRecipe shieldBlock;
public static ShapedArcaneRecipe compressedSolar;
public static ShapedArcaneRecipe doubleCompressedSolar;
public static ShapedArcaneRecipe ironOmnitoolToDiamond;
public static ShapedArcaneRecipe electricScribingTools;
public static ShapedArcaneRecipe thaumiumWing;
public static ShapedArcaneRecipe thaumiumWings;
public static CrucibleRecipe ignisGenerator;
public static CrucibleRecipe auramGenerator;
public static CrucibleRecipe arborGenerator;
public static CrucibleRecipe waterSolar;
public static CrucibleRecipe doubleWaterSolar;
public static CrucibleRecipe tripleWaterSolar;
public static CrucibleRecipe darkSolar;
public static CrucibleRecipe doubleDarkSolar;
public static CrucibleRecipe tripleDarkSolar;
public static CrucibleRecipe orderSolar;
public static CrucibleRecipe doubleOrderSolar;
public static CrucibleRecipe tripleOrderSolar;
public static CrucibleRecipe fireSolar;
public static CrucibleRecipe doubleFireSolar;
public static CrucibleRecipe tripleFireSolar;
public static CrucibleRecipe airSolar;
public static CrucibleRecipe doubleAirSolar;
public static CrucibleRecipe tripleAirSolar;
public static CrucibleRecipe earthSolar;
public static CrucibleRecipe doubleEarthSolar;
public static CrucibleRecipe tripleEarthSolar;
public static CrucibleRecipe portableNode;
public static IRecipe thaumiumPlate;
}
@@ -1,62 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import ic2.api.energy.prefab.BasicSource;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.lib.events.EssentiaHandler;
public class TileEntityArborGenerator extends TileEntityEMT {
int x;
int y;
int z;
public ForgeDirection orientation;
public static int waitTime;
public TileEntityArborGenerator() {
orientation = ForgeDirection.getOrientation(1);
waitTime = 30;
}
private BasicSource energySource = new BasicSource(this, 1000000000, 3);
@Override
public void updateEntity() {
energySource.updateEntity();
if (waitTime > 0) {
waitTime--;
}
if (waitTime <= 0) {
if ((!this.worldObj.isRemote) && (EssentiaHandler.drainEssentia(this, Aspect.TREE, ForgeDirection.UNKNOWN, 8))) {
energySource.addEnergy(Config.arborGenOutput);
}
waitTime = Config.essentiaGeneratorsDelay;
}
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
onChunkUnload();
}
}
@@ -1,72 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import ic2.api.energy.prefab.BasicSource;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.lib.events.EssentiaHandler;
public class TileEntityAuramGenerator extends TileEntityEMT {
int x;
int y;
int z;
public ForgeDirection orientation;
public static int waitTime;
private BasicSource energySource = new BasicSource(this, 1000000000, 3);
public TileEntityAuramGenerator() {
orientation = ForgeDirection.getOrientation(1);
waitTime = 30;
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (waitTime > 0) {
waitTime--;
}
if (waitTime <= 0) {
if ((!this.worldObj.isRemote) && (EssentiaHandler.drainEssentia(this, Aspect.AURA, ForgeDirection.UNKNOWN, 8))) {
energySource.addEnergy(Config.auramGenOutput);
}
waitTime = Config.essentiaGeneratorsDelay;
}
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
energySource.readFromNBT(tag);
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
energySource.writeToNBT(tag);
}
}
@@ -1,72 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import ic2.api.energy.prefab.BasicSource;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.lib.events.EssentiaHandler;
public class TileEntityIgnisGenerator extends TileEntityEMT {
int x;
int y;
int z;
public ForgeDirection orientation;
public static int waitTime;
private BasicSource energySource = new BasicSource(this, 1000000000, 3);
public TileEntityIgnisGenerator() {
orientation = ForgeDirection.getOrientation(1);
waitTime = 30;
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (waitTime > 0) {
waitTime--;
}
if (waitTime <= 0) {
if ((!this.worldObj.isRemote) && (EssentiaHandler.drainEssentia(this, Aspect.FIRE, ForgeDirection.UNKNOWN, 8))) {
energySource.addEnergy(6000);
}
waitTime = Config.essentiaGeneratorsDelay;
}
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
energySource.readFromNBT(tag);
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
energySource.writeToNBT(tag);
}
}
@@ -1,74 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import ic2.api.energy.prefab.BasicSource;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.lib.events.EssentiaHandler;
public class TileEntityPotentiaGenerator extends TileEntityEMT {
int x;
int y;
int z;
public ForgeDirection orientation;
public static int waitTime;
public TileEntityPotentiaGenerator() {
orientation = ForgeDirection.getOrientation(1);
waitTime = 30;
}
private BasicSource energySource = new BasicSource(this, 1000000000, 3);
@Override
public void updateEntity() {
energySource.updateEntity();
if (waitTime > 0) {
waitTime--;
}
if (waitTime <= 0) {
if ((!this.worldObj.isRemote) && (EssentiaHandler.drainEssentia(this, Aspect.ENERGY, ForgeDirection.UNKNOWN, 8))) {
energySource.addEnergy(Config.potentiaGenOutput);
}
waitTime = Config.essentiaGeneratorsDelay;
}
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
onChunkUnload();
}
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
energySource.readFromNBT(tag);
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
energySource.writeToNBT(tag);
}
}
@@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.slot;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.container.ContainerIndustrialWandRecharge;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import thaumcraft.common.items.wands.ItemWandCasting;
public class SlotWandOnly extends Slot {
final ContainerIndustrialWandRecharge charger;
public SlotWandOnly(ContainerIndustrialWandRecharge indCharger, IInventory inv, int par3, int par4, int par5) {
super(inv, par3, par4, par5);
this.charger = indCharger;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
if (!(par1ItemStack.getItem() instanceof ItemWandCasting))
return false;
ItemWandCasting wand = (ItemWandCasting) par1ItemStack.getItem();
return wand.getCap(par1ItemStack).getBaseCostModifier() <= 1F;
}
@Override
public int getSlotStackLimit() {
return 1;
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityAirSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityAirSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord >= 160) {
energySource.addEnergy(Config.compressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 15);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityCompressedSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityCompressedSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 0);
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDarkSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDarkSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 6);
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleAirSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 2);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleAirSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord >= 160) {
energySource.addEnergy(Config.doubleCompressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars2, 1, 0);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleCompressedSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 2);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleCompressedSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 1);
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleDarkSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 2);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleDarkSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 7);
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleEarthSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 2);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleEarthSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord <= 10) {
energySource.addEnergy(Config.doubleCompressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars2, 1, 3);
}
}
@@ -1,119 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleFireSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 3);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
public TileEntityDoubleFireSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
initialized = true;
}
if (worldObj.provider.dimensionId == -1) {
energySource.addEnergy(Config.doubleCompressedSolarOutput * 2);
} else {
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 13);
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleOrderSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 3);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleOrderSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.doubleCompressedSolarOutput * 3);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 10);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityDoubleWaterSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 2);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityDoubleWaterSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) {
energySource.addEnergy(Config.doubleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 4);
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityEarthSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityEarthSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord <= 10) {
energySource.addEnergy(Config.compressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars2, 1, 2);
}
}
@@ -1,119 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityFireSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
public TileEntityFireSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
initialized = true;
}
if (worldObj.provider.dimensionId == -1) {
energySource.addEnergy(Config.compressedSolarOutput * 2);
} else {
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 12);
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleAirSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 5);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleAirSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord >= 160) {
energySource.addEnergy(Config.tripleCompressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars2, 1, 1);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleCompressedSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 3);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleCompressedSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 2);
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleDarkSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 3);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleDarkSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isDaytime() == false && worldObj.isRaining() == false && worldObj.isThundering() == false) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 8);
}
}
@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleEarthSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 5);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleEarthSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible && this.yCoord <= 10) {
energySource.addEnergy(Config.tripleCompressedSolarOutput * 2.5);
} else if (theSunIsVisible) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars2, 1, 4);
}
}
@@ -1,119 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleFireSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 5);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
public TileEntityTripleFireSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
initialized = true;
}
if (worldObj.provider.dimensionId == -1) {
energySource.addEnergy(Config.tripleCompressedSolarOutput * 2);
} else {
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 14);
}
}
@@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleOrderSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 5);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleOrderSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (theSunIsVisible) {
energySource.addEnergy(Config.tripleCompressedSolarOutput * 3);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 11);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityTripleWaterSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 1000000, 3);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityTripleWaterSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) {
energySource.addEnergy(Config.tripleCompressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 5);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 Tombenpotter.
* All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
*
* This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod.
* Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012.
* http://www.minecraftforum.net/topic/1585216-
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common.tile.solars;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEMT;
import ic2.api.energy.prefab.BasicSource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Random;
public class TileEntityWaterSolar extends TileEntityEMT implements IWrenchable {
private BasicSource energySource = new BasicSource(this, 10000, 1);
private static Random random = new Random();
private boolean initialized;
public boolean theSunIsVisible;
private int tick;
private boolean canRain;
private boolean noSunlight;
public TileEntityWaterSolar() {
super();
this.tick = random.nextInt(64);
}
@Override
public void updateEntity() {
energySource.updateEntity();
if (!initialized && worldObj != null) {
canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0;
noSunlight = worldObj.provider.hasNoSky;
initialized = true;
}
if (noSunlight) {
return;
}
if (tick-- == 0) {
updateSunState();
tick = 64;
}
if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) {
energySource.addEnergy(Config.compressedSolarOutput);
}
}
private void updateSunState() {
boolean isRaining = canRain && (worldObj.isRaining() || worldObj.isThundering());
theSunIsVisible = worldObj.isDaytime() && !isRaining && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
}
@Override
public void onChunkUnload() {
energySource.onChunkUnload();
}
@Override
public void invalidate() {
energySource.invalidate();
super.invalidate();
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energySource.writeToNBT(nbttagcompound);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energySource.readFromNBT(nbttagcompound);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(BlockRegistry.emtSolars, 1, 3);
}
}
Binary file not shown.
+117
View File
@@ -0,0 +1,117 @@
package ic2.api;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Represents the 6 possible directions along the axis of a block.
*/
public enum Direction {
/**
* -X
*/
XN,
/**
* +X
*/
XP,
/**
* -Y
*/
YN, //MC-Code starts with 0 here
/**
* +Y
*/
YP, // 1...
/**
* -Z
*/
ZN,
/**
* +Z
*/
ZP;
public static Direction fromSideValue(int side) {
return directions[(side + 2) % 6];
}
public static Direction fromForgeDirection(ForgeDirection dir) {
if (dir == ForgeDirection.UNKNOWN) return null;
return fromSideValue(dir.ordinal());
}
/**
* Get the tile entity next to a tile entity following this direction.
*
* @param tileEntity tile entity to check
* @return Adjacent tile entity or null if none exists
*/
public TileEntity applyToTileEntity(TileEntity te) {
return applyTo(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
}
/**
* Get the tile entity next to a position following this direction.
*
* @param world World to check
* @param x X coordinate to check from
* @param y Y coordinate to check from
* @param z Z coordinate to check from
* @return Adjacent tile entity or null if none exists
*/
public TileEntity applyTo(World world, int x, int y, int z) {
int coords[] = { x, y, z };
coords[ordinal() / 2] += getSign();
if (world != null && world.blockExists(coords[0], coords[1], coords[2])) {
try {
return world.getTileEntity(coords[0], coords[1], coords[2]);
} catch (Exception e) {
throw new RuntimeException("error getting TileEntity at dim "+world.provider.dimensionId+" "+coords[0]+"/"+coords[1]+"/"+coords[2]);
}
}
return null;
}
/**
* Get the inverse of this direction (XN -> XP, XP -> XN, etc.)
*
* @return Inverse direction
*/
public Direction getInverse() {
return directions[ordinal() ^ 1];
}
/**
* Convert this direction to a Minecraft side value.
*
* @return Minecraft side value
*/
public int toSideValue() {
return (ordinal() + 4) % 6;
}
/**
* Determine direction sign (N for negative or P for positive).
*
* @return -1 if the direction is negative, +1 if the direction is positive
*/
private int getSign() {
return (ordinal() % 2) * 2 - 1;
}
public ForgeDirection toForgeDirection() {
return ForgeDirection.getOrientation(toSideValue());
}
public static final Direction[] directions = Direction.values();
}
Binary file not shown.
+56
View File
@@ -0,0 +1,56 @@
package ic2.api.crops;
/**
* Base agriculture seed. Used to determine the state of a plant once it is planted from an item.
*/
public class BaseSeed {
/**
* Plant ID.
*/
public int id;
/**
* Plant size.
*/
public int size;
/**
* Plant growth stat.
*/
public int statGrowth;
/**
* Plant gain stat.
*/
public int statGain;
/**
* Plant resistance stat.
*/
public int statResistance;
/**
* For internal usage only.
*/
public int stackSize;
/**
* Create a BaseSeed object.
*
* @param id1 plant ID
* @param size1 plant size
* @param statGrowth1 plant growth stat
* @param statGain1 plant gain stat
* @param statResistance1 plant resistance stat
* @param stackSize1 for internal usage only
*/
public BaseSeed(int id1, int size1, int statGrowth1, int statGain1, int statResistance1, int stackSize1) {
super();
this.id = id1;
this.size = size1;
this.statGrowth = statGrowth1;
this.statGain = statGain1;
this.statResistance = statResistance1;
this.stackSize = stackSize1;
}
}
Binary file not shown.
+376
View File
@@ -0,0 +1,376 @@
package ic2.api.crops;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Base agriculture crop.
*
* Any crop extending this can be registered using registerCrop to be added into the game.
*/
public abstract class CropCard {
/**
* Plant name. Will be displayed to the player.
*
* @return Plant name
*/
public abstract String name();
/**
* Your name here, will be shown in "Discovered by:" when analyzing seeds.
*
* @return Your name
*/
public String discoveredBy() {return "IC2 Team";}
/**
* Description of your plant. Keep it short, a few characters per line for up to two lines.
* Default is showing attributes of your plant, 2 per line.
*
* @param i line to get, starting from 0
* @return The line
*/
public String desc(int i) {
String[] att = attributes();
if (att == null || att.length == 0) return "";
if (i == 0) {
String s = att[0];
if (att.length >= 2) {
s+=", "+att[1];
if (att.length >= 3) s+=",";
}
return s;
}
if (att.length < 3) return "";
String s = att[2];
if (att.length >= 4) s+=", "+att[3];
return s;
}
/**
* *
* @param crop reference to ICropTile
* @return roots lengt use in isBlockBelow
*/
public int getrootslength(ICropTile crop){
return 1;
}
/**
* Tier of the plant. Ranges from 1 to 16, 0 is Weed.
* Valuable and powerful crops have higher tiers, useless and weak ones have lower tiers.
*
* @return Tier
*/
public abstract int tier();
/**
* Describe the plant through a set of stats, influencing breeding.
* Plants sharing stats and attributes will tend to cross-breed more often.
*
* Stats:
* - 0: Chemistry (Industrial uses based on chemical plant components)
* - 1: Consumable (Food, potion ingredients, stuff meant to be eaten or similarly used)
* - 2: Defensive (Plants with defense capabilities (damaging, explosive, chemical) or special abilities in general)
* - 3: Colorful (How colorful/aesthetically/beautiful is the plant, like dye-plants or plants without actual effects)
* - 4: Weed (Is this plant weed-like and rather unwanted/quick-spreading? Rare super-breed plants should have low values here)
*
* @param n index of the requested stat
* @return The requested value of the stats
*/
public abstract int stat(int n);
/**
* Additional attributes of the plant, also influencing breeding.
* Plants sharing stats and attributes will tend to cross-breed more often.
*
* @return Attributes as an array of strings
*/
public abstract String[] attributes();
/**
* Determine the max crop size.
*
* Currently only used for texture allocation.
*/
public abstract int maxSize();
/**
* Instantiate your Icons here.
*
* This method will get called by IC2, don't call it yourself.
*/
@SideOnly(Side.CLIENT)
public void registerSprites(IIconRegister iconRegister) {
textures = new IIcon[maxSize()];
for (int i = 1; i <= textures.length; i++) {
textures[i-1] = iconRegister.registerIcon("ic2:crop/blockCrop."+name()+"."+i);
}
}
/**
* Sprite the crop is meant to be rendered with.
*
* @param crop reference to ICropTile
* @return 0-255, representing the sprite index on the crop's spritesheet.
*/
@SideOnly(Side.CLIENT)
public IIcon getSprite(ICropTile crop) {
if (crop.getSize() <= 0 || crop.getSize() > textures.length) return null;
return textures[crop.getSize() - 1];
}
/**
* Get the crop's spritesheet.
* Per default crops_0.png of ic2-sprites
* @return Texture file path
*/
public String getTextureFile() {
return "/ic2/sprites/crops_0.png";
}
/**
* Amount of growth points needed to increase the plant's size.
* Default is 200 * tier.
*/
public int growthDuration(ICropTile crop) {
return tier()*200;
}
/**
* Check whether the plant can grow further.
*
* Consider:
* - Humidity, nutrients and air quality
* - Current size
* - Light level
* - Special biomes or conditions, accessible through crop.worldObj
*
* This method will be called upon empty upgraded crops to check whether a neighboring plant can cross onto it! Don't check if the size is greater than 0 and if the ID is real.
*
* @param crop reference to ICropTile
* @return Whether the crop can grow
*/
public abstract boolean canGrow(ICropTile crop);
/**
* Calculate the influence for the plant to grow based on humidity, nutrients and air.
* Normal behavior is rating the three stats "normal", with each of them ranging from 0-30.
* Basic rule: Assume everything returns 10. All together must equal 30. Add the factors to your likings, for example (humidity*0.7)+(nutrients*0.9)+(air*1.4)
*
* Default is humidity + nutrients + air (no factors).
*
* @param crop reference to ICropTile
* @param humidity ground humidity, influenced by hydration
* @param nutrients nutrient quality in ground, based on fertilizers
* @param air air quality, influences by open gardens and less crops surrounding this one
* @return 0-30
*/
public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) {
return (int) (humidity+nutrients+air);
}
/**
* Used to determine whether the plant can crossbreed with another crop.
* Default is allow crossbreeding if the size is greater or equal than 3.
*
* @param crop crop to crossbreed with
*/
public boolean canCross(ICropTile crop) {
return crop.getSize() >= 3;
}
/**
* Called when the plant is rightclicked by a player.
* Default action is harvesting.
*
* Only called Serverside.
*
* @param crop reference to ICropTile
* @param player player rightclicking the crop
* @return Whether the plant has changed
*/
public boolean rightclick(ICropTile crop, EntityPlayer player) {
return crop.harvest(true);
}
/**
* Use in Crop Havester with insert Cropnalyzer to get best Output.
*
* @param crop reference to ICropTile
* @return need crop size for best output.
*/
public abstract int getOptimalHavestSize(ICropTile crop);
/**
* Check whether the crop can be harvested.
*
* @param crop reference to ICropTile
* @return Whether the crop can be harvested in its current state.
*/
public abstract boolean canBeHarvested(ICropTile crop);
/**
* Base chance for dropping the plant's gains, specify values greater than 1 for multiple drops.
* Default is 0.95^tier.
*
* @return Chance to drop the gains
*/
public float dropGainChance() {
float base = 1F;
for (int i = 0; i < tier(); i++) {base*=0.95;}
return base;
}
/**
* Item obtained from harvesting the plant.
*
* @param crop reference to ICropTile
* @return Item obtained
*/
public abstract ItemStack getGain(ICropTile crop);
/**
* Get the size of the plant after harvesting.
* Default is 1.
*
* @param crop reference to ICropTile
* @return Plant size after harvesting
*/
public byte getSizeAfterHarvest(ICropTile crop) {return 1;}
/**
* Called when the plant is leftclicked by a player.
* Default action is picking the plant.
*
* Only called Serverside.
*
* @param crop reference to ICropTile
* @param player player leftclicked the crop
* @return Whether the plant has changed
*/
public boolean leftclick(ICropTile crop, EntityPlayer player) {
return crop.pick(true);
}
/**
* Base chance for dropping seeds when the plant is picked.
* Default is 0.5*0.8^tier with a bigger chance for sizes greater than 2 and absolutely no chance for size 0.
*
* @param crop reference to ICropTile
* @return Chance to drop the seeds
*/
public float dropSeedChance(ICropTile crop) {
if (crop.getSize() == 1) return 0;
float base = 0.5F;
if (crop.getSize() == 2) base/=2F;
for (int i = 0; i < tier(); i++) {base*=0.8;}
return base;
}
/**
* Obtain seeds dropped when the plant is picked.
* Multiple drops of the returned ItemStack can occur.
* Default action is generating a seed from this crop.
*
* @param crop reference to ICropTile
* @return Seeds
*/
public ItemStack getSeeds(ICropTile crop) {
return crop.generateSeeds(crop.getID(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel());
}
/**
* Called when a neighbor block to the crop has changed.
*
* @param crop reference to ICropTile
*/
public void onNeighbourChange(ICropTile crop) {
//
}
/**
* Check if the crop should emit redstone.
*
* @return Whether the crop should emit redstone
*/
public int emitRedstone(ICropTile crop) {return 0;}
/**
* Called when the crop is destroyed.
*
* @param crop reference to ICropTile
*/
public void onBlockDestroyed(ICropTile crop) {
//
}
/**
* Get the light value emitted by the plant.
*
* @param crop reference to ICropTile
* @return Light value emitted
*/
public int getEmittedLight(ICropTile crop) {return 0;}
/**
* Default is true if the entity is an EntityLiving in jumping or sprinting state.
*
* @param crop reference to ICropTile
* @param entity entity colliding
* @return Whether trampling calculation should happen, return false if the plant is no longer valid.
*/
public boolean onEntityCollision(ICropTile crop, Entity entity) {
if (entity instanceof EntityLivingBase) {
return ((EntityLivingBase) entity).isSprinting();
}
return false;
}
/**
* Called every time the crop ticks.
* Should be called every 256 ticks or around 13 seconds.
*
* @param crop reference to ICropTile
*/
public void tick(ICropTile crop) {
//
}
/**
* Check whether this plant spreads weed to surrounding tiles.
* Default is true if the plant has a high growth stat (or is weeds) and size greater or equal than 2.
*
* @param crop reference to ICropTile
* @return Whether the plant spreads weed
*/
public boolean isWeed(ICropTile crop) {
return crop.getSize() >= 2 && (crop.getID() == 0 || crop.getGrowth() >= 24);
}
/**
* Get this plant's ID.
*
* @return ID of this CropCard or -1 if it's not registered
*/
public final int getId() {
return Crops.instance.getIdFor(this);
}
@SideOnly(Side.CLIENT)
protected IIcon textures[];
}
Binary file not shown.
+120
View File
@@ -0,0 +1,120 @@
package ic2.api.crops;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.BiomeDictionary.Type;
/**
* General management of the crop system.
*/
public abstract class Crops {
public static Crops instance;
/**
* Adds a crop nutrient biome bonus.
*
* +10/-10 0 indicates no bonus and negative values indicate a penalty.
*
* @param type Forge biome type to apply the bonus in
* @param nutrientsBonus Nutrient stat bonus
*/
public abstract void addBiomenutrientsBonus(Type type, int nutrientsBonus);
/**
* Adds a crop humidity biome bonus.
*
* +10/-10 0 indicates no bonus and negative values indicate a penalty.
*
* @param type Forge biome type to apply the bonus in
* @param humidityBonus Humidity stat bonus
*/
public abstract void addBiomehumidityBonus(Type type, int humidityBonus);
/**
* Gets the humidity bonus for a biome.
*
* @param biome Biome to check
* @return Humidity bonus or 0 if none
*/
public abstract int getHumidityBiomeBonus(BiomeGenBase biome);
/**
* Gets the nutrient bonus for a biome.
*
* @param biome Biome to check
* @return Nutrient bonus or 0 if none
*/
public abstract int getNutrientBiomeBonus(BiomeGenBase biome);
/**
* Returns the list of registered crops.
*
* @return Registered crops by ID
*/
public abstract CropCard[] getCropList();
/**
* Auto-assign an ID to a plant and register it.
* Usage of this method is not recommended! Other plants could take your IDs and cause your plants to turn into other plants.
*
* @param crop plant to register
* @return The ID assigned to the plant
*/
public abstract short registerCrop(CropCard crop);
/**
* Attempt to register a plant to an ID.
* If the ID is taken, the crop will not be registered and a console print will notify the user.
*
* @param crop plant to register
* @param i ID to register the plant to
* @return Whether the crop was registered
*/
public abstract boolean registerCrop(CropCard crop, int i);
/**
* Registers a base seed, an item used to plant a crop.
*
* @param stack item
* @param id plant ID
* @param size initial size
* @param growth initial growth stat
* @param gain initial gain stat
* @param resistance initial resistance stat
* @return True if successful
*/
public abstract boolean registerBaseSeed(ItemStack stack, int id, int size, int growth, int gain, int resistance);
/**
* Finds a base seed from the given item.
*
* @return Base seed or null if none found
*/
public abstract BaseSeed getBaseSeed(ItemStack stack);
/**
* Execute registerSprites for all registered crop cards.
*
* This method will get called by IC2, don't call it yourself.
*/
@SideOnly(Side.CLIENT)
public abstract void startSpriteRegistration(IIconRegister iconRegister);
/**
* Returns the ID for the given crop.
*
* @param crop Crop to look up
* @return ID, or -1 if not found
*/
public abstract int getIdFor(CropCard crop);
}
Binary file not shown.
+264
View File
@@ -0,0 +1,264 @@
package ic2.api.crops;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
/**
* Interface implemented by the crop tile entity.
*/
public interface ICropTile {
/**
* Get the crop's plant ID.
*
* @return Plant ID, or -1 if there is no plant currently on the crop
*/
public short getID();
/**
* Set the crop's plant ID.
*
* @param id Plant ID, or -1 for no plant
*/
public void setID(short id);
/**
* Get the crop's plant size.
*
* @return Plant size, starting with 1 and maximum varies depending on plant
*/
public byte getSize();
/**
* Set the crop's plant size.
*
* @param size Plant size
*/
public void setSize(byte size);
/**
* Get the crop's plant growth stat.
* Higher values indicate faster growth.
*
* @return Plant growth stat
*/
public byte getGrowth();
/**
* Set the crop's plant growth stat.
*
* @param growth Plant growth stat
*/
public void setGrowth(byte growth);
/**
* Get the crop's plant gain stat.
* Higher values indicate more drops.
*
* @return Plant gain stat
*/
public byte getGain();
/**
* Set the crop's plant gain stat.
*
* @param gain Plant gain stat
*/
public void setGain(byte gain);
/**
* Get the crop's plant resistance stat.
* Higher values indicate more resistance against trampling.
*
* @return Plant resistance stat
*/
public byte getResistance();
/**
* Set the crop's plant resistance stat.
*
* @param resistance Plant resistance stat
*/
public void setResistance(byte resistance);
/**
* Get the crop's plant scan level.
* Increases every time the seed is analyzed.
*
* @return Plant scan level
*/
public byte getScanLevel();
/**
* Set the crop's plant scan level.
*
* @param scanLevel Plant scan level
*/
public void setScanLevel(byte scanLevel);
/**
* Get the crop's plant custom data, stored alongside the crop.
* Can be modified in place.
*
* @return Plant custom data
*/
public NBTTagCompound getCustomData();
/**
* Get the crop's nutrient storage.
* Ranges from 0 to 100.
*
* @return Crop nutrient storage
*/
public int getNutrientStorage();
/**
* Set the crop's nutrient storage.
*
* @param nutrientStorage Crop nutrient storage
*/
public void setNutrientStorage(int nutrientStorage);
/**
* Get the crop's hydration storage.
* 0 indicates nothing, 1-10 indicate water hydration and 11-100 for hydration cells.
*
* @return Crop hydration storage
*/
public int getHydrationStorage();
/**
* Set the crop's hydration storage.
*
* @param hydrationStorage Crop hydration storage
*/
public void setHydrationStorage(int hydrationStorage);
/**
* Get the crop's Weed-Ex storage.
*
* @return Crop Weed-Ex storage
*/
public int getWeedExStorage();
/**
* Set the crop's Weed-Ex storage.
*
* @param weedExStorage Crop Weed-Ex storage
*/
public void setWeedExStorage(int weedExStorage);
/**
* Get the crop's humidity.
* Ranges from 0 (dry) to 10 (humid).
* Updates every couple of seconds or when an update is requested.
*
* @see #updateState()
*
* @return Crop humidity level
*/
public byte getHumidity();
/**
* Get the crop's nutrient level.
* Ranges from 0 (empty) to 10 (full).
* Updates every couple of seconds or when an update is requested.
*
* @see #updateState()
*
* @return Crop nutrient level
*/
public byte getNutrients();
/**
* Get the crop's air quality.
* Ranges from 0 (cluttered) to 10 (fresh).
* Updates every couple of seconds or when an update is requested.
*
* @see #updateState()
*
* @return Crop air quality
*/
public byte getAirQuality();
/**
* Get the crop's world.
*
* @return Crop world
*/
public World getWorld();
/**
* Get the crop's location.
*
* @return Crop location
*/
public ChunkCoordinates getLocation();
/**
* Get the crop's light level.
*
* @return Crop light level
*/
public int getLightLevel();
/**
* Pick the crop, removing and giving seeds for the plant.
*
* @param manual whether it was done by hand (not automated)
* @return true if successfully picked
*/
public boolean pick(boolean manual);
/**
* Harvest the crop, turning it into gain and resetting its size.
* drop output on ground
* @param manual
* @return true if successfully harvested
*/
public boolean harvest(boolean manual);
/**
* Harvest the crop, turning it into gain and resetting its size.
* drop output on ground
* @param Optimal force check getOptimalHavestSize() for harvest
* @return ItemStack[] of harvest output
*/
ItemStack[] harvest_automated(boolean Optimal);
/**
* Fully clears the crop without dropping anything.
*/
public void reset();
/**
* Request a texture and lighting update.
*/
public void updateState();
/**
* Check if a block is under the farmland containing the crop.
* Searches up to 2 blocks below the farmland or an air space, whichever appears first.
*
* @param block block to search
* @return Whether the block was found
*/
public boolean isBlockBelow(Block block);
/**
* Generate plant seeds with the given parameters.
*
* @param plant plant ID
* @param growth plant growth stat
* @param gain plant gain stat
* @param resis plant resistance stat
* @param scan plant scan level
* @return Plant seed item
*/
public ItemStack generateSeeds(short plant, byte growth, byte gain, byte resis, byte scan);
}
Binary file not shown.
@@ -0,0 +1,4 @@
@API(apiVersion="1.0", owner="IC2", provides="IC2API")
package ic2.api.crops;
import cpw.mods.fml.common.API;
Binary file not shown.
@@ -0,0 +1,18 @@
package ic2.api.energy;
/**
* Provides access to the energy network.
*
* The old EnergyNet methods missing in IEnergyNet have been migrated to events (load, unload) or
* removed (tiles no longer emit energy actively, the energy net implementation requests it).
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public final class EnergyNet {
/**
* Instance of the global EnergyNet class.
*/
public static IEnergyNet instance;
}
Binary file not shown.
@@ -0,0 +1,86 @@
package ic2.api.energy;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Interface representing the methods provided by the global EnergyNet class.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergyNet {
/**
* Get the EnergyNet-registered tile entity at the specified position.
*
* This is not the same as World.getTileEntity(), it's possible to register delegate tile
* entities with the energy net which are different from what's actually in the world. Those
* delegates allow to use separate TileEntity objects just for the EnergyNet interfaces,
* simplifying cross-mod dependencies and multi-blocks.
*
* @param world World containing the tile entity
* @param x x-coordinate
* @param y y-coordinate
* @param z z-coordinate
* @return tile entity registered to the energy net or null if none is registered
*/
TileEntity getTileEntity(World world, int x, int y, int z);
/**
* Get the EnergyNet-registered neighbor tile entity at the specified position.
*
* @param te TileEntity indicating the world and position to search from
* @param dir direction the neighbor is to be found
* @return neighbor tile entity registered to the energy net or null if none is registered
*/
TileEntity getNeighbor(TileEntity te, ForgeDirection dir);
/**
* determine how much energy has been emitted by the EnergyEmitter specified
*
* @note call this twice with x ticks delay to get the avg. emitted power p = (call2 - call1) / x EU/tick
*
* @param tileEntity energy emitter
* @deprecated Discontinued, use getNodeStats instead.
*/
@Deprecated
double getTotalEnergyEmitted(TileEntity tileEntity);
/**
* determine how much energy has been sunken by the EnergySink specified
*
* @note call this twice with x ticks delay to get the avg. sunken power p = (call2 - call1) / x EU/tick
*
* @param tileEntity energy emitter
* @deprecated Discontinued, use getNodeStats instead.
*/
@Deprecated
double getTotalEnergySunken(TileEntity tileEntity);
/**
* Retrieve statistics for the tile entity specified.
*
* The statistics apply to the last simulated tick.
*
* @param te Tile entity to check.
* @return Statistics for the tile entity.
*/
NodeStats getNodeStats(TileEntity te);
/**
* Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2.
*
* @param tier tier
* @return power in eu/t
*/
double getPowerFromTier(int tier);
/**
* Determine minimum tier required to handle the specified power, e.g. tier 2 for 128 eu/t.
*
* @param power in eu/t
* @return tier
*/
int getTierFromPower(double power);
}
Binary file not shown.
@@ -0,0 +1,25 @@
package ic2.api.energy;
public class NodeStats {
public NodeStats(double energyIn, double energyOut, double voltage) {
this.energyIn = energyIn;
this.energyOut = energyOut;
this.voltage = voltage;
}
public double getEnergyIn() {
return energyIn;
}
public double getEnergyOut() {
return energyOut;
}
public double getVoltage() {
return voltage;
}
protected double energyIn;
protected double energyOut;
protected double voltage;
}
@@ -0,0 +1,23 @@
package ic2.api.energy.event;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.world.WorldEvent;
import ic2.api.energy.tile.IEnergyTile;
/**
* Base class for energy net events, don't use it directly.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public class EnergyTileEvent extends WorldEvent {
public final IEnergyTile energyTile;
public EnergyTileEvent(IEnergyTile energyTile1) {
super(((TileEntity) energyTile1).getWorldObj());
this.energyTile = energyTile1;
}
}
@@ -0,0 +1,26 @@
package ic2.api.energy.event;
import ic2.api.energy.tile.IEnergyTile;
/**
* Event announcing new energy tiles.
*
* This event notifies subscribers of loaded energy tiles, e.g. after getting
* loaded through the chunk they are in or after being placed down by the
* player or another deployer mechanism.
*
* Every energy tile which wants to get connected to the IC2 Energy Network has
* to either post this event or alternatively call EnergyNet.addTileEntity().
*
* You may use this event to build a static representation of energy tiles for
* your own energy grid implementation if you need to. It's not required if you
* always lookup energy paths on demand.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public class EnergyTileLoadEvent extends EnergyTileEvent {
public EnergyTileLoadEvent(IEnergyTile energyTile1) {
super(energyTile1);
}
}
@@ -0,0 +1,27 @@
package ic2.api.energy.event;
import ic2.api.energy.tile.IEnergyTile;
/**
* Event announcing terminated energy tiles.
*
* This event notifies subscribers of unloaded energy tiles, e.g. after getting
* unloaded through the chunk they are in or after being destroyed by the
* player or another block pick/destruction mechanism.
*
* Every energy tile which wants to get disconnected from the IC2 Energy
* Network has to either post this event or alternatively call
* EnergyNet.removeTileEntity().
*
* You may use this event to build a static representation of energy tiles for
* your own energy grid implementation if you need to. It's not required if you
* always lookup energy paths on demand.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public class EnergyTileUnloadEvent extends EnergyTileEvent {
public EnergyTileUnloadEvent(IEnergyTile energyTile1) {
super(energyTile1);
}
}
@@ -0,0 +1,4 @@
@API(apiVersion="1.0", owner="IC2", provides="IC2API")
package ic2.api.energy.event;
import cpw.mods.fml.common.API;
Binary file not shown.
@@ -0,0 +1,4 @@
@API(apiVersion="1.0", owner="IC2", provides="IC2API")
package ic2.api.energy;
import cpw.mods.fml.common.API;
Binary file not shown.
@@ -0,0 +1,373 @@
package ic2.api.energy.prefab;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.info.Info;
import ic2.api.item.ElectricItem;
/**
* BasicSink is a simple adapter to provide an ic2 energy sink.
*
* It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a
* one-time configurable input energy buffer, thus providing a common use case for machines.
*
* Sub-classing BasicSink instead of using it as a delegate works as well, but isn't recommended.
* The delegate can be extended with additional functionality through a sub class though.
*
* The constraints set by BasicSink like the strict tank-like energy buffering should provide a
* more easy to use and stable interface than using IEnergySink directly while aiming for
* optimal performance.
*
* Using BasicSink involves the following steps:
* - create a BasicSink instance in your TileEntity, typically in a field
* - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSink
* instance.
* If you have other means of determining when the tile entity is fully loaded, notify onLoaded
* that way instead of forwarding updateEntity.
* - call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available
* without consuming the energy.
* - optionally use getEnergyStored to display the output buffer charge level
* - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
*
* Example implementation code:
* @code{.java}
* public class SomeTileEntity extends TileEntity {
* // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV)
* private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1);
*
* @Override
* public void invalidate() {
* ic2EnergySink.invalidate(); // notify the energy sink
* ...
* super.invalidate(); // this is important for mc!
* }
*
* @Override
* public void onChunkUnload() {
* ic2EnergySink.onChunkUnload(); // notify the energy sink
* ...
* }
*
* @Override
* public void readFromNBT(NBTTagCompound tag) {
* super.readFromNBT(tag);
*
* ic2EnergySink.readFromNBT(tag);
* ...
* }
*
* @Override
* public void writeToNBT(NBTTagCompound tag) {
* super.writeToNBT(tag);
*
* ic2EnergySink.writeToNBT(tag);
* ...
* }
*
* @Override
* public void updateEntity() {
* ic2EnergySink.updateEntity(); // notify the energy sink
* ...
* if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick
* ... // do something with the energy
* }
* ...
* }
*
* ...
* }
* @endcode
*/
public class BasicSink extends TileEntity implements IEnergySink {
// **********************************
// *** Methods for use by the mod ***
// **********************************
/**
* Constructor for a new BasicSink delegate.
*
* @param parent1 TileEntity represented by this energy sink.
* @param capacity1 Maximum amount of eu to store.
* @param tier1 IC2 tier, 1 = LV, 2 = MV, ...
*/
public BasicSink(TileEntity parent1, int capacity1, int tier1) {
this.parent = parent1;
this.capacity = capacity1;
this.tier = tier1;
}
// in-world te forwards >>
/**
* Forward for the base TileEntity's updateEntity(), used for creating the energy net link.
* Either updateEntity or onLoaded have to be used.
*/
@Override
public void updateEntity() {
if (!addedToEnet) onLoaded();
}
/**
* Notification that the base TileEntity finished loaded, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
/**
* Forward for the base TileEntity's invalidate(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void invalidate() {
super.invalidate();
onChunkUnload();
}
/**
* Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void onChunkUnload() {
if (addedToEnet &&
Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnet = false;
}
}
/**
* Forward for the base TileEntity's readFromNBT(), used for loading the state.
*
* @param tag Compound tag as supplied by TileEntity.readFromNBT()
*/
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
NBTTagCompound data = tag.getCompoundTag("IC2BasicSink");
energyStored = data.getDouble("energy");
}
/**
* Forward for the base TileEntity's writeToNBT(), used for saving the state.
*
* @param tag Compound tag as supplied by TileEntity.writeToNBT()
*/
@Override
public void writeToNBT(NBTTagCompound tag) {
try {
super.writeToNBT(tag);
} catch (RuntimeException e) {
// happens if this is a delegate, ignore
}
NBTTagCompound data = new NBTTagCompound();
data.setDouble("energy", energyStored);
tag.setTag("IC2BasicSink", data);
}
// << in-world te forwards
// methods for using this adapter >>
/**
* Get the maximum amount of energy this sink can hold in its buffer.
*
* @return Capacity in EU.
*/
public int getCapacity() {
return capacity;
}
/**
* Set the maximum amount of energy this sink can hold in its buffer.
*
* @param capacity1 Capacity in EU.
*/
public void setCapacity(int capacity1) {
this.capacity = capacity1;
}
/**
* Get the IC2 energy tier for this sink.
*
* @return IC2 Tier.
*/
public int getTier() {
return tier;
}
/**
* Set the IC2 energy tier for this sink.
*
* @param tier1 IC2 Tier.
*/
public void setTier(int tier1) {
this.tier = tier1;
}
/**
* Determine the energy stored in the sink's input buffer.
*
* @return amount in EU, may be above capacity
*/
public double getEnergyStored() {
return energyStored;
}
/**
* Set the stored energy to the specified amount.
*
* This is intended for server -> client synchronization, e.g. to display the stored energy in
* a GUI through getEnergyStored().
*
* @param amount
*/
public void setEnergyStored(double amount) {
energyStored = amount;
}
/**
* Determine if the specified amount of energy is available.
*
* @param amount in EU
* @return true if the amount is available
*/
public boolean canUseEnergy(double amount) {
return energyStored >= amount;
}
/**
* Use the specified amount of energy, if available.
*
* @param amount amount to use
* @return true if the amount was available
*/
public boolean useEnergy(double amount) {
if (canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) {
energyStored -= amount;
return true;
}
return false;
}
/**
* Discharge the supplied ItemStack into this sink's energy buffer.
*
* @param stack ItemStack to discharge (null is ignored)
* @param limit Transfer limit, values <= 0 will use the battery's limit
* @return true if energy was transferred
*/
public boolean discharge(ItemStack stack, int limit) {
if (stack == null || !Info.isIc2Available()) return false;
double amount = capacity - energyStored;
if (amount <= 0) return false;
if (limit > 0 && limit < amount) amount = limit;
amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, true, false);
energyStored += amount;
return amount > 0;
}
// << methods for using this adapter
// backwards compatibility (ignore these) >>
@Deprecated
public void onUpdateEntity() {
updateEntity();
}
@Deprecated
public void onInvalidate() {
invalidate();
}
@Deprecated
public void onOnChunkUnload() {
onChunkUnload();
}
@Deprecated
public void onReadFromNbt(NBTTagCompound tag) {
readFromNBT(tag);
}
@Deprecated
public void onWriteToNbt(NBTTagCompound tag) {
writeToNBT(tag);
}
// << backwards compatibility
// ******************************
// *** Methods for use by ic2 ***
// ******************************
// energy net interface >>
@Override
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
return true;
}
@Override
public double getDemandedEnergy() {
return Math.max(0, capacity - energyStored);
}
@Override
public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
energyStored += amount;
return 0;
}
@Override
public int getSinkTier() {
return tier;
}
// << energy net interface
public final TileEntity parent;
protected int capacity;
protected int tier;
protected double energyStored;
protected boolean addedToEnet;
}
@@ -0,0 +1,375 @@
package ic2.api.energy.prefab;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.EnergyNet;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.info.Info;
import ic2.api.item.ElectricItem;
/**
* BasicSource is a simple adapter to provide an ic2 energy source.
*
* It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a
* one-time configurable output energy buffer, thus providing a common use case for generators.
*
* Sub-classing BasicSource instead of using it as a delegate works as well, but isn't recommended.
* The delegate can be extended with additional functionality through a sub class though.
*
* The constraints set by BasicSource like the strict tank-like energy buffering should provide a
* more easy to use and stable interface than using IEnergySource directly while aiming for
* optimal performance.
*
* Using BasicSource involves the following steps:
* - create a BasicSource instance in your TileEntity, typically in a field
* - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSource
* instance.
* If you have other means of determining when the tile entity is fully loaded, notify onLoaded
* that way instead of forwarding updateEntity.
* - call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator
* should run
* - optionally use getEnergyStored to display the output buffer charge level
* - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
*
* Example implementation code:
* @code{.java}
* public class SomeTileEntity extends TileEntity {
* // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV)
* private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1);
*
* @Override
* public void invalidate() {
* ic2EnergySource.invalidate(); // notify the energy source
* ...
* super.invalidate(); // this is important for mc!
* }
*
* @Override
* public void onChunkUnload() {
* ic2EnergySource.onChunkUnload(); // notify the energy source
* ...
* }
*
* @Override
* public void readFromNBT(NBTTagCompound tag) {
* super.readFromNBT(tag);
*
* ic2EnergySource.readFromNBT(tag);
* ...
* }
*
* @Override
* public void writeToNBT(NBTTagCompound tag) {
* super.writeToNBT(tag);
*
* ic2EnergySource.writeToNBT(tag);
* ...
* }
*
* @Override
* public void updateEntity() {
* ic2EnergySource.updateEntity(); // notify the energy source
* ...
* ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick
* ...
* }
*
* ...
* }
* @endcode
*/
public class BasicSource extends TileEntity implements IEnergySource {
// **********************************
// *** Methods for use by the mod ***
// **********************************
/**
* Constructor for a new BasicSource delegate.
*
* @param parent1 Base TileEntity represented by this energy source.
* @param capacity1 Maximum amount of eu to store.
* @param tier1 IC2 tier, 1 = LV, 2 = MV, ...
*/
public BasicSource(TileEntity parent1, double capacity1, int tier1) {
double power = EnergyNet.instance.getPowerFromTier(tier1);
this.parent = parent1;
this.capacity = capacity1 < power ? power : capacity1;
this.tier = tier1;
this.power = power;
}
// in-world te forwards >>
/**
* Forward for the base TileEntity's updateEntity(), used for creating the energy net link.
* Either updateEntity or onLoaded have to be used.
*/
@Override
public void updateEntity() {
if (!addedToEnet) onLoaded();
}
/**
* Notification that the base TileEntity finished loading, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
/**
* Forward for the base TileEntity's invalidate(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void invalidate() {
super.invalidate();
onChunkUnload();
}
/**
* Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void onChunkUnload() {
if (addedToEnet &&
Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnet = false;
}
}
/**
* Forward for the base TileEntity's readFromNBT(), used for loading the state.
*
* @param tag Compound tag as supplied by TileEntity.readFromNBT()
*/
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");
energyStored = data.getDouble("energy");
}
/**
* Forward for the base TileEntity's writeToNBT(), used for saving the state.
*
* @param tag Compound tag as supplied by TileEntity.writeToNBT()
*/
@Override
public void writeToNBT(NBTTagCompound tag) {
try {
super.writeToNBT(tag);
} catch (RuntimeException e) {
// happens if this is a delegate, ignore
}
NBTTagCompound data = new NBTTagCompound();
data.setDouble("energy", energyStored);
tag.setTag("IC2BasicSource", data);
}
// << in-world te forwards
// methods for using this adapter >>
/**
* Get the maximum amount of energy this source can hold in its buffer.
*
* @return Capacity in EU.
*/
public double getCapacity() {
return capacity;
}
/**
* Set the maximum amount of energy this source can hold in its buffer.
*
* @param capacity1 Capacity in EU.
*/
public void setCapacity(double capacity1) {
if (capacity1 < power) capacity1 = power;
this.capacity = capacity1;
}
/**
* Get the IC2 energy tier for this source.
*
* @return IC2 Tier.
*/
public int getTier() {
return tier;
}
/**
* Set the IC2 energy tier for this source.
*
* @param tier1 IC2 Tier.
*/
public void setTier(int tier1) {
double power = EnergyNet.instance.getPowerFromTier(tier1);
if (capacity < power) capacity = power;
this.tier = tier1;
this.power = power;
}
/**
* Determine the energy stored in the source's output buffer.
*
* @return amount in EU
*/
public double getEnergyStored() {
return energyStored;
}
/**
* Set the stored energy to the specified amount.
*
* This is intended for server -> client synchronization, e.g. to display the stored energy in
* a GUI through getEnergyStored().
*
* @param amount
*/
public void setEnergyStored(double amount) {
energyStored = amount;
}
/**
* Determine the free capacity in the source's output buffer.
*
* @return amount in EU
*/
public double getFreeCapacity() {
return capacity - energyStored;
}
/**
* Add some energy to the output buffer.
*
* @param amount maximum amount of energy to add
* @return amount added/used, NOT remaining
*/
public double addEnergy(double amount) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return 0;
if (amount > capacity - energyStored) amount = capacity - energyStored;
energyStored += amount;
return amount;
}
/**
* Charge the supplied ItemStack from this source's energy buffer.
*
* @param stack ItemStack to charge (null is ignored)
* @return true if energy was transferred
*/
public boolean charge(ItemStack stack) {
if (stack == null || !Info.isIc2Available()) return false;
double amount = ElectricItem.manager.charge(stack, energyStored, tier, false, false);
energyStored -= amount;
return amount > 0;
}
// << methods for using this adapter
// backwards compatibility (ignore these) >>
@Deprecated
public void onUpdateEntity() {
updateEntity();
}
@Deprecated
public void onInvalidate() {
invalidate();
}
@Deprecated
public void onOnChunkUnload() {
onChunkUnload();
}
@Deprecated
public void onReadFromNbt(NBTTagCompound tag) {
readFromNBT(tag);
}
@Deprecated
public void onWriteToNbt(NBTTagCompound tag) {
writeToNBT(tag);
}
// << backwards compatibility
// ******************************
// *** Methods for use by ic2 ***
// ******************************
// energy net interface >>
@Override
public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) {
return true;
}
@Override
public double getOfferedEnergy() {
return Math.min(energyStored, power);
}
@Override
public void drawEnergy(double amount) {
energyStored -= amount;
}
@Override
public int getSourceTier() {
return tier;
}
// << energy net interface
public final TileEntity parent;
protected double capacity;
protected int tier;
protected double power;
protected double energyStored;
protected boolean addedToEnet;
}
@@ -0,0 +1,4 @@
@API(apiVersion="1.0", owner="IC2", provides="IC2API")
package ic2.api.energy.prefab;
import cpw.mods.fml.common.API;
@@ -0,0 +1,27 @@
package ic2.api.energy.tile;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* For internal/multi-block usage only.
*
* @see IEnergySink
* @see IEnergyConductor
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergyAcceptor extends IEnergyTile {
/**
* Determine if this acceptor can accept current from an adjacent emitter in a direction.
*
* The TileEntity in the emitter parameter is what was originally added to the energy net,
* which may be normal in-world TileEntity, a delegate or an IMetaDelegate.
*
* @param emitter energy emitter, may also be null or an IMetaDelegate
* @param direction direction the energy is being received from
*/
boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction);
}
@@ -0,0 +1,53 @@
package ic2.api.energy.tile;
/**
* Tile entities which conduct energy pulses without buffering (mostly cables) have to implement this
* interface.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter {
/**
* Energy loss for the conductor in EU per block.
*
* @return Energy loss
*/
double getConductionLoss();
/**
* Amount of energy the insulation will handle before shocking nearby players and mobs.
*
* @return Insulation energy absorption in EU
*/
double getInsulationEnergyAbsorption();
/**
* Amount of energy the insulation will handle before it is destroyed.
* Ensure that this value is greater than the insulation energy absorption + 64.
*
* @return Insulation-destroying energy in EU
*/
double getInsulationBreakdownEnergy();
/**
* Amount of energy the conductor will handle before it melts.
*
* @return Conductor-destroying energy in EU
*/
double getConductorBreakdownEnergy();
/**
* Remove the conductor's insulation if the insulation breakdown energy was exceeded.
*
* @see #getInsulationBreakdownEnergy()
*/
void removeInsulation();
/**
* Remove the conductor if the conductor breakdown energy was exceeded.
*
* @see #getConductorBreakdownEnergy()
*/
void removeConductor();
}
@@ -0,0 +1,28 @@
package ic2.api.energy.tile;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* For internal/multi-block usage only.
*
* @see IEnergySource
* @see IEnergyConductor
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergyEmitter extends IEnergyTile {
/**
* Determine if this emitter can emit energy to an adjacent receiver.
*
* The TileEntity in the receiver parameter is what was originally added to the energy net,
* which may be normal in-world TileEntity, a delegate or an IMetaDelegate.
*
* @param receiver receiver, may also be null or an IMetaDelegate
* @param direction direction the receiver is from the emitter
* @return Whether energy should be emitted
*/
boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction);
}
Binary file not shown.
@@ -0,0 +1,45 @@
package ic2.api.energy.tile;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Allows a tile entity (mostly a machine) to receive energy.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergySink extends IEnergyAcceptor {
/**
* Determine how much energy the sink accepts.
*
* Make sure that injectEnergy() does accepts energy if demandsEnergy() returns anything > 0.
*
* @note Modifying the energy net from this method is disallowed.
*
* @return max accepted input in eu
*/
double getDemandedEnergy();
/**
* Determine the tier of this energy sink.
* 1 = LV, 2 = MV, 3 = HV, 4 = EV etc.
*
* @note Modifying the energy net from this method is disallowed.
* @note Return Integer.MAX_VALUE to allow any voltage.
*
* @return tier of this energy sink
*/
int getSinkTier();
/**
* Transfer energy to the sink.
*
* It's highly recommended to accept all energy by letting the internal buffer overflow to
* increase the performance and accuracy of the distribution simulation.
*
* @param directionFrom direction from which the energy comes from
* @param amount energy to be transferred
* @return Energy not consumed (leftover)
*/
double injectEnergy(ForgeDirection directionFrom, double amount, double voltage);
}
@@ -0,0 +1,38 @@
package ic2.api.energy.tile;
/**
* Allows a tile entity (mostly a generator) to emit energy.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergySource extends IEnergyEmitter {
/**
* Energy output provided by the source this tick.
* This is typically Math.min(stored energy, max output/tick).
*
* @note Modifying the energy net from this method is disallowed.
*
* @return Energy offered this tick
*/
double getOfferedEnergy();
/**
* Draw energy from this source's buffer.
*
* If the source doesn't have a buffer, this is a no-op.
*
* @param amount amount of EU to draw, may be negative
*/
void drawEnergy(double amount);
/**
* Determine the tier of this energy source.
* 1 = LV, 2 = MV, 3 = HV, 4 = EV etc.
*
* @note Modifying the energy net from this method is disallowed.
*
* @return tier of this energy source
*/
int getSourceTier();
}
Binary file not shown.
@@ -0,0 +1,15 @@
package ic2.api.energy.tile;
/**
* For internal usage only, base class for all energy tiles.
*
* @see IEnergySink
* @see IEnergySource
* @see IEnergyConductor
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IEnergyTile {
//
}
Binary file not shown.
@@ -0,0 +1,23 @@
package ic2.api.energy.tile;
import net.minecraftforge.common.util.ForgeDirection;
public interface IHeatSource {
/*
* Return max heat transmission peer Tick (only theoretical bandwidth not available amount)
*/
int maxrequestHeatTick(ForgeDirection directionFrom);
/*
* @param requested amount of heat to transfer
*
* @return transmitted amount of heat
*
* example: You Request 100 units of heat but the Source have only 50 units left
*
* requestHeat(100) : return 50 : so 50 units of heat remove from HeatSource
*/
int requestHeat(ForgeDirection directionFrom, int requestheat);
}
@@ -0,0 +1,22 @@
package ic2.api.energy.tile;
import net.minecraftforge.common.util.ForgeDirection;
public interface IKineticSource {
/*
* Return max kinetic energy transmission peer Tick (only theoretical bandwidth not available amount)
*/
int maxrequestkineticenergyTick(ForgeDirection directionFrom);
/*
* @param requested amount of kinetic energy to transfer
*
* @return transmitted amount of kineticenergy
*
* example: You Request 100 units of kinetic energy but the Source have only 50 units left
*
* requestkineticenergy(100) : return 50 : so 50 units of kinetic energy remove from KineticSource
*/
int requestkineticenergy(ForgeDirection directionFrom, int requestkineticenergy);
}
@@ -0,0 +1,36 @@
package ic2.api.energy.tile;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
/**
* Interface for grouping multi-block structures to a single energy net delegate.
*
* The energy net uses TileEntity to refer to a specific xyz+world position. If multiple of those
* positions should belong to the same functional structure, i.e. they consume or produce energy
* only once for the whole multi-block instead of once per every single block, this interface
* allows to do so.
*
* The tile entity implementing IMetaDelegate has to be added/removed to/from the energy net
* instead of every single sub-TileEntity. The energy net interaction will be handled by the
* IMetaDelegate TileEntity as well.
*
* The sub tile array TileEntity[] just provides optional connectivity (IEnergyAcceptor,
* IEnergyEmitter) and mandatory position (x, y, z, World) data.
* If the connectivity data on the sub tile is missing, the meta delegate is queried instead.
*
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
*/
public interface IMetaDelegate extends IEnergyTile {
/**
* Get the sub-TileEntities belonging to this Meta TileEntity.
*
* @note The list has to be consistent between the EnergyNet Load and Unload events.
* @note The list must have at least 1 element.
* @note The parent te implementing IMetaDelegate isn't automatically included.
*
* @return sub-TileEntity array
*/
List<TileEntity> getSubTiles();
}
Binary file not shown.
@@ -0,0 +1,4 @@
@API(apiVersion="1.0", owner="IC2", provides="IC2API")
package ic2.api.energy.tile;
import cpw.mods.fml.common.API;
+144
View File
@@ -0,0 +1,144 @@
--------------------------------
-- Energy Network Description --
--------------------------------
There are currently three different types of energy network blocks:
- energy sources, e.g. generators or the output side of a storage block/transformer
- energy sinks, e.g. machines or the input side of a storage block/transformer
- conductors, e.g. cables
Note that storage blocks or transformers are both sources and sinks.
All those blocks have to have a tile entity which has to implement the interface corresponding to
its function and also post events to the Forge event bus.
The energy generation, distribution and consumption is strictly limited to the simulating (server)
side, use the proper side checks before posting the related events. One possibility is to check for
FMLCommonHandler.instance().getEffectiveSide().isClient() being false.
The energy network works by calculating the energy flow between the sources which offer energy
through getOfferedEnergy() and the sinks which request energy through demandedEnergyUnits().
Conductors will carry the energy over a distance. Once the energy distribution is calculated, the
energy net will update the sources and sinks through drawEnergy() and injectEnergyUnits() respectively.
---------------------------
-- Energy Network Events --
---------------------------
The energy network currently requires 2 events to manage its internal representation of the grids:
-- EnergyTileLoadEvent --
For all energy network tiles (sources, sinks, conductors) you have to post an EnergyTileLoadEvent.
The event has to be posted as soon as the implementing tile entity is fully loaded, usually after
loading the chunk which contains it or after the user placing the block.
The energy net implementation will use the event to add it to its energy grid map, taking it into
account for further energy transfers.
You can detect the loading by either using the 1st iteration of updateEntity() or by waiting for
the next world tick after TileEntity.validate(). The 2nd approach is obviously more sophisticated
and requires to use some tick queuing mechanism.
The event can by posted as following:
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
-- EnergyTileUnloadEvent --
Another event every energy tile has to post is the EnergyTileUnloadEvent.
The event has to be posted as soon as the implementing tile entity is being unloaded, either by
unloading the containing chunk or by destroying the block containing it.
It's possible to detect the unloading by triggering on both the beginning of
TileEntity.invalidate() and the beginning of TileEntity.onChunkUnload().
It is important that the tile entity is still properly linked to the world while posting the unload
event, otherwise the energy net can't find all affected connections.
--------------------------------------
-- Participating Block Requirements --
--------------------------------------
The energy net blocks have to do the following to work properly:
-- energy source --
An energy source has to post the following events:
- EnergyTileLoadEvent on load
- EnergyTileUnloadEvent on unload
Additionally the interface IEnergySource has to be implemented.
-- energy sink --
An energy sink has to post the following events:
- EnergyTileLoadEvent on load
- EnergyTileUnloadEvent on unload
Additionally the interface IEnergySink has to be implemented.
-- energy conductor --
An energy conductor has to post the following events:
- EnergyTileLoadEvent on load
- EnergyTileUnloadEvent on unload
Additionally the interface IEnergyConductor has to be implemented.
------------------------------
-- Energy Network Delegates --
------------------------------
A delegate is a separate object which performs tasks for the original object, in this case handling
the energy net interaction.
The TileEntity instances used by the events don't have to be the same as the in-world TileEntity
instance for the corresponding position, it can be delegated to a separate TileEntity instance.
This separate instance (delegate) needs to have its world and xyz coordinate fields set to match
the in-world instance. The delegate implements the energy net interfaces and is added and removed
to/from the energy net through EnergyTileLoadEvent and EnergyTileUnloadEvent.
Separating the interfaces through a delegate allows to isolate the IC2 API usage into separate
classes an potentially share common code like an input buffer with battery discharging outside the
class hierarchy.
It's even possible to use an ic2 energy net delegate alongside an in-world TileEntity which isn't
designed to work with ic2 energy at all, like making a furnace electric by receiving energy through
a delegate and adding the corresponding fuel amount to the in-world furnace TileEntity.
Getting the in-world TileEntity for a delegate involves calling World.getBlockTileEntity() with the
delegate's world and xyz coordinate information.
------------------
-- Multi Blocks --
------------------
Multi blocks are a group of blocks which act as one functional entity.
The IMetaDelegate interface groups multiple TileEntity instances (=sub tiles) representing the
individual blocks to a single Energy Net relevant node. The sub tiles may be normal in-world or
delegate TileEntity instances.
The meta delegate is added to energy net once for the whole multi block structure and implements
the energy net interfaces as well. The sub tiles may optionally implement IEnergyEmitter and/or
IEnergyAcceptor to specify their connectivity rules independently, otherwise the meta delegate will
be queried.
--------------------------------------------------
-- How to implement/add your own energy network --
--------------------------------------------------
If you want to create an alternative way of distributing energy, e.g. to have different
distribution rules or to use energy networks provided by other mods, you can register to the energy
tile events and use the interfaces to handle the energy distribution yourself. It's no longer
required to use conversion blocks.
IC2's EnergyNet itself is built on top of the api events and interfaces, providing their default
use case.
Loaded 100 of 569 files, more files were not shown because too many files have changed in this diff. Show more