Auto formatted, and cleaned imports

This commit is contained in:
Modmuss50 2015-04-15 16:23:12 +01:00
parent c001231216
commit 8e7d6b011e
64 changed files with 2268 additions and 2587 deletions

View file

@ -1,7 +1,10 @@
package techreborn; package techreborn;
import java.io.File; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.compat.CompatManager; import techreborn.compat.CompatManager;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
@ -12,46 +15,43 @@ import techreborn.lib.ModInfo;
import techreborn.packets.PacketHandler; import techreborn.packets.PacketHandler;
import techreborn.util.LogHelper; import techreborn.util.LogHelper;
import techreborn.world.TROreGen; import techreborn.world.TROreGen;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent; import java.io.File;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS) @Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS)
public class Core { public class Core {
public static ConfigTechReborn config; public static ConfigTechReborn config;
@Mod.Instance @Mod.Instance
public static Core INSTANCE; public static Core INSTANCE;
@Mod.EventHandler @Mod.EventHandler
public void preinit(FMLPreInitializationEvent event) { public void preinit(FMLPreInitializationEvent event) {
INSTANCE = this; INSTANCE = this;
String path = event.getSuggestedConfigurationFile().getAbsolutePath() String path = event.getSuggestedConfigurationFile().getAbsolutePath()
.replace(ModInfo.MOD_ID, "TechReborn"); .replace(ModInfo.MOD_ID, "TechReborn");
config = ConfigTechReborn.initialize(new File(path)); config = ConfigTechReborn.initialize(new File(path));
LogHelper.info("PreInitialization Compleate"); LogHelper.info("PreInitialization Compleate");
} }
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
//Register ModBlocks //Register ModBlocks
ModBlocks.init(); ModBlocks.init();
//Register ModItems //Register ModItems
ModItems.init(); ModItems.init();
// Recipes // Recipes
ModRecipes.init(); ModRecipes.init();
//Compat //Compat
CompatManager.init(event); CompatManager.init(event);
// WorldGen // WorldGen
GameRegistry.registerWorldGenerator(new TROreGen(), 0); GameRegistry.registerWorldGenerator(new TROreGen(), 0);
//Register Gui Handler //Register Gui Handler
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
//packets //packets
PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(ModInfo.MOD_ID + "_packets", new PacketHandler())); PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(ModInfo.MOD_ID + "_packets", new PacketHandler()));
LogHelper.info("Initialization Compleate"); LogHelper.info("Initialization Compleate");
} }
} }

View file

@ -4,72 +4,72 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class CentrifugeRecipie { public class CentrifugeRecipie {
ItemStack inputItem; ItemStack inputItem;
ItemStack output1, output2, output3, output4; ItemStack output1, output2, output3, output4;
int tickTime; int tickTime;
int cells; int cells;
public CentrifugeRecipie(ItemStack inputItem, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int cells) { public CentrifugeRecipie(ItemStack inputItem, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int cells) {
this.inputItem = inputItem; this.inputItem = inputItem;
this.output1 = output1; this.output1 = output1;
this.output2 = output2; this.output2 = output2;
this.output3 = output3; this.output3 = output3;
this.output4 = output4; this.output4 = output4;
this.tickTime = tickTime; this.tickTime = tickTime;
this.cells = cells; this.cells = cells;
} }
public CentrifugeRecipie(Item inputItem, int inputAmount, Item output1, Item output2, Item output3, Item output4, int tickTime, int cells) { public CentrifugeRecipie(Item inputItem, int inputAmount, Item output1, Item output2, Item output3, Item output4, int tickTime, int cells) {
this.inputItem = new ItemStack(inputItem, inputAmount); this.inputItem = new ItemStack(inputItem, inputAmount);
if(output1!= null) if (output1 != null)
this.output1 = new ItemStack(output1); this.output1 = new ItemStack(output1);
if(output2!= null) if (output2 != null)
this.output2 = new ItemStack(output2); this.output2 = new ItemStack(output2);
if(output3!= null) if (output3 != null)
this.output3 = new ItemStack(output3); this.output3 = new ItemStack(output3);
if(output4!= null) if (output4 != null)
this.output4 = new ItemStack(output4); this.output4 = new ItemStack(output4);
this.tickTime = tickTime; this.tickTime = tickTime;
this.cells = cells; this.cells = cells;
} }
public CentrifugeRecipie(CentrifugeRecipie centrifugeRecipie){ public CentrifugeRecipie(CentrifugeRecipie centrifugeRecipie) {
this.inputItem = centrifugeRecipie.getInputItem(); this.inputItem = centrifugeRecipie.getInputItem();
this.output1 = centrifugeRecipie.getOutput1(); this.output1 = centrifugeRecipie.getOutput1();
this.output2 = centrifugeRecipie.getOutput2(); this.output2 = centrifugeRecipie.getOutput2();
this.output3 = centrifugeRecipie.getOutput3(); this.output3 = centrifugeRecipie.getOutput3();
this.output4 = centrifugeRecipie.getOutput4(); this.output4 = centrifugeRecipie.getOutput4();
this.tickTime = centrifugeRecipie.getTickTime(); this.tickTime = centrifugeRecipie.getTickTime();
this.cells = centrifugeRecipie.getCells(); this.cells = centrifugeRecipie.getCells();
} }
public ItemStack getInputItem() { public ItemStack getInputItem() {
return inputItem; return inputItem;
} }
public ItemStack getOutput1() { public ItemStack getOutput1() {
return output1; return output1;
} }
public ItemStack getOutput2() { public ItemStack getOutput2() {
return output2; return output2;
} }
public ItemStack getOutput3() { public ItemStack getOutput3() {
return output3; return output3;
} }
public ItemStack getOutput4() { public ItemStack getOutput4() {
return output4; return output4;
} }
public int getTickTime() { public int getTickTime() {
return tickTime; return tickTime;
} }
public int getCells() { public int getCells() {
return cells; return cells;
} }
} }

View file

@ -4,119 +4,114 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class RollingMachineRecipie { public class RollingMachineRecipie {
ItemStack inputItem1, inputItem2, inputItem3, inputItem4 ,inputItem5, inputItem6, ItemStack inputItem1, inputItem2, inputItem3, inputItem4, inputItem5, inputItem6,
inputItem7, inputItem8, inputItem9; inputItem7, inputItem8, inputItem9;
ItemStack output1; ItemStack output1;
int tickTime; int tickTime;
public RollingMachineRecipie(ItemStack inputItem1, ItemStack inputItem2, ItemStack inputItem3, ItemStack inputItem4, public RollingMachineRecipie(ItemStack inputItem1, ItemStack inputItem2, ItemStack inputItem3, ItemStack inputItem4,
ItemStack inputItem5, ItemStack inputItem6, ItemStack inputItem7, ItemStack inputItem8,ItemStack inputItem9, ItemStack inputItem5, ItemStack inputItem6, ItemStack inputItem7, ItemStack inputItem8, ItemStack inputItem9,
ItemStack output1, int tickTime) ItemStack output1, int tickTime) {
{ this.inputItem1 = inputItem1;
this.inputItem1 = inputItem1; this.inputItem2 = inputItem2;
this.inputItem2 = inputItem2; this.inputItem3 = inputItem3;
this.inputItem3 = inputItem3; this.inputItem4 = inputItem4;
this.inputItem4 = inputItem4; this.inputItem5 = inputItem5;
this.inputItem5 = inputItem5; this.inputItem6 = inputItem6;
this.inputItem6 = inputItem6; this.inputItem7 = inputItem7;
this.inputItem7 = inputItem7; this.inputItem8 = inputItem8;
this.inputItem8 = inputItem8; this.inputItem9 = inputItem9;
this.inputItem9 = inputItem9; this.output1 = output1;
this.output1 = output1; this.tickTime = tickTime;
this.tickTime = tickTime;
} }
public RollingMachineRecipie(Item inputItem1,Item inputItem2, Item inputItem3, Item inputItem4, Item inputItem5, public RollingMachineRecipie(Item inputItem1, Item inputItem2, Item inputItem3, Item inputItem4, Item inputItem5,
Item inputItem6, Item inputItem7, Item inputItem8, Item inputItem9, int inputAmount, Item inputItem6, Item inputItem7, Item inputItem8, Item inputItem9, int inputAmount,
Item output1, int tickTime) { Item output1, int tickTime) {
if(inputItem1 != null) if (inputItem1 != null)
this.inputItem1 = new ItemStack(inputItem1, inputAmount); this.inputItem1 = new ItemStack(inputItem1, inputAmount);
if(inputItem2 != null) if (inputItem2 != null)
this.inputItem2 = new ItemStack(inputItem2, inputAmount); this.inputItem2 = new ItemStack(inputItem2, inputAmount);
if(inputItem3 != null) if (inputItem3 != null)
this.inputItem3 = new ItemStack(inputItem3, inputAmount); this.inputItem3 = new ItemStack(inputItem3, inputAmount);
if(inputItem4 != null) if (inputItem4 != null)
this.inputItem4 = new ItemStack(inputItem4, inputAmount); this.inputItem4 = new ItemStack(inputItem4, inputAmount);
if(inputItem5 != null) if (inputItem5 != null)
this.inputItem5 = new ItemStack(inputItem5, inputAmount); this.inputItem5 = new ItemStack(inputItem5, inputAmount);
if(inputItem6 != null) if (inputItem6 != null)
this.inputItem6 = new ItemStack(inputItem6, inputAmount); this.inputItem6 = new ItemStack(inputItem6, inputAmount);
if(inputItem7 != null) if (inputItem7 != null)
this.inputItem7 = new ItemStack(inputItem7, inputAmount); this.inputItem7 = new ItemStack(inputItem7, inputAmount);
if(inputItem8 != null) if (inputItem8 != null)
this.inputItem8 = new ItemStack(inputItem8, inputAmount); this.inputItem8 = new ItemStack(inputItem8, inputAmount);
if(inputItem9 != null) if (inputItem9 != null)
this.inputItem9 = new ItemStack(inputItem9, inputAmount); this.inputItem9 = new ItemStack(inputItem9, inputAmount);
this.output1 = new ItemStack(output1); this.output1 = new ItemStack(output1);
this.tickTime = tickTime; this.tickTime = tickTime;
; ;
} }
public RollingMachineRecipie(RollingMachineRecipie rollingmachineRecipie) public RollingMachineRecipie(RollingMachineRecipie rollingmachineRecipie) {
{ this.inputItem1 = rollingmachineRecipie.getInputItem1();
this.inputItem1 = rollingmachineRecipie.getInputItem1(); this.inputItem2 = rollingmachineRecipie.getInputItem2();
this.inputItem2 = rollingmachineRecipie.getInputItem2(); this.inputItem3 = rollingmachineRecipie.getInputItem3();
this.inputItem3 = rollingmachineRecipie.getInputItem3(); this.inputItem4 = rollingmachineRecipie.getInputItem4();
this.inputItem4 = rollingmachineRecipie.getInputItem4(); this.inputItem5 = rollingmachineRecipie.getInputItem5();
this.inputItem5 = rollingmachineRecipie.getInputItem5(); this.inputItem6 = rollingmachineRecipie.getInputItem6();
this.inputItem6 = rollingmachineRecipie.getInputItem6(); this.inputItem7 = rollingmachineRecipie.getInputItem7();
this.inputItem7 = rollingmachineRecipie.getInputItem7(); this.inputItem8 = rollingmachineRecipie.getInputItem8();
this.inputItem8 = rollingmachineRecipie.getInputItem8(); this.inputItem9 = rollingmachineRecipie.getInputItem9();
this.inputItem9 = rollingmachineRecipie.getInputItem9();
this.output1 = rollingmachineRecipie.getOutput1(); this.output1 = rollingmachineRecipie.getOutput1();
this.tickTime = rollingmachineRecipie.getTickTime(); this.tickTime = rollingmachineRecipie.getTickTime();
} }
public ItemStack getInputItem1() public ItemStack getInputItem1() {
{ return inputItem1;
return inputItem1; }
}
public ItemStack getInputItem2()
{
return inputItem2;
}
public ItemStack getInputItem3()
{
return inputItem3;
}
public ItemStack getInputItem4()
{
return inputItem4;
}
public ItemStack getInputItem5()
{
return inputItem5;
}
public ItemStack getInputItem6()
{
return inputItem6;
}
public ItemStack getInputItem7()
{
return inputItem7;
}
public ItemStack getInputItem8()
{
return inputItem8;
}
public ItemStack getInputItem9()
{
return inputItem9;
}
public ItemStack getOutput1() public ItemStack getInputItem2() {
{ return inputItem2;
return output1; }
}
public int getTickTime() public ItemStack getInputItem3() {
{ return inputItem3;
return tickTime; }
}
public ItemStack getInputItem4() {
return inputItem4;
}
public ItemStack getInputItem5() {
return inputItem5;
}
public ItemStack getInputItem6() {
return inputItem6;
}
public ItemStack getInputItem7() {
return inputItem7;
}
public ItemStack getInputItem8() {
return inputItem8;
}
public ItemStack getInputItem9() {
return inputItem9;
}
public ItemStack getOutput1() {
return output1;
}
public int getTickTime() {
return tickTime;
}
} }

View file

@ -1,53 +1,51 @@
package techreborn.api; package techreborn.api;
import java.util.ArrayList;
import techreborn.util.ItemUtils; import techreborn.util.ItemUtils;
import java.util.ArrayList;
public final class TechRebornAPI { public final class TechRebornAPI {
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>(); public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
public static ArrayList<RollingMachineRecipie> rollingmachineRecipes = new ArrayList<RollingMachineRecipie>(); public static ArrayList<RollingMachineRecipie> rollingmachineRecipes = new ArrayList<RollingMachineRecipie>();
public static void registerCentrifugeRecipe(CentrifugeRecipie recipie){ public static void registerCentrifugeRecipe(CentrifugeRecipie recipie) {
boolean shouldAdd = true; boolean shouldAdd = true;
for(CentrifugeRecipie centrifugeRecipie : centrifugeRecipies){ for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies) {
if(ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem(), false, true)){ if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem(), false, true)) {
try { try {
throw new RegisteredItemRecipe("Item " + recipie.getInputItem().getUnlocalizedName() + " is already being used in a recipe for the Centrifuge"); throw new RegisteredItemRecipe("Item " + recipie.getInputItem().getUnlocalizedName() + " is already being used in a recipe for the Centrifuge");
} catch (RegisteredItemRecipe registeredItemRecipe) { } catch (RegisteredItemRecipe registeredItemRecipe) {
registeredItemRecipe.printStackTrace(); registeredItemRecipe.printStackTrace();
shouldAdd = false; shouldAdd = false;
} }
} }
} }
if(shouldAdd) if (shouldAdd)
centrifugeRecipies.add(recipie); centrifugeRecipies.add(recipie);
} }
public static void registerRollingMachineRecipe(RollingMachineRecipie recipie){ public static void registerRollingMachineRecipe(RollingMachineRecipie recipie) {
boolean shouldAdd = true; boolean shouldAdd = true;
for(CentrifugeRecipie centrifugeRecipie : centrifugeRecipies){ for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies) {
if(ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem1(), false, true)){ if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem1(), false, true)) {
try { try {
throw new RegisteredItemRecipe("Item " + recipie.getInputItem1().getUnlocalizedName() + " is already being used in a recipe for the RollingMachine"); throw new RegisteredItemRecipe("Item " + recipie.getInputItem1().getUnlocalizedName() + " is already being used in a recipe for the RollingMachine");
} catch (RegisteredItemRecipe registeredItemRecipe) { } catch (RegisteredItemRecipe registeredItemRecipe) {
registeredItemRecipe.printStackTrace(); registeredItemRecipe.printStackTrace();
shouldAdd = false; shouldAdd = false;
} }
} }
} }
if(shouldAdd) if (shouldAdd)
rollingmachineRecipes.add(recipie); rollingmachineRecipes.add(recipie);
} }
} }
class RegisteredItemRecipe extends Exception class RegisteredItemRecipe extends Exception {
{ public RegisteredItemRecipe(String message) {
public RegisteredItemRecipe(String message) super(message);
{ }
super(message);
}
} }

View file

@ -1,5 +1,3 @@
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api;
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI")
package techreborn.api;
import cpw.mods.fml.common.API; import cpw.mods.fml.common.API;

View file

@ -11,7 +11,7 @@ import techreborn.tiles.TileCentrifuge;
public class BlockCentrifuge extends BlockContainer { public class BlockCentrifuge extends BlockContainer {
public BlockCentrifuge(){ public BlockCentrifuge() {
super(Material.piston); super(Material.piston);
} }
@ -22,7 +22,7 @@ public class BlockCentrifuge extends BlockContainer {
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z);
return true; return true;
} }

View file

@ -1,8 +1,7 @@
package techreborn.blocks; package techreborn.blocks;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import java.util.Random; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -13,76 +12,67 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockOre extends Block{ import java.util.List;
import java.util.Random;
public static final String[] types = new String[] public class BlockOre extends Block {
{
"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", "Sphalerite",
"Tungston","Sheldonite", "Olivine", "Sodalite"
};
private IIcon[] textures; public static final String[] types = new String[]
{
"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", "Sphalerite",
"Tungston", "Sheldonite", "Olivine", "Sodalite"
};
public BlockOre(Material material) private IIcon[] textures;
{
super(material);
setBlockName("techreborn.ore");
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(1f);
}
@Override public BlockOre(Material material) {
public Item getItemDropped(int meta, Random random, int fortune) super(material);
{ setBlockName("techreborn.ore");
return Item.getItemFromBlock(this); setCreativeTab(TechRebornCreativeTab.instance);
} setHardness(1f);
}
@Override @Override
@SideOnly(Side.CLIENT) public Item getItemDropped(int meta, Random random, int fortune) {
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) return Item.getItemFromBlock(this);
{ }
for (int meta = 0; meta < types.length; meta++)
{
list.add(new ItemStack(item, 1, meta));
}
}
@Override @Override
public int damageDropped(int metaData) @SideOnly(Side.CLIENT)
{ public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
//TODO RubyOre Returns Rubys for (int meta = 0; meta < types.length; meta++) {
return metaData; list.add(new ItemStack(item, 1, meta));
} }
}
@Override @Override
@SideOnly(Side.CLIENT) public int damageDropped(int metaData) {
public void registerBlockIcons(IIconRegister iconRegister) //TODO RubyOre Returns Rubys
{ return metaData;
this.textures = new IIcon[types.length]; }
for (int i = 0; i < types.length; i++) @Override
{ @SideOnly(Side.CLIENT)
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore"+types[i]); public void registerBlockIcons(IIconRegister iconRegister) {
} this.textures = new IIcon[types.length];
}
@Override for (int i = 0; i < types.length; i++) {
@SideOnly(Side.CLIENT) textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore" + types[i]);
public IIcon getIcon(int side, int metaData) }
{ }
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP @Override
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) @SideOnly(Side.CLIENT)
{ public IIcon getIcon(int side, int metaData) {
return textures[metaData]; metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
} else {
return textures[metaData]; if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
} || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
} return textures[metaData];
} else {
return textures[metaData];
}
}
} }

View file

@ -1,5 +1,7 @@
package techreborn.blocks; package techreborn.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -10,8 +12,6 @@ import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.tiles.TileQuantumChest; import techreborn.tiles.TileQuantumChest;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumChest extends BlockContainer { public class BlockQuantumChest extends BlockContainer {
@ -33,7 +33,7 @@ public class BlockQuantumChest extends BlockContainer {
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x, y, z);
return true; return true;
} }

View file

@ -1,5 +1,7 @@
package techreborn.blocks; package techreborn.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -10,8 +12,6 @@ import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.tiles.TileQuantumTank; import techreborn.tiles.TileQuantumTank;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumTank extends BlockContainer { public class BlockQuantumTank extends BlockContainer {
@ -32,7 +32,7 @@ public class BlockQuantumTank extends BlockContainer {
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
return true; return true;
} }

View file

@ -2,11 +2,6 @@ package techreborn.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileRollingMachine;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -14,47 +9,47 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileRollingMachine;
public class BlockRollingMachine extends BlockContainer{ public class BlockRollingMachine extends BlockContainer {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon top; private IIcon top;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon other; private IIcon other;
public BlockRollingMachine(Material material) public BlockRollingMachine(Material material) {
{ super(material.piston);
super(material.piston); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.rollingmachine");
setBlockName("techreborn.rollingmachine");
setHardness(2f); setHardness(2f);
} }
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return new TileRollingMachine();
return new TileRollingMachine(); }
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
return true; return true;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{
top = icon.registerIcon("techreborn:machine/rollingmachine_top"); top = icon.registerIcon("techreborn:machine/rollingmachine_top");
other = icon.registerIcon("techreborn:machine/rollingmachine_side"); other = icon.registerIcon("techreborn:machine/rollingmachine_side");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int currentSide, int meta) public IIcon getIcon(int currentSide, int meta) {
{
if (currentSide == 1) { if (currentSide == 1) {
return top; return top;
} else { } else {

View file

@ -1,8 +1,7 @@
package techreborn.blocks; package techreborn.blocks;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import java.util.Random; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -13,74 +12,66 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockStorage extends Block{ import java.util.List;
import java.util.Random;
public static final String[] types = new String[] public class BlockStorage extends Block {
{
"Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire", "Chrome", "Electrum", "Tungsten",
"Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
};
private IIcon[] textures; public static final String[] types = new String[]
{
"Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire", "Chrome", "Electrum", "Tungsten",
"Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
};
public BlockStorage(Material material) private IIcon[] textures;
{
super(material);
setBlockName("techreborn.storage");
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(2f);
}
@Override public BlockStorage(Material material) {
public Item getItemDropped(int par1, Random random, int par2) super(material);
{ setBlockName("techreborn.storage");
return Item.getItemFromBlock(this); setCreativeTab(TechRebornCreativeTab.instance);
} setHardness(2f);
}
@Override @Override
@SideOnly(Side.CLIENT) public Item getItemDropped(int par1, Random random, int par2) {
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) return Item.getItemFromBlock(this);
{ }
for (int meta = 0; meta < types.length; meta++)
{
list.add(new ItemStack(item, 1, meta));
}
}
@Override @Override
public int damageDropped(int metaData) @SideOnly(Side.CLIENT)
{ public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
return metaData; for (int meta = 0; meta < types.length; meta++) {
} list.add(new ItemStack(item, 1, meta));
}
}
@Override @Override
@SideOnly(Side.CLIENT) public int damageDropped(int metaData) {
public void registerBlockIcons(IIconRegister iconRegister) return metaData;
{ }
this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) @Override
{ @SideOnly(Side.CLIENT)
textures[i] = iconRegister.registerIcon("techreborn:" + "storage/storage"+types[i]); public void registerBlockIcons(IIconRegister iconRegister) {
} this.textures = new IIcon[types.length];
}
@Override for (int i = 0; i < types.length; i++) {
@SideOnly(Side.CLIENT) textures[i] = iconRegister.registerIcon("techreborn:" + "storage/storage" + types[i]);
public IIcon getIcon(int side, int metaData) }
{ }
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP @Override
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) @SideOnly(Side.CLIENT)
{ public IIcon getIcon(int side, int metaData) {
return textures[metaData]; metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
} else {
return textures[metaData]; if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
} || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
} return textures[metaData];
} else {
return textures[metaData];
}
}
} }

View file

@ -1,7 +1,7 @@
package techreborn.blocks; package techreborn.blocks;
import java.util.Random; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -14,8 +14,8 @@ import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.tiles.TileThermalGenerator; import techreborn.tiles.TileThermalGenerator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import java.util.Random;
public class BlockThermalGenerator extends BlockContainer { public class BlockThermalGenerator extends BlockContainer {
@ -55,7 +55,7 @@ public class BlockThermalGenerator extends BlockContainer {
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z);
return true; return true;
} }

View file

@ -1,24 +1,12 @@
package techreborn.client; package techreborn.client;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.client.container.ContainerCentrifuge; import techreborn.client.container.*;
import techreborn.client.container.ContainerQuantumChest; import techreborn.client.gui.*;
import techreborn.client.container.ContainerQuantumTank; import techreborn.tiles.*;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.client.container.ContainerThermalGenerator;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.client.gui.GuiQuantumChest;
import techreborn.client.gui.GuiQuantumTank;
import techreborn.client.gui.GuiRollingMachine;
import techreborn.client.gui.GuiThermalGenerator;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileQuantumTank;
import techreborn.tiles.TileRollingMachine;
import techreborn.tiles.TileThermalGenerator;
import cpw.mods.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler { public class GuiHandler implements IGuiHandler {
@ -26,20 +14,20 @@ public class GuiHandler implements IGuiHandler {
public static final int quantumTankID = 1; public static final int quantumTankID = 1;
public static final int quantumChestID = 2; public static final int quantumChestID = 2;
public static final int centrifugeID = 3; public static final int centrifugeID = 3;
public static final int rollingMachineID =4; public static final int rollingMachineID = 4;
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID == thermalGeneratorID){ if (ID == thermalGeneratorID) {
return new ContainerThermalGenerator((TileThermalGenerator) world.getTileEntity(x, y, z), player); return new ContainerThermalGenerator((TileThermalGenerator) world.getTileEntity(x, y, z), player);
} else if(ID == quantumTankID){ } else if (ID == quantumTankID) {
return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(x, y, z), player); return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(x, y, z), player);
} else if(ID == quantumChestID){ } else if (ID == quantumChestID) {
return new ContainerQuantumChest((TileQuantumChest) world.getTileEntity(x, y, z), player); return new ContainerQuantumChest((TileQuantumChest) world.getTileEntity(x, y, z), player);
} else if(ID == centrifugeID){ } else if (ID == centrifugeID) {
return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(x, y, z), player); return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(x, y, z), player);
} else if(ID == rollingMachineID){ } else if (ID == rollingMachineID) {
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(x, y, z), player); return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(x, y, z), player);
} }
@ -48,16 +36,16 @@ public class GuiHandler implements IGuiHandler {
@Override @Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID == thermalGeneratorID){ if (ID == thermalGeneratorID) {
return new GuiThermalGenerator(player, (TileThermalGenerator)world.getTileEntity(x, y, z)); return new GuiThermalGenerator(player, (TileThermalGenerator) world.getTileEntity(x, y, z));
} else if(ID == quantumTankID){ } else if (ID == quantumTankID) {
return new GuiQuantumTank(player, (TileQuantumTank)world.getTileEntity(x, y, z)); return new GuiQuantumTank(player, (TileQuantumTank) world.getTileEntity(x, y, z));
} else if(ID == quantumChestID){ } else if (ID == quantumChestID) {
return new GuiQuantumChest(player, (TileQuantumChest)world.getTileEntity(x, y, z)); return new GuiQuantumChest(player, (TileQuantumChest) world.getTileEntity(x, y, z));
} else if(ID == centrifugeID){ } else if (ID == centrifugeID) {
return new GuiCentrifuge(player, (TileCentrifuge)world.getTileEntity(x, y, z)); return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(x, y, z));
} else if(ID == rollingMachineID){ } else if (ID == rollingMachineID) {
return new GuiRollingMachine(player, (TileRollingMachine)world.getTileEntity(x, y, z)); return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(x, y, z));
} }
return null; return null;
} }

View file

@ -6,14 +6,14 @@ import techreborn.init.ModBlocks;
public class TechRebornCreativeTab extends CreativeTabs { public class TechRebornCreativeTab extends CreativeTabs {
public static TechRebornCreativeTab instance = new TechRebornCreativeTab(); public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
public TechRebornCreativeTab() { public TechRebornCreativeTab() {
super("techreborn"); super("techreborn");
} }
@Override @Override
public Item getTabIconItem() { public Item getTabIconItem() {
return Item.getItemFromBlock(ModBlocks.thermalGenerator); return Item.getItemFromBlock(ModBlocks.thermalGenerator);
} }
} }

View file

@ -14,7 +14,7 @@ public class ContainerCentrifuge extends TechRebornContainer {
public int tickTime; public int tickTime;
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player){ public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) {
tile = tileCentrifuge; tile = tileCentrifuge;
this.player = player; this.player = player;
@ -58,7 +58,7 @@ public class ContainerCentrifuge extends TechRebornContainer {
public void detectAndSendChanges() { public void detectAndSendChanges() {
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) { for (int i = 0; i < this.crafters.size(); ++i) {
ICrafting icrafting = (ICrafting)this.crafters.get(i); ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.tickTime != this.tile.tickTime) { if (this.tickTime != this.tile.tickTime) {
icrafting.sendProgressBarUpdate(this, 0, this.tile.tickTime); icrafting.sendProgressBarUpdate(this, 0, this.tile.tickTime);
} }

View file

@ -21,16 +21,13 @@ public class ContainerQuantumTank extends TechRebornContainer {
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
} }
} }
for (i = 0; i < 9; ++i) for (i = 0; i < 9; ++i) {
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
} }
} }

View file

@ -1,50 +1,49 @@
package techreborn.client.container; package techreborn.client.container;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileRollingMachine;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileRollingMachine;
public class ContainerRollingMachine extends TechRebornContainer{ public class ContainerRollingMachine extends TechRebornContainer {
EntityPlayer player; EntityPlayer player;
TileRollingMachine tile; TileRollingMachine tile;
public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player){ public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player) {
tile = tileRollingmachine; tile = tileRollingmachine;
this.player = player; this.player = player;
//input //input
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 0, 30, 17)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 0, 30, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 1, 30, 35)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 1, 30, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 30, 53)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 30, 53));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 3, 48, 17)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 3, 48, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 4, 48, 35)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 4, 48, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 5, 48, 53)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 5, 48, 53));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 6, 66, 17)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 6, 66, 17));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 7, 66, 35)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 7, 66, 35));
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 8, 66, 53)); this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 8, 66, 53));
//outputs //outputs
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 9, 124, 35)); this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 9, 124, 35));
int i; int i;
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) { for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
} }
} }
for (i = 0; i < 9; ++i) { for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
} }
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
return true; return true;
} }
} }

View file

@ -21,16 +21,13 @@ public class ContainerThermalGenerator extends TechRebornContainer {
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
} }
} }
for (i = 0; i < 9; ++i) for (i = 0; i < 9; ++i) {
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
} }
} }

View file

@ -28,8 +28,7 @@ public class GuiCentrifuge extends GuiContainer {
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
{
this.fontRendererObj.drawString("Centrifuge", 110, 6, 4210752); this.fontRendererObj.drawString("Centrifuge", 110, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(centrifuge.tickTime + " " + centrifuge.isRunning, 110, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(centrifuge.tickTime + " " + centrifuge.isRunning, 110, this.ySize - 96 + 2, 4210752);

View file

@ -26,15 +26,14 @@ public class GuiQuantumChest extends GuiContainer {
this.mc.getTextureManager().bindTexture(texture); this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l , 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
{
this.fontRendererObj.drawString("Quantum Chest", 8, 6, 4210752); this.fontRendererObj.drawString("Quantum Chest", 8, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Amount", 10, 20, 16448255); this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
if(tile.storedItem != null) if (tile.storedItem != null)
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10, 30, 16448255); this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10, 30, 16448255);
} }
} }

View file

@ -25,11 +25,10 @@ public class GuiQuantumTank extends GuiContainer {
this.mc.getTextureManager().bindTexture(texture); this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l , 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
{
this.fontRendererObj.drawString("Quantum Tank", 8, 6, 4210752); this.fontRendererObj.drawString("Quantum Tank", 8, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255); this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);

View file

@ -1,33 +1,29 @@
package techreborn.client.gui; package techreborn.client.gui;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileRollingMachine;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.tiles.TileRollingMachine;
public class GuiRollingMachine extends GuiContainer{ public class GuiRollingMachine extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/rollingmachine.png"); private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/rollingmachine.png");
TileRollingMachine rollingMachine; TileRollingMachine rollingMachine;
public GuiRollingMachine(EntityPlayer player, TileRollingMachine tileRollingmachine) public GuiRollingMachine(EntityPlayer player, TileRollingMachine tileRollingmachine) {
{
super(new ContainerRollingMachine(tileRollingmachine, player)); super(new ContainerRollingMachine(tileRollingmachine, player));
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
rollingMachine = tileRollingmachine; rollingMachine = tileRollingmachine;
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
{ this.mc.getTextureManager().bindTexture(texture);
this.mc.getTextureManager().bindTexture(texture); int k = (this.width - this.xSize) / 2;
int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2;
int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); }
}
} }

View file

@ -25,11 +25,10 @@ public class GuiThermalGenerator extends GuiContainer {
this.mc.getTextureManager().bindTexture(texture); this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l , 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
{
this.fontRendererObj.drawString("Thermal Generator", 8, 6, 4210752); this.fontRendererObj.drawString("Thermal Generator", 8, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255); this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);

View file

@ -1,14 +1,14 @@
package techreborn.compat; package techreborn.compat;
import techreborn.compat.waila.CompatModuleWaila;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import techreborn.compat.waila.CompatModuleWaila;
public class CompatManager { public class CompatManager {
public static void init(FMLInitializationEvent event) { public static void init(FMLInitializationEvent event) {
if(Loader.isModLoaded("Waila")){ if (Loader.isModLoaded("Waila")) {
new CompatModuleWaila().init(event); new CompatModuleWaila().init(event);
} }
} }
} }

View file

@ -20,138 +20,138 @@ import java.util.List;
public class CentrifugeRecipeHandler extends TemplateRecipeHandler { public class CentrifugeRecipeHandler extends TemplateRecipeHandler {
public class CachedCentrifugeRecipe extends CachedRecipe { public class CachedCentrifugeRecipe extends CachedRecipe {
private List<PositionedStack> input = new ArrayList<PositionedStack>(); private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>(); private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus; public Point focus;
public CentrifugeRecipie centrifugeRecipie; public CentrifugeRecipie centrifugeRecipie;
public CachedCentrifugeRecipe(CentrifugeRecipie recipie) { public CachedCentrifugeRecipe(CentrifugeRecipie recipie) {
this.centrifugeRecipie = recipie; this.centrifugeRecipie = recipie;
int offset = 4; int offset = 4;
PositionedStack pStack = new PositionedStack(recipie.getInputItem(), 80 - offset, 35 - offset); PositionedStack pStack = new PositionedStack(recipie.getInputItem(), 80 - offset, 35 - offset);
pStack.setMaxSize(1); pStack.setMaxSize(1);
this.input.add(pStack); this.input.add(pStack);
if(recipie.getOutput1() != null){ if (recipie.getOutput1() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput1(), 80 - offset, 5 - offset)); this.outputs.add(new PositionedStack(recipie.getOutput1(), 80 - offset, 5 - offset));
} }
if(recipie.getOutput2() != null){ if (recipie.getOutput2() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput2(), 110 - offset, 35 - offset)); this.outputs.add(new PositionedStack(recipie.getOutput2(), 110 - offset, 35 - offset));
} }
if(recipie.getOutput3() != null){ if (recipie.getOutput3() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput3(), 80 - offset, 65 - offset)); this.outputs.add(new PositionedStack(recipie.getOutput3(), 80 - offset, 65 - offset));
} }
if(recipie.getOutput4() != null){ if (recipie.getOutput4() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput4(), 50 - offset, 35 - offset)); this.outputs.add(new PositionedStack(recipie.getOutput4(), 50 - offset, 35 - offset));
} }
ItemStack cellStack = IC2Items.getItem("cell"); ItemStack cellStack = IC2Items.getItem("cell");
cellStack.stackSize = recipie.getCells(); cellStack.stackSize = recipie.getCells();
this.outputs.add(new PositionedStack(cellStack, 50 - offset, 5 - offset)); this.outputs.add(new PositionedStack(cellStack, 50 - offset, 5 - offset));
} }
@Override @Override
public List<PositionedStack> getIngredients() { public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input); return this.getCycledIngredients(cycleticks / 20, this.input);
} }
@Override @Override
public List<PositionedStack> getOtherStacks() { public List<PositionedStack> getOtherStacks() {
return this.outputs; return this.outputs;
} }
@Override @Override
public PositionedStack getResult() { public PositionedStack getResult() {
return null; return null;
} }
} }
@Override @Override
public String getRecipeName() { public String getRecipeName() {
return "Centrifuge"; return "Centrifuge";
} }
@Override @Override
public String getGuiTexture() { public String getGuiTexture() {
return "techreborn:textures/gui/centrifuge.png"; return "techreborn:textures/gui/centrifuge.png";
} }
@Override @Override
public Class<? extends GuiContainer> getGuiClass() { public Class<? extends GuiContainer> getGuiClass() {
return GuiCentrifuge.class; return GuiCentrifuge.class;
} }
@Override @Override
public void drawBackground(int recipeIndex) { public void drawBackground(int recipeIndex) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture()); GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78); GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
GuiDraw.drawTooltipBox(10, 80, 145, 50); GuiDraw.drawTooltipBox(10, 80, 145, 50);
GuiDraw.drawString("Info:", 14, 84, -1); GuiDraw.drawString("Info:", 14, 84, -1);
CachedRecipe recipe = arecipes.get(recipeIndex); CachedRecipe recipe = arecipes.get(recipeIndex);
if(recipe instanceof CachedCentrifugeRecipe){ if (recipe instanceof CachedCentrifugeRecipe) {
CachedCentrifugeRecipe centrifugeRecipie = (CachedCentrifugeRecipe) recipe; CachedCentrifugeRecipe centrifugeRecipie = (CachedCentrifugeRecipe) recipe;
GuiDraw.drawString("EU needed: " + (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie.getTickTime()), 14, 94, -1); GuiDraw.drawString("EU needed: " + (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie.getTickTime()), 14, 94, -1);
GuiDraw.drawString("Ticks to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime(), 14, 104, -1); GuiDraw.drawString("Ticks to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime(), 14, 104, -1);
GuiDraw.drawString("Time to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime() / 20 + " seconds" , 14, 114, -1); GuiDraw.drawString("Time to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime() / 20 + " seconds", 14, 114, -1);
} }
} }
@Override @Override
public int recipiesPerPage() { public int recipiesPerPage() {
return 1; return 1;
} }
@Override @Override
public void loadTransferRects() { public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(75, 22, 15, 13), "tr.centrifuge", new Object[0])); this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(75, 22, 15, 13), "tr.centrifuge", new Object[0]));
} }
public void loadCraftingRecipes(String outputId, Object... results) { public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("tr.centrifuge")) { if (outputId.equals("tr.centrifuge")) {
for(CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies){ for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
} else { } else {
super.loadCraftingRecipes(outputId, results); super.loadCraftingRecipes(outputId, results);
} }
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result) { public void loadCraftingRecipes(ItemStack result) {
for(CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies){ for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
if(NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput1(), result)){ if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput1(), result)) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
if(NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput2(), result)){ if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput2(), result)) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
if(NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput3(), result)){ if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput3(), result)) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
if(NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput4(), result)){ if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput4(), result)) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
} }
} }
@Override @Override
public void loadUsageRecipes(ItemStack ingredient) { public void loadUsageRecipes(ItemStack ingredient) {
for(CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies){ for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
if(NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInputItem(), ingredient)){ if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInputItem(), ingredient)) {
addCached(centrifugeRecipie); addCached(centrifugeRecipie);
} }
} }
} }
private void addCached(CentrifugeRecipie recipie) { private void addCached(CentrifugeRecipie recipie) {
this.arecipes.add(new CachedCentrifugeRecipe(recipie)); this.arecipes.add(new CachedCentrifugeRecipe(recipie));
} }
} }

View file

@ -1,30 +1,27 @@
package techreborn.compat.nei; package techreborn.compat.nei;
import techreborn.lib.ModInfo;
import codechicken.nei.api.API; import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI; import codechicken.nei.api.IConfigureNEI;
import techreborn.lib.ModInfo;
public class NEIConfig implements IConfigureNEI{ public class NEIConfig implements IConfigureNEI {
@Override @Override
public String getName() public String getName() {
{ return ModInfo.MOD_ID;
return ModInfo.MOD_ID; }
}
@Override @Override
public String getVersion() public String getVersion() {
{ return ModInfo.MOD_VERSION;
return ModInfo.MOD_VERSION; }
}
@Override @Override
public void loadConfig() public void loadConfig() {
{ CentrifugeRecipeHandler centrifugeRecipeHandler = new CentrifugeRecipeHandler();
CentrifugeRecipeHandler centrifugeRecipeHandler = new CentrifugeRecipeHandler();
API.registerRecipeHandler(centrifugeRecipeHandler); API.registerRecipeHandler(centrifugeRecipeHandler);
API.registerUsageHandler(centrifugeRecipeHandler); API.registerUsageHandler(centrifugeRecipeHandler);
} }
} }

View file

@ -1,17 +1,17 @@
package techreborn.compat.waila; package techreborn.compat.waila;
import mcp.mobius.waila.api.IWailaRegistrar;
import techreborn.tiles.TileMachineBase;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaRegistrar;
import techreborn.tiles.TileMachineBase;
public class CompatModuleWaila { public class CompatModuleWaila {
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister"); FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
} }
public static void callbackRegister(IWailaRegistrar registrar) { public static void callbackRegister(IWailaRegistrar registrar) {
registrar.registerBodyProvider(new WailaProviderMachines(), TileMachineBase.class); registrar.registerBodyProvider(new WailaProviderMachines(), TileMachineBase.class);
} }
} }

View file

@ -1,8 +1,5 @@
package techreborn.compat.waila; package techreborn.compat.waila;
import java.util.ArrayList;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaDataProvider;
@ -13,43 +10,46 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.tiles.TileMachineBase; import techreborn.tiles.TileMachineBase;
import java.util.ArrayList;
import java.util.List;
public class WailaProviderMachines implements IWailaDataProvider { public class WailaProviderMachines implements IWailaDataProvider {
private List<String> info = new ArrayList<String>(); private List<String> info = new ArrayList<String>();
@Override @Override
public List<String> getWailaBody(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) { public List<String> getWailaBody(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileMachineBase machine = (TileMachineBase) accessor.getTileEntity(); TileMachineBase machine = (TileMachineBase) accessor.getTileEntity();
machine.addWailaInfo(info); machine.addWailaInfo(info);
tip.addAll(info); tip.addAll(info);
info.clear(); info.clear();
return tip; return tip;
} }
@Override @Override
public List<String> getWailaHead(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) { public List<String> getWailaHead(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return tip; return tip;
} }
@Override @Override
public List<String> getWailaTail(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) { public List<String> getWailaTail(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return tip; return tip;
} }
@Override @Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null; return null;
} }
@Override @Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World w, int x, int y, int z) { public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World w, int x, int y, int z) {
return tag; return tag;
} }
} }

View file

@ -1,32 +1,32 @@
package techreborn.config; package techreborn.config;
import java.io.File;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import java.io.File;
public class ConfigTechReborn { public class ConfigTechReborn {
private static ConfigTechReborn instance = null; private static ConfigTechReborn instance = null;
public static String CATEGORY_WORLD = "world"; public static String CATEGORY_WORLD = "world";
public static String CATEGORY_POWER = "power"; public static String CATEGORY_POWER = "power";
public static String CATEGORY_CRAFTING = "crafting"; public static String CATEGORY_CRAFTING = "crafting";
//WORLDGEN //WORLDGEN
public static boolean GalenaOreTrue; public static boolean GalenaOreTrue;
public static boolean IridiumOreTrue; public static boolean IridiumOreTrue;
public static boolean RubyOreTrue; public static boolean RubyOreTrue;
public static boolean SapphireOreTrue; public static boolean SapphireOreTrue;
public static boolean BauxiteOreTrue; public static boolean BauxiteOreTrue;
public static boolean PyriteOreTrue; public static boolean PyriteOreTrue;
public static boolean CinnabarOreTrue; public static boolean CinnabarOreTrue;
public static boolean SphaleriteOreTrue; public static boolean SphaleriteOreTrue;
public static boolean TungstonOreTrue; public static boolean TungstonOreTrue;
public static boolean SheldoniteOreTrue; public static boolean SheldoniteOreTrue;
public static boolean OlivineOreTrue; public static boolean OlivineOreTrue;
public static boolean SodaliteOreTrue; public static boolean SodaliteOreTrue;
//Power //Power
public static int ThermalGenertaorOutput; public static int ThermalGenertaorOutput;
public static int CentrifugeInputTick; public static int CentrifugeInputTick;
//Charge //Charge
public static int AdvancedDrillCharge; public static int AdvancedDrillCharge;
public static int LapotronPackCharge; public static int LapotronPackCharge;
@ -34,8 +34,8 @@ public class ConfigTechReborn {
public static int OmniToolCharge; public static int OmniToolCharge;
public static int RockCutterCharge; public static int RockCutterCharge;
public static int GravityCharge; public static int GravityCharge;
public static int CentrifugeCharge; public static int CentrifugeCharge;
public static int ThermalGeneratorCharge; public static int ThermalGeneratorCharge;
//Teir //Teir
public static int AdvancedDrillTier; public static int AdvancedDrillTier;
public static int LapotronPackTier; public static int LapotronPackTier;
@ -43,8 +43,8 @@ public class ConfigTechReborn {
public static int OmniToolTier; public static int OmniToolTier;
public static int RockCutterTier; public static int RockCutterTier;
public static int GravityTier; public static int GravityTier;
public static int CentrifugeTier; public static int CentrifugeTier;
public static int ThermalGeneratorTier; public static int ThermalGeneratorTier;
//Crafting //Crafting
public static boolean ExpensiveMacerator; public static boolean ExpensiveMacerator;
public static boolean ExpensiveDrill; public static boolean ExpensiveDrill;
@ -52,104 +52,97 @@ public class ConfigTechReborn {
public static boolean ExpensiveSolar; public static boolean ExpensiveSolar;
public static Configuration config;
private ConfigTechReborn(File configFile) {
config = new Configuration(configFile);
config.load();
ConfigTechReborn.Configs();
public static Configuration config; config.save();
private ConfigTechReborn(File configFile) }
{
config = new Configuration(configFile);
config.load();
ConfigTechReborn.Configs(); public static ConfigTechReborn initialize(File configFile) {
config.save(); if (instance == null)
instance = new ConfigTechReborn(configFile);
else
throw new IllegalStateException(
"Cannot initialize TechReborn Config twice");
} return instance;
}
public static ConfigTechReborn initialize(File configFile) public static ConfigTechReborn instance() {
{ if (instance == null) {
if (instance == null) throw new IllegalStateException(
instance = new ConfigTechReborn(configFile); "Instance of TechReborn Config requested before initialization");
else }
throw new IllegalStateException( return instance;
"Cannot initialize TechReborn Config twice"); }
return instance; public static void Configs() {
} GalenaOreTrue = config.get(CATEGORY_WORLD,
"Allow GalenaOre", true,
"Allow GalenaOre to be generated in your world.")
.getBoolean(true);
IridiumOreTrue = config.get(CATEGORY_WORLD,
"Allow IridiumOre", true,
"Allow IridiumOre to be generated in your world.")
.getBoolean(true);
RubyOreTrue = config.get(CATEGORY_WORLD,
"Allow RubyOre", true,
"Allow RubyOre to be generated in your world.")
.getBoolean(true);
SapphireOreTrue = config.get(CATEGORY_WORLD,
"Allow SapphireOre", true,
"Allow SapphireOre to be generated in your world.")
.getBoolean(true);
BauxiteOreTrue = config.get(CATEGORY_WORLD,
"Allow BauxiteOre", true,
"Allow BauxiteOre to be generated in your world.")
.getBoolean(true);
PyriteOreTrue = config.get(CATEGORY_WORLD,
"Allow PyriteOre", true,
"Allow PyriteOre to be generated in your world.")
.getBoolean(true);
CinnabarOreTrue = config.get(CATEGORY_WORLD,
"Allow CinnabarOre", true,
"Allow CinnabarOre to be generated in your world.")
.getBoolean(true);
SphaleriteOreTrue = config.get(CATEGORY_WORLD,
"Allow SphaleriteOre", true,
"Allow SphaleriteOre to be generated in your world.")
.getBoolean(true);
TungstonOreTrue = config.get(CATEGORY_WORLD,
"Allow TungstonOre", true,
"Allow TungstonOre to be generated in your world.")
.getBoolean(true);
SheldoniteOreTrue = config.get(CATEGORY_WORLD,
"Allow SheldoniteOre", true,
"Allow SheldoniteOre to be generated in your world.")
.getBoolean(true);
OlivineOreTrue = config.get(CATEGORY_WORLD,
"Allow OlivineOre", true,
"Allow OlivineOre to be generated in your world.")
.getBoolean(true);
SodaliteOreTrue = config.get(CATEGORY_WORLD,
"Allow SodaliteOre", true,
"Allow SodaliteOre to be generated in your world.")
.getBoolean(true);
public static ConfigTechReborn instance() //Power
{
if (instance == null) {
throw new IllegalStateException(
"Instance of TechReborn Config requested before initialization");
}
return instance;
}
public static void Configs()
{
GalenaOreTrue = config.get(CATEGORY_WORLD,
"Allow GalenaOre", true,
"Allow GalenaOre to be generated in your world.")
.getBoolean(true);
IridiumOreTrue = config.get(CATEGORY_WORLD,
"Allow IridiumOre", true,
"Allow IridiumOre to be generated in your world.")
.getBoolean(true);
RubyOreTrue = config.get(CATEGORY_WORLD,
"Allow RubyOre", true,
"Allow RubyOre to be generated in your world.")
.getBoolean(true);
SapphireOreTrue = config.get(CATEGORY_WORLD,
"Allow SapphireOre", true,
"Allow SapphireOre to be generated in your world.")
.getBoolean(true);
BauxiteOreTrue = config.get(CATEGORY_WORLD,
"Allow BauxiteOre", true,
"Allow BauxiteOre to be generated in your world.")
.getBoolean(true);
PyriteOreTrue = config.get(CATEGORY_WORLD,
"Allow PyriteOre", true,
"Allow PyriteOre to be generated in your world.")
.getBoolean(true);
CinnabarOreTrue = config.get(CATEGORY_WORLD,
"Allow CinnabarOre", true,
"Allow CinnabarOre to be generated in your world.")
.getBoolean(true);
SphaleriteOreTrue = config.get(CATEGORY_WORLD,
"Allow SphaleriteOre", true,
"Allow SphaleriteOre to be generated in your world.")
.getBoolean(true);
TungstonOreTrue = config.get(CATEGORY_WORLD,
"Allow TungstonOre", true,
"Allow TungstonOre to be generated in your world.")
.getBoolean(true);
SheldoniteOreTrue = config.get(CATEGORY_WORLD,
"Allow SheldoniteOre", true,
"Allow SheldoniteOre to be generated in your world.")
.getBoolean(true);
OlivineOreTrue = config.get(CATEGORY_WORLD,
"Allow OlivineOre", true,
"Allow OlivineOre to be generated in your world.")
.getBoolean(true);
SodaliteOreTrue = config.get(CATEGORY_WORLD,
"Allow SodaliteOre", true,
"Allow SodaliteOre to be generated in your world.")
.getBoolean(true);
//Power
ThermalGenertaorOutput = config.get(CATEGORY_POWER, ThermalGenertaorOutput = config.get(CATEGORY_POWER,
"Thermal Generator Power", 30, "Thermal Generator Power", 30,
"The amount of power that the thermal generator makes for 1mb of lava") "The amount of power that the thermal generator makes for 1mb of lava")
.getInt(); .getInt();
CentrifugeInputTick = config.get(CATEGORY_POWER, CentrifugeInputTick = config.get(CATEGORY_POWER,
"Centrifuge power usage", 5, "Centrifuge power usage", 5,
"The amount of eu per tick that the Centrifuge uses.") "The amount of eu per tick that the Centrifuge uses.")
.getInt(); .getInt();
//Charge //Charge
AdvancedDrillCharge = config.get(CATEGORY_POWER, AdvancedDrillCharge = config.get(CATEGORY_POWER,
"Advanced drill max charge", 60000, "Advanced drill max charge", 60000,
@ -175,14 +168,14 @@ public class ConfigTechReborn {
"Gravity Chestplate max charge", 100000, "Gravity Chestplate max charge", 100000,
"The amount of power that the Gravity Chestplate can hold") "The amount of power that the Gravity Chestplate can hold")
.getInt(); .getInt();
CentrifugeCharge = config.get(CATEGORY_POWER, CentrifugeCharge = config.get(CATEGORY_POWER,
"Centrifuge max charge", 1000000, "Centrifuge max charge", 1000000,
"The amount of power that the Centrifuge can hold") "The amount of power that the Centrifuge can hold")
.getInt(); .getInt();
ThermalGeneratorCharge = config.get(CATEGORY_POWER, ThermalGeneratorCharge = config.get(CATEGORY_POWER,
"Thermal Generator max charge", 1000000, "Thermal Generator max charge", 1000000,
"The amount of power that the Thermal Generator can hold") "The amount of power that the Thermal Generator can hold")
.getInt(); .getInt();
//Teir //Teir
AdvancedDrillTier = config.get(CATEGORY_POWER, AdvancedDrillTier = config.get(CATEGORY_POWER,
"Advanced drill Tier", 2, "Advanced drill Tier", 2,
@ -208,36 +201,36 @@ public class ConfigTechReborn {
"GravityChestplate tier", 3, "GravityChestplate tier", 3,
"The tier of the GravityChestplate") "The tier of the GravityChestplate")
.getInt(); .getInt();
CentrifugeTier = config.get(CATEGORY_POWER, CentrifugeTier = config.get(CATEGORY_POWER,
"Centrifuge tier", 1, "Centrifuge tier", 1,
"The tier of the Centrifuge") "The tier of the Centrifuge")
.getInt(); .getInt();
ThermalGeneratorTier = config.get(CATEGORY_POWER, ThermalGeneratorTier = config.get(CATEGORY_POWER,
"Thermal Generator tier", 1, "Thermal Generator tier", 1,
"The tier of the Thermal Generator") "The tier of the Thermal Generator")
.getInt(); .getInt();
//Crafting //Crafting
ExpensiveMacerator = config.get(CATEGORY_CRAFTING, ExpensiveMacerator = config.get(CATEGORY_CRAFTING,
"Allow Expensive Macerator", true, "Allow Expensive Macerator", true,
"Allow TechReborn to overwrite the IC2 recipe for Macerator.") "Allow TechReborn to overwrite the IC2 recipe for Macerator.")
.getBoolean(true); .getBoolean(true);
ExpensiveDrill = config.get(CATEGORY_CRAFTING, ExpensiveDrill = config.get(CATEGORY_CRAFTING,
"Allow Expensive Drill", true, "Allow Expensive Drill", true,
"Allow TechReborn to overwrite the IC2 recipe for Drill.") "Allow TechReborn to overwrite the IC2 recipe for Drill.")
.getBoolean(true); .getBoolean(true);
ExpensiveDiamondDrill = config.get(CATEGORY_CRAFTING, ExpensiveDiamondDrill = config.get(CATEGORY_CRAFTING,
"Allow Expensive DiamondDrill", true, "Allow Expensive DiamondDrill", true,
"Allow TechReborn to overwrite the IC2 recipe for DiamondDrill.") "Allow TechReborn to overwrite the IC2 recipe for DiamondDrill.")
.getBoolean(true); .getBoolean(true);
ExpensiveSolar = config.get(CATEGORY_CRAFTING, ExpensiveSolar = config.get(CATEGORY_CRAFTING,
"Allow Expensive Solar panels", true, "Allow Expensive Solar panels", true,
"Allow TechReborn to overwrite the IC2 recipe for Solar panels.") "Allow TechReborn to overwrite the IC2 recipe for Solar panels.")
.getBoolean(true); .getBoolean(true);
if (config.hasChanged()) if (config.hasChanged())
config.save(); config.save();
} }
} }

View file

@ -1,95 +1,87 @@
package techreborn.config; package techreborn.config;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.config.DummyConfigElement; import cpw.mods.fml.client.config.DummyConfigElement;
import cpw.mods.fml.client.config.GuiConfig; import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.config.GuiConfigEntries;
import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry; import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry;
import cpw.mods.fml.client.config.IConfigElement; import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
public class TechRebornConfigGui extends GuiConfig{ import java.util.ArrayList;
public TechRebornConfigGui(GuiScreen top) import java.util.List;
{
super(top, getConfigCategories(), "TechReborn", false, false,
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
.toString()));
}
private static List<IConfigElement> getConfigCategories() public class TechRebornConfigGui extends GuiConfig {
{ public TechRebornConfigGui(GuiScreen top) {
List<IConfigElement> list = new ArrayList<IConfigElement>(); super(top, getConfigCategories(), "TechReborn", false, false,
list.add(new DummyConfigElement.DummyCategoryElement("General", GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
"tr.configgui.category.trGeneral", TRGeneral.class)); .toString()));
list.add(new DummyConfigElement.DummyCategoryElement("World Gen", }
"tr.configgui.category.trWorld", TRWORLD.class));
private static List<IConfigElement> getConfigCategories() {
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyConfigElement.DummyCategoryElement("General",
"tr.configgui.category.trGeneral", TRGeneral.class));
list.add(new DummyConfigElement.DummyCategoryElement("World Gen",
"tr.configgui.category.trWorld", TRWORLD.class));
list.add(new DummyConfigElement.DummyCategoryElement("Power", list.add(new DummyConfigElement.DummyCategoryElement("Power",
"tr.configgui.category.trPower", TRPOWER.class)); "tr.configgui.category.trPower", TRPOWER.class));
list.add(new DummyConfigElement.DummyCategoryElement("Crafting", list.add(new DummyConfigElement.DummyCategoryElement("Crafting",
"tr.configgui.category.trCrafting", TRCRAFTING.class)); "tr.configgui.category.trCrafting", TRCRAFTING.class));
return list; return list;
} }
public static class TRGeneral extends CategoryEntry { public static class TRGeneral extends CategoryEntry {
public TRGeneral(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) public TRGeneral(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
{
super(owningScreen, owningEntryList, configElement);
}
@Override
protected GuiScreen buildChildScreen()
{
return new GuiConfig(this.owningScreen,
(new ConfigElement(ConfigTechReborn.config
.getCategory(Configuration.CATEGORY_GENERAL)))
.getChildElements(), this.owningScreen.modID,
Configuration.CATEGORY_GENERAL,
this.configElement.requiresWorldRestart()|| this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart()|| this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config.toString()));
}
}
// World
public static class TRWORLD extends CategoryEntry {
public TRWORLD(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement)
{
super(owningScreen, owningEntryList, configElement);
}
@Override
protected GuiScreen buildChildScreen()
{
return new GuiConfig(this.owningScreen,
(new ConfigElement(ConfigTechReborn.config
.getCategory(ConfigTechReborn.CATEGORY_WORLD)))
.getChildElements(), this.owningScreen.modID,
Configuration.CATEGORY_GENERAL,
this.configElement.requiresWorldRestart()
|| this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart()
|| this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
.toString()));
}
}
// Power
public static class TRPOWER extends CategoryEntry {
public TRPOWER(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement)
{
super(owningScreen, owningEntryList, configElement); super(owningScreen, owningEntryList, configElement);
} }
@Override @Override
protected GuiScreen buildChildScreen() protected GuiScreen buildChildScreen() {
{ return new GuiConfig(this.owningScreen,
(new ConfigElement(ConfigTechReborn.config
.getCategory(Configuration.CATEGORY_GENERAL)))
.getChildElements(), this.owningScreen.modID,
Configuration.CATEGORY_GENERAL,
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config.toString()));
}
}
// World
public static class TRWORLD extends CategoryEntry {
public TRWORLD(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
super(owningScreen, owningEntryList, configElement);
}
@Override
protected GuiScreen buildChildScreen() {
return new GuiConfig(this.owningScreen,
(new ConfigElement(ConfigTechReborn.config
.getCategory(ConfigTechReborn.CATEGORY_WORLD)))
.getChildElements(), this.owningScreen.modID,
Configuration.CATEGORY_GENERAL,
this.configElement.requiresWorldRestart()
|| this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart()
|| this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
.toString()));
}
}
// Power
public static class TRPOWER extends CategoryEntry {
public TRPOWER(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
super(owningScreen, owningEntryList, configElement);
}
@Override
protected GuiScreen buildChildScreen() {
return new GuiConfig(this.owningScreen, return new GuiConfig(this.owningScreen,
(new ConfigElement(ConfigTechReborn.config (new ConfigElement(ConfigTechReborn.config
.getCategory(ConfigTechReborn.CATEGORY_POWER))) .getCategory(ConfigTechReborn.CATEGORY_POWER)))
@ -104,27 +96,25 @@ public class TechRebornConfigGui extends GuiConfig{
} }
} }
// Crafting // Crafting
public static class TRCRAFTING extends CategoryEntry { public static class TRCRAFTING extends CategoryEntry {
public TRCRAFTING(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) public TRCRAFTING(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
{ super(owningScreen, owningEntryList, configElement);
super(owningScreen, owningEntryList, configElement); }
}
@Override @Override
protected GuiScreen buildChildScreen() protected GuiScreen buildChildScreen() {
{ return new GuiConfig(this.owningScreen,
return new GuiConfig(this.owningScreen, (new ConfigElement(ConfigTechReborn.config
(new ConfigElement(ConfigTechReborn.config .getCategory(ConfigTechReborn.CATEGORY_CRAFTING)))
.getCategory(ConfigTechReborn.CATEGORY_CRAFTING))) .getChildElements(), this.owningScreen.modID,
.getChildElements(), this.owningScreen.modID, Configuration.CATEGORY_GENERAL,
Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart()
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|| this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart()
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
|| this.owningScreen.allRequireMcRestart, GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config .toString()));
.toString())); }
} }
}
} }

View file

@ -1,35 +1,31 @@
package techreborn.config; package techreborn.config;
import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import java.util.Set; import java.util.Set;
import net.minecraft.client.Minecraft; public class TechRebornGUIFactory implements IModGuiFactory {
import net.minecraft.client.gui.GuiScreen; @Override
import cpw.mods.fml.client.IModGuiFactory; public void initialize(Minecraft minecraftInstance) {
public class TechRebornGUIFactory implements IModGuiFactory{ }
@Override
public void initialize(Minecraft minecraftInstance)
{
} @Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return TechRebornConfigGui.class;
}
@Override @Override
public Class<? extends GuiScreen> mainConfigGuiClass() public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
{ return null;
return TechRebornConfigGui.class; }
}
@Override @Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() public RuntimeOptionGuiHandler getHandlerFor(
{ RuntimeOptionCategoryElement element) {
return null; return null;
} }
@Override
public RuntimeOptionGuiHandler getHandlerFor(
RuntimeOptionCategoryElement element)
{
return null;
}
} }

View file

@ -1,5 +1,6 @@
package techreborn.init; package techreborn.init;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -10,91 +11,84 @@ import techreborn.itemblocks.ItemBlockOre;
import techreborn.itemblocks.ItemBlockQuantumChest; import techreborn.itemblocks.ItemBlockQuantumChest;
import techreborn.itemblocks.ItemBlockQuantumTank; import techreborn.itemblocks.ItemBlockQuantumTank;
import techreborn.itemblocks.ItemBlockStorage; import techreborn.itemblocks.ItemBlockStorage;
import techreborn.tiles.TileCentrifuge; import techreborn.tiles.*;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileQuantumTank;
import techreborn.tiles.TileRollingMachine;
import techreborn.tiles.TileThermalGenerator;
import techreborn.util.LogHelper; import techreborn.util.LogHelper;
import cpw.mods.fml.common.registry.GameRegistry;
public class ModBlocks { public class ModBlocks {
public static Block thermalGenerator; public static Block thermalGenerator;
public static Block quantumTank; public static Block quantumTank;
public static Block quantumChest; public static Block quantumChest;
public static Block centrifuge; public static Block centrifuge;
public static Block RollingMachine; public static Block RollingMachine;
public static Block ore; public static Block ore;
public static Block storage; public static Block storage;
public static void init() public static void init() {
{ thermalGenerator = new BlockThermalGenerator().setBlockName("techreborn.thermalGenerator").setBlockTextureName("techreborn:ThermalGenerator_other").setCreativeTab(TechRebornCreativeTab.instance);
thermalGenerator = new BlockThermalGenerator().setBlockName("techreborn.thermalGenerator").setBlockTextureName("techreborn:ThermalGenerator_other").setCreativeTab(TechRebornCreativeTab.instance); GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator");
GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator"); GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance); quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance);
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class, "techreborn.quantumTank"); GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class, "techreborn.quantumTank");
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank"); GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance); quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest"); GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest");
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest"); GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
centrifuge = new BlockCentrifuge().setBlockName("techreborn.centrifuge").setBlockTextureName("techreborn:centrifuge").setCreativeTab(TechRebornCreativeTab.instance); centrifuge = new BlockCentrifuge().setBlockName("techreborn.centrifuge").setBlockTextureName("techreborn:centrifuge").setCreativeTab(TechRebornCreativeTab.instance);
GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge"); GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge");
GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifuge"); GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifuge");
RollingMachine = new BlockRollingMachine(Material.piston); RollingMachine = new BlockRollingMachine(Material.piston);
GameRegistry.registerBlock(RollingMachine, "rollingmachine"); GameRegistry.registerBlock(RollingMachine, "rollingmachine");
GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine"); GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine");
ore = new BlockOre(Material.rock); ore = new BlockOre(Material.rock);
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore"); GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
LogHelper.info("TechReborns Blocks Loaded"); LogHelper.info("TechReborns Blocks Loaded");
storage = new BlockStorage(Material.rock); storage = new BlockStorage(Material.rock);
GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage"); GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage");
LogHelper.info("TechReborns Blocks Loaded"); LogHelper.info("TechReborns Blocks Loaded");
registerOreDict(); registerOreDict();
} }
public static void registerOreDict() public static void registerOreDict() {
{ OreDictionary.registerOre("oreGalena", new ItemStack(ore, 1, 0));
OreDictionary.registerOre("oreGalena", new ItemStack(ore,1,0)); OreDictionary.registerOre("oreIridium", new ItemStack(ore, 1, 1));
OreDictionary.registerOre("oreIridium", new ItemStack(ore,1,1)); OreDictionary.registerOre("oreRuby", new ItemStack(ore, 1, 2));
OreDictionary.registerOre("oreRuby", new ItemStack(ore,1,2)); OreDictionary.registerOre("oreSapphire", new ItemStack(ore, 1, 3));
OreDictionary.registerOre("oreSapphire", new ItemStack(ore,1,3)); OreDictionary.registerOre("oreBauxite", new ItemStack(ore, 1, 4));
OreDictionary.registerOre("oreBauxite", new ItemStack(ore,1,4)); OreDictionary.registerOre("orePyrite", new ItemStack(ore, 1, 5));
OreDictionary.registerOre("orePyrite", new ItemStack(ore,1,5)); OreDictionary.registerOre("oreCinnabar", new ItemStack(ore, 1, 6));
OreDictionary.registerOre("oreCinnabar", new ItemStack(ore,1,6)); OreDictionary.registerOre("oreSphalerite", new ItemStack(ore, 1, 7));
OreDictionary.registerOre("oreSphalerite", new ItemStack(ore,1,7)); OreDictionary.registerOre("oreTungston", new ItemStack(ore, 1, 8));
OreDictionary.registerOre("oreTungston", new ItemStack(ore,1,8)); OreDictionary.registerOre("oreSheldonite", new ItemStack(ore, 1, 9));
OreDictionary.registerOre("oreSheldonite", new ItemStack(ore,1,9)); OreDictionary.registerOre("oreOlivine", new ItemStack(ore, 1, 10));
OreDictionary.registerOre("oreOlivine", new ItemStack(ore,1,10)); OreDictionary.registerOre("oreSodalite", new ItemStack(ore, 1, 11));
OreDictionary.registerOre("oreSodalite", new ItemStack(ore,1,11));
OreDictionary.registerOre("blockSilver", new ItemStack(storage,1,0)); OreDictionary.registerOre("blockSilver", new ItemStack(storage, 1, 0));
OreDictionary.registerOre("blockAluminium", new ItemStack(storage,1,1)); OreDictionary.registerOre("blockAluminium", new ItemStack(storage, 1, 1));
OreDictionary.registerOre("blockTitanium", new ItemStack(storage,1,2)); OreDictionary.registerOre("blockTitanium", new ItemStack(storage, 1, 2));
OreDictionary.registerOre("blockSapphire", new ItemStack(storage,1,3)); OreDictionary.registerOre("blockSapphire", new ItemStack(storage, 1, 3));
OreDictionary.registerOre("blockRuby", new ItemStack(storage,1,4)); OreDictionary.registerOre("blockRuby", new ItemStack(storage, 1, 4));
OreDictionary.registerOre("blockGreenSapphire", new ItemStack(storage,1,5)); OreDictionary.registerOre("blockGreenSapphire", new ItemStack(storage, 1, 5));
OreDictionary.registerOre("blockChrome", new ItemStack(storage,1,6)); OreDictionary.registerOre("blockChrome", new ItemStack(storage, 1, 6));
OreDictionary.registerOre("blockElectrum", new ItemStack(storage,1,7)); OreDictionary.registerOre("blockElectrum", new ItemStack(storage, 1, 7));
OreDictionary.registerOre("blockTungsten", new ItemStack(storage,1,8)); OreDictionary.registerOre("blockTungsten", new ItemStack(storage, 1, 8));
OreDictionary.registerOre("blockLead", new ItemStack(storage,1,9)); OreDictionary.registerOre("blockLead", new ItemStack(storage, 1, 9));
OreDictionary.registerOre("blockZinc", new ItemStack(storage,1,10)); OreDictionary.registerOre("blockZinc", new ItemStack(storage, 1, 10));
OreDictionary.registerOre("blockBrass", new ItemStack(storage,1,11)); OreDictionary.registerOre("blockBrass", new ItemStack(storage, 1, 11));
OreDictionary.registerOre("blockSteel", new ItemStack(storage,1,12)); OreDictionary.registerOre("blockSteel", new ItemStack(storage, 1, 12));
OreDictionary.registerOre("blockPlatinum", new ItemStack(storage,1,13)); OreDictionary.registerOre("blockPlatinum", new ItemStack(storage, 1, 13));
OreDictionary.registerOre("blockNickel", new ItemStack(storage,1,14)); OreDictionary.registerOre("blockNickel", new ItemStack(storage, 1, 14));
OreDictionary.registerOre("blockInvar", new ItemStack(storage,1,15)); OreDictionary.registerOre("blockInvar", new ItemStack(storage, 1, 15));
} }
} }

View file

@ -1,11 +1,10 @@
package techreborn.init; package techreborn.init;
import org.apache.logging.log4j.message.MapMessage.MapFormat; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import techreborn.items.ItemDusts; import techreborn.items.ItemDusts;
import techreborn.items.ItemGems; import techreborn.items.ItemGems;
@ -18,7 +17,6 @@ import techreborn.items.tools.ItemAdvancedDrill;
import techreborn.items.tools.ItemOmniTool; import techreborn.items.tools.ItemOmniTool;
import techreborn.items.tools.ItemRockCutter; import techreborn.items.tools.ItemRockCutter;
import techreborn.util.LogHelper; import techreborn.util.LogHelper;
import cpw.mods.fml.common.registry.GameRegistry;
public class ModItems { public class ModItems {
@ -33,9 +31,8 @@ public class ModItems {
public static Item omniTool; public static Item omniTool;
public static Item advancedDrill; public static Item advancedDrill;
public static void init() public static void init() {
{ dusts = new ItemDusts();
dusts = new ItemDusts();
GameRegistry.registerItem(dusts, "dust"); GameRegistry.registerItem(dusts, "dust");
ingots = new ItemIngots(); ingots = new ItemIngots();
GameRegistry.registerItem(ingots, "ingot"); GameRegistry.registerItem(ingots, "ingot");
@ -56,103 +53,102 @@ public class ModItems {
gravityChest = new ItemGravityChest(ArmorMaterial.DIAMOND, 7, 1); gravityChest = new ItemGravityChest(ArmorMaterial.DIAMOND, 7, 1);
GameRegistry.registerItem(gravityChest, "gravityChest"); GameRegistry.registerItem(gravityChest, "gravityChest");
LogHelper.info("TechReborns Items Loaded"); LogHelper.info("TechReborns Items Loaded");
registerOreDict(); registerOreDict();
} }
public static void registerOreDict() public static void registerOreDict() {
{ //Dusts
//Dusts OreDictionary.registerOre("dustAlmandine", new ItemStack(dusts, 1, 0));
OreDictionary.registerOre("dustAlmandine", new ItemStack(dusts,1,0)); OreDictionary.registerOre("dustAluminium", new ItemStack(dusts, 1, 1));
OreDictionary.registerOre("dustAluminium", new ItemStack(dusts,1,1)); OreDictionary.registerOre("dustAndradite", new ItemStack(dusts, 1, 2));
OreDictionary.registerOre("dustAndradite", new ItemStack(dusts,1,2)); OreDictionary.registerOre("dustBasalt", new ItemStack(dusts, 1, 4));
OreDictionary.registerOre("dustBasalt", new ItemStack(dusts,1,4)); OreDictionary.registerOre("dustBauxite", new ItemStack(dusts, 1, 5));
OreDictionary.registerOre("dustBauxite", new ItemStack(dusts,1,5)); OreDictionary.registerOre("dustBrass", new ItemStack(dusts, 1, 6));
OreDictionary.registerOre("dustBrass", new ItemStack(dusts,1,6)); OreDictionary.registerOre("dustBronze", new ItemStack(dusts, 1, 7));
OreDictionary.registerOre("dustBronze", new ItemStack(dusts,1,7)); OreDictionary.registerOre("dustCalcite", new ItemStack(dusts, 1, 8));
OreDictionary.registerOre("dustCalcite", new ItemStack(dusts,1,8)); OreDictionary.registerOre("dustCharcoal", new ItemStack(dusts, 1, 9));
OreDictionary.registerOre("dustCharcoal", new ItemStack(dusts,1,9)); OreDictionary.registerOre("dustChrome", new ItemStack(dusts, 1, 10));
OreDictionary.registerOre("dustChrome", new ItemStack(dusts,1,10)); OreDictionary.registerOre("dustCinnabar", new ItemStack(dusts, 1, 11));
OreDictionary.registerOre("dustCinnabar", new ItemStack(dusts,1,11)); OreDictionary.registerOre("dustClay", new ItemStack(dusts, 1, 12));
OreDictionary.registerOre("dustClay", new ItemStack(dusts,1,12)); OreDictionary.registerOre("dustCoal", new ItemStack(dusts, 1, 13));
OreDictionary.registerOre("dustCoal", new ItemStack(dusts,1,13)); OreDictionary.registerOre("dustCopper", new ItemStack(dusts, 1, 14));
OreDictionary.registerOre("dustCopper", new ItemStack(dusts,1,14)); OreDictionary.registerOre("dustDiamond", new ItemStack(dusts, 1, 16));
OreDictionary.registerOre("dustDiamond", new ItemStack(dusts,1,16)); OreDictionary.registerOre("dustElectrum", new ItemStack(dusts, 1, 17));
OreDictionary.registerOre("dustElectrum", new ItemStack(dusts,1,17)); OreDictionary.registerOre("dustEmerald", new ItemStack(dusts, 1, 18));
OreDictionary.registerOre("dustEmerald", new ItemStack(dusts,1,18)); OreDictionary.registerOre("dustEnderEye", new ItemStack(dusts, 1, 19));
OreDictionary.registerOre("dustEnderEye", new ItemStack(dusts,1,19)); OreDictionary.registerOre("dustEnderPearl", new ItemStack(dusts, 1, 20));
OreDictionary.registerOre("dustEnderPearl", new ItemStack(dusts,1,20)); OreDictionary.registerOre("dustEndstone", new ItemStack(dusts, 1, 21));
OreDictionary.registerOre("dustEndstone", new ItemStack(dusts,1,21)); OreDictionary.registerOre("dustFlint", new ItemStack(dusts, 1, 22));
OreDictionary.registerOre("dustFlint", new ItemStack(dusts,1,22)); OreDictionary.registerOre("dustGold", new ItemStack(dusts, 1, 23));
OreDictionary.registerOre("dustGold", new ItemStack(dusts,1,23)); OreDictionary.registerOre("dustGreenSapphire", new ItemStack(dusts, 1, 24));
OreDictionary.registerOre("dustGreenSapphire", new ItemStack(dusts,1,24)); OreDictionary.registerOre("dustGrossular", new ItemStack(dusts, 1, 25));
OreDictionary.registerOre("dustGrossular", new ItemStack(dusts,1,25)); OreDictionary.registerOre("dustInvar", new ItemStack(dusts, 1, 26));
OreDictionary.registerOre("dustInvar", new ItemStack(dusts,1,26)); OreDictionary.registerOre("dustIron", new ItemStack(dusts, 1, 27));
OreDictionary.registerOre("dustIron", new ItemStack(dusts,1,27)); OreDictionary.registerOre("dustLazurite", new ItemStack(dusts, 1, 28));
OreDictionary.registerOre("dustLazurite", new ItemStack(dusts,1,28)); OreDictionary.registerOre("dustLead", new ItemStack(dusts, 1, 29));
OreDictionary.registerOre("dustLead", new ItemStack(dusts,1,29)); OreDictionary.registerOre("dustMagnesium", new ItemStack(dusts, 1, 30));
OreDictionary.registerOre("dustMagnesium", new ItemStack(dusts,1,30)); OreDictionary.registerOre("dustMarble", new ItemStack(dusts, 31));
OreDictionary.registerOre("dustMarble", new ItemStack(dusts,31)); OreDictionary.registerOre("dustNetherrack", new ItemStack(dusts, 32));
OreDictionary.registerOre("dustNetherrack", new ItemStack(dusts,32)); OreDictionary.registerOre("dustNickel", new ItemStack(dusts, 1, 33));
OreDictionary.registerOre("dustNickel", new ItemStack(dusts,1,33)); OreDictionary.registerOre("dustObsidian", new ItemStack(dusts, 1, 34));
OreDictionary.registerOre("dustObsidian", new ItemStack(dusts,1,34)); OreDictionary.registerOre("dustOlivine", new ItemStack(dusts, 1, 35));
OreDictionary.registerOre("dustOlivine", new ItemStack(dusts,1,35)); OreDictionary.registerOre("dustPhosphor", new ItemStack(dusts, 1, 36));
OreDictionary.registerOre("dustPhosphor", new ItemStack(dusts,1,36)); OreDictionary.registerOre("dustPlatinum", new ItemStack(dusts, 1, 37));
OreDictionary.registerOre("dustPlatinum", new ItemStack(dusts,1,37)); OreDictionary.registerOre("dustPyrite", new ItemStack(dusts, 1, 38));
OreDictionary.registerOre("dustPyrite", new ItemStack(dusts,1,38)); OreDictionary.registerOre("dustPyrope", new ItemStack(dusts, 1, 39));
OreDictionary.registerOre("dustPyrope", new ItemStack(dusts,1,39)); OreDictionary.registerOre("dustRedGarnet", new ItemStack(dusts, 1, 40));
OreDictionary.registerOre("dustRedGarnet", new ItemStack(dusts,1,40)); OreDictionary.registerOre("dustRedrock", new ItemStack(dusts, 1, 41));
OreDictionary.registerOre("dustRedrock", new ItemStack(dusts,1,41)); OreDictionary.registerOre("dustRuby", new ItemStack(dusts, 1, 42));
OreDictionary.registerOre("dustRuby", new ItemStack(dusts,1,42)); OreDictionary.registerOre("dustSaltpeter", new ItemStack(dusts, 1, 43));
OreDictionary.registerOre("dustSaltpeter", new ItemStack(dusts,1,43)); OreDictionary.registerOre("dustSapphire", new ItemStack(dusts, 1, 44));
OreDictionary.registerOre("dustSapphire", new ItemStack(dusts,1,44)); OreDictionary.registerOre("dustSilver", new ItemStack(dusts, 1, 45));
OreDictionary.registerOre("dustSilver", new ItemStack(dusts,1,45)); OreDictionary.registerOre("dustSodalite", new ItemStack(dusts, 1, 46));
OreDictionary.registerOre("dustSodalite", new ItemStack(dusts,1,46)); OreDictionary.registerOre("dustSpessartine", new ItemStack(dusts, 1, 47));
OreDictionary.registerOre("dustSpessartine", new ItemStack(dusts,1,47)); OreDictionary.registerOre("dustSphalerite", new ItemStack(dusts, 1, 48));
OreDictionary.registerOre("dustSphalerite", new ItemStack(dusts,1,48)); OreDictionary.registerOre("dustSteel", new ItemStack(dusts, 1, 49));
OreDictionary.registerOre("dustSteel", new ItemStack(dusts,1,49)); OreDictionary.registerOre("dustSulfur", new ItemStack(dusts, 1, 50));
OreDictionary.registerOre("dustSulfur", new ItemStack(dusts,1,50)); OreDictionary.registerOre("dustTin", new ItemStack(dusts, 1, 51));
OreDictionary.registerOre("dustTin", new ItemStack(dusts,1,51)); OreDictionary.registerOre("dustTitanium", new ItemStack(dusts, 1, 52));
OreDictionary.registerOre("dustTitanium", new ItemStack(dusts,1,52)); OreDictionary.registerOre("dustTungsten", new ItemStack(dusts, 1, 53));
OreDictionary.registerOre("dustTungsten", new ItemStack(dusts,1,53)); OreDictionary.registerOre("dustUranium", new ItemStack(dusts, 1, 54));
OreDictionary.registerOre("dustUranium", new ItemStack(dusts,1,54)); OreDictionary.registerOre("dustUvarovite", new ItemStack(dusts, 1, 55));
OreDictionary.registerOre("dustUvarovite", new ItemStack(dusts,1,55)); OreDictionary.registerOre("dustYellowGarnet", new ItemStack(dusts, 1, 56));
OreDictionary.registerOre("dustYellowGarnet", new ItemStack(dusts,1,56)); OreDictionary.registerOre("dustZinc", new ItemStack(dusts, 1, 57));
OreDictionary.registerOre("dustZinc", new ItemStack(dusts,1,57)); OreDictionary.registerOre("ingotCobalt", new ItemStack(dusts, 1, 58));
OreDictionary.registerOre("ingotCobalt", new ItemStack(dusts,1,58)); OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 59));
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots,1,59)); OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots, 1, 60));
OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots,1,60)); OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots, 1, 61));
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots,1,61)); OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 62));
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots,1,62)); //Ingots
//Ingots OreDictionary.registerOre("ingotIridium", new ItemStack(ingots, 1, 3));
OreDictionary.registerOre("ingotIridium", new ItemStack(ingots,1,3)); OreDictionary.registerOre("ingotSilver", new ItemStack(ingots, 1, 4));
OreDictionary.registerOre("ingotSilver", new ItemStack(ingots,1,4)); OreDictionary.registerOre("ingotAluminium", new ItemStack(ingots, 1, 5));
OreDictionary.registerOre("ingotAluminium", new ItemStack(ingots,1,5)); OreDictionary.registerOre("ingotTitanium", new ItemStack(ingots, 1, 6));
OreDictionary.registerOre("ingotTitanium", new ItemStack(ingots,1,6)); OreDictionary.registerOre("ingotChrome", new ItemStack(ingots, 1, 7));
OreDictionary.registerOre("ingotChrome", new ItemStack(ingots,1,7)); OreDictionary.registerOre("ingotElectrum", new ItemStack(ingots, 1, 8));
OreDictionary.registerOre("ingotElectrum", new ItemStack(ingots,1,8)); OreDictionary.registerOre("ingotTungsten", new ItemStack(ingots, 1, 9));
OreDictionary.registerOre("ingotTungsten", new ItemStack(ingots,1,9)); OreDictionary.registerOre("ingotLead", new ItemStack(ingots, 1, 10));
OreDictionary.registerOre("ingotLead", new ItemStack(ingots,1,10)); OreDictionary.registerOre("ingotZinc", new ItemStack(ingots, 1, 11));
OreDictionary.registerOre("ingotZinc", new ItemStack(ingots,1,11)); OreDictionary.registerOre("ingotBrass", new ItemStack(ingots, 1, 12));
OreDictionary.registerOre("ingotBrass", new ItemStack(ingots,1,12)); OreDictionary.registerOre("ingotSteel", new ItemStack(ingots, 1, 13));
OreDictionary.registerOre("ingotSteel", new ItemStack(ingots,1,13)); OreDictionary.registerOre("ingotPlatinum", new ItemStack(ingots, 1, 14));
OreDictionary.registerOre("ingotPlatinum", new ItemStack(ingots,1,14)); OreDictionary.registerOre("ingotNickel", new ItemStack(ingots, 1, 15));
OreDictionary.registerOre("ingotNickel", new ItemStack(ingots,1,15)); OreDictionary.registerOre("ingotInvar", new ItemStack(ingots, 1, 16));
OreDictionary.registerOre("ingotInvar", new ItemStack(ingots,1,16)); OreDictionary.registerOre("ingotCobalt", new ItemStack(ingots, 1, 17));
OreDictionary.registerOre("ingotCobalt", new ItemStack(ingots,1,17)); OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 18));
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots,1,18)); OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots, 1, 19));
OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots,1,19)); OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots, 1, 20));
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots,1,20)); OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 21));
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots,1,21));
//Gems //Gems
OreDictionary.registerOre("gemRuby", new ItemStack(gems,1,0)); OreDictionary.registerOre("gemRuby", new ItemStack(gems, 1, 0));
OreDictionary.registerOre("gemSapphire", new ItemStack(gems,1,1)); OreDictionary.registerOre("gemSapphire", new ItemStack(gems, 1, 1));
OreDictionary.registerOre("gemGreenSapphire", new ItemStack(gems,1,2)); OreDictionary.registerOre("gemGreenSapphire", new ItemStack(gems, 1, 2));
OreDictionary.registerOre("gemOlivine", new ItemStack(gems,1,3)); OreDictionary.registerOre("gemOlivine", new ItemStack(gems, 1, 3));
OreDictionary.registerOre("gemRedGarnet", new ItemStack(gems,1,4)); OreDictionary.registerOre("gemRedGarnet", new ItemStack(gems, 1, 4));
OreDictionary.registerOre("gemYellowGarnet", new ItemStack(gems,1,5)); OreDictionary.registerOre("gemYellowGarnet", new ItemStack(gems, 1, 5));
} }

View file

@ -14,237 +14,231 @@ import techreborn.util.LogHelper;
import techreborn.util.RecipeRemover; import techreborn.util.RecipeRemover;
public class ModRecipes { public class ModRecipes {
public static ConfigTechReborn config; public static ConfigTechReborn config;
public static void init() public static void init() {
{ removeIc2Recipes();
removeIc2Recipes(); addShaplessRecipes();
addShaplessRecipes(); addShappedRecipes();
addShappedRecipes(); addSmeltingRecipes();
addSmeltingRecipes(); addMachineRecipes();
addMachineRecipes(); }
}
public static void removeIc2Recipes() public static void removeIc2Recipes() {
{ if (config.ExpensiveMacerator) ;
if(config.ExpensiveMacerator); RecipeRemover.removeAnyRecipe(IC2Items.getItem("macerator"));
RecipeRemover.removeAnyRecipe(IC2Items.getItem("macerator")); if (config.ExpensiveDrill) ;
if(config.ExpensiveDrill); RecipeRemover.removeAnyRecipe(IC2Items.getItem("miningDrill"));
RecipeRemover.removeAnyRecipe(IC2Items.getItem("miningDrill")); if (config.ExpensiveDiamondDrill) ;
if(config.ExpensiveDiamondDrill); RecipeRemover.removeAnyRecipe(IC2Items.getItem("diamondDrill"));
RecipeRemover.removeAnyRecipe(IC2Items.getItem("diamondDrill")); if (config.ExpensiveSolar) ;
if(config.ExpensiveSolar); RecipeRemover.removeAnyRecipe(IC2Items.getItem("solarPanel"));
RecipeRemover.removeAnyRecipe(IC2Items.getItem("solarPanel"));
LogHelper.info("IC2 Recipes Removed"); LogHelper.info("IC2 Recipes Removed");
} }
public static void addShappedRecipes() public static void addShappedRecipes() {
{
//IC2 Recipes //IC2 Recipes
if(config.ExpensiveMacerator); if (config.ExpensiveMacerator) ;
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("macerator"), CraftingHelper.addShapedOreRecipe(IC2Items.getItem("macerator"),
new Object[]{"FDF", "DMD", "FCF", new Object[]{"FDF", "DMD", "FCF",
'F', Items.flint, 'F', Items.flint,
'D', Items.diamond, 'D', Items.diamond,
'M', IC2Items.getItem("machine"), 'M', IC2Items.getItem("machine"),
'C', IC2Items.getItem("electronicCircuit")}); 'C', IC2Items.getItem("electronicCircuit")});
if(config.ExpensiveDrill); if (config.ExpensiveDrill) ;
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("miningDrill"), CraftingHelper.addShapedOreRecipe(IC2Items.getItem("miningDrill"),
new Object[]{" S ", "SCS", "SBS", new Object[]{" S ", "SCS", "SBS",
'S', "ingotSteel", 'S', "ingotSteel",
'B', IC2Items.getItem("reBattery"), 'B', IC2Items.getItem("reBattery"),
'C', IC2Items.getItem("electronicCircuit")}); 'C', IC2Items.getItem("electronicCircuit")});
if(config.ExpensiveDiamondDrill); if (config.ExpensiveDiamondDrill) ;
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("diamondDrill"), CraftingHelper.addShapedOreRecipe(IC2Items.getItem("diamondDrill"),
new Object[]{" D ", "DBD", "TCT", new Object[]{" D ", "DBD", "TCT",
'D', "gemDiamond", 'D', "gemDiamond",
'T', "ingotTitanium", 'T', "ingotTitanium",
'B', IC2Items.getItem("miningDrill"), 'B', IC2Items.getItem("miningDrill"),
'C', IC2Items.getItem("advancedCircuit")}); 'C', IC2Items.getItem("advancedCircuit")});
if(config.ExpensiveSolar); if (config.ExpensiveSolar) ;
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("solarPanel"), CraftingHelper.addShapedOreRecipe(IC2Items.getItem("solarPanel"),
new Object[]{"PPP", "SZS", "CGC", new Object[]{"PPP", "SZS", "CGC",
'P', "paneGlass", 'P', "paneGlass",
'S', new ItemStack(ModItems.parts,1,1), 'S', new ItemStack(ModItems.parts, 1, 1),
'Z', IC2Items.getItem("carbonPlate"), 'Z', IC2Items.getItem("carbonPlate"),
'G', IC2Items.getItem("generator"), 'G', IC2Items.getItem("generator"),
'C', IC2Items.getItem("electronicCircuit")}); 'C', IC2Items.getItem("electronicCircuit")});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.thermalGenerator), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.thermalGenerator),
new Object[]{"III", "IHI", "CGC", new Object[]{"III", "IHI", "CGC",
'I', "ingotInvar", 'I', "ingotInvar",
'H', IC2Items.getItem("reinforcedGlass"), 'H', IC2Items.getItem("reinforcedGlass"),
'C', IC2Items.getItem("electronicCircuit"), 'C', IC2Items.getItem("electronicCircuit"),
'G', IC2Items.getItem("geothermalGenerator")}); 'G', IC2Items.getItem("geothermalGenerator")});
//TechReborn Recipes //TechReborn Recipes
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,4,6), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 6),
new Object[]{"EEE", "EAE", "EEE", new Object[]{"EEE", "EAE", "EEE",
'E', "gemEmerald", 'E', "gemEmerald",
'A', IC2Items.getItem("electronicCircuit")}); 'A', IC2Items.getItem("electronicCircuit")});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,7), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 7),
new Object[]{"AGA", "RPB", "ASA", new Object[]{"AGA", "RPB", "ASA",
'A', "ingotAluminium", 'A', "ingotAluminium",
'G', "dyeGreen", 'G', "dyeGreen",
'R', "dyeRed", 'R', "dyeRed",
'P', "paneGlass", 'P', "paneGlass",
'B', "dyeBlue", 'B', "dyeBlue",
'S', Items.glowstone_dust,}); 'S', Items.glowstone_dust,});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,4,8), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 8),
new Object[]{"DSD", "S S", "DSD", new Object[]{"DSD", "S S", "DSD",
'D', "dustDiamond", 'D', "dustDiamond",
'S', "ingotSteel"}); 'S', "ingotSteel"});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,16,13), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 16, 13),
new Object[]{"CSC", "SCS", "CSC", new Object[]{"CSC", "SCS", "CSC",
'S', "ingotSteel", 'S', "ingotSteel",
'C', IC2Items.getItem("electronicCircuit")}); 'C', IC2Items.getItem("electronicCircuit")});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,2,14), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 2, 14),
new Object[]{"TST", "SBS", "TST", new Object[]{"TST", "SBS", "TST",
'S', "ingotSteel", 'S', "ingotSteel",
'T', "ingotTungsten", 'T', "ingotTungsten",
'B', "blockSteel"}); 'B', "blockSteel"});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,15), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 15),
new Object[]{"AAA", "AMA", "AAA", new Object[]{"AAA", "AMA", "AAA",
'A', "ingotAluminium", 'A', "ingotAluminium",
'M', new ItemStack(ModItems.parts,1,13)}); 'M', new ItemStack(ModItems.parts, 1, 13)});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,16), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 16),
new Object[]{"AAA", "AMA", "AAA", new Object[]{"AAA", "AMA", "AAA",
'A', "ingotBronze", 'A', "ingotBronze",
'M', new ItemStack(ModItems.parts,1,13)}); 'M', new ItemStack(ModItems.parts, 1, 13)});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,17), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 17),
new Object[]{"AAA", "AMA", "AAA", new Object[]{"AAA", "AMA", "AAA",
'A', "ingotSteel", 'A', "ingotSteel",
'M', new ItemStack(ModItems.parts,1,13)}); 'M', new ItemStack(ModItems.parts, 1, 13)});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,18), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 18),
new Object[]{"AAA", "AMA", "AAA", new Object[]{"AAA", "AMA", "AAA",
'A', "ingotTitanium", 'A', "ingotTitanium",
'M', new ItemStack(ModItems.parts,1,13)}); 'M', new ItemStack(ModItems.parts, 1, 13)});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts,1,19), CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 19),
new Object[]{"AAA", "AMA", "AAA", new Object[]{"AAA", "AMA", "AAA",
'A', "ingotBrass", 'A', "ingotBrass",
'M', new ItemStack(ModItems.parts,1,13)}); 'M', new ItemStack(ModItems.parts, 1, 13)});
//Storage Blocks //Storage Blocks
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,0), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 0),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotSilver",}); 'A', "ingotSilver",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,1), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 1),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotAluminium",}); 'A', "ingotAluminium",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,2), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 2),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotTitanium",}); 'A', "ingotTitanium",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,3), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 3),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "gemSapphire",}); 'A', "gemSapphire",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,4), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 4),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "gemRuby",}); 'A', "gemRuby",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,5), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 5),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "gemGreenSapphire",}); 'A', "gemGreenSapphire",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,6), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 6),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotChrome",}); 'A', "ingotChrome",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,7), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 7),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotElectrum",}); 'A', "ingotElectrum",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,8), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 8),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotTungsten",}); 'A', "ingotTungsten",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,9), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 9),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotLead",}); 'A', "ingotLead",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,10), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 10),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotZinc",}); 'A', "ingotZinc",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,11), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 11),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotBrass",}); 'A', "ingotBrass",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,12), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 12),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotSteel",}); 'A', "ingotSteel",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,13), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 13),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotPlatinum",}); 'A', "ingotPlatinum",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,14), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 14),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotNickel",}); 'A', "ingotNickel",});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage,1,15), CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 15),
new Object[]{"AAA", "AAA", "AAA", new Object[]{"AAA", "AAA", "AAA",
'A', "ingotInvar",}); 'A', "ingotInvar",});
LogHelper.info("Shapped Recipes Added"); LogHelper.info("Shapped Recipes Added");
} }
public static void addShaplessRecipes() public static void addShaplessRecipes() {
{ CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 4), "blockSilver");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,4), "blockSilver"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 5), "blockAluminium");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,5), "blockAluminium"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 6), "blockTitanium");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,6), "blockTitanium"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 1), "blockSapphire");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems,9,1), "blockSapphire"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 0), "blockRuby");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems,9,0), "blockRuby"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 2), "blockGreenSapphire");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems,9,2), "blockGreenSapphire"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 7), "blockChrome");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,7), "blockChrome"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 8), "blockElectrum");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,8), "blockElectrum"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 9), "blockTungsten");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,9), "blockTungsten"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 10), "blockLead");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,10), "blockLead"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 11), "blockZinc");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,11), "blockZinc"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 12), "blockBrass");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,12), "blockBrass"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 13), "blockSteel");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,13), "blockSteel"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 14), "blockPlatinum");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,14), "blockPlatinum"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 15), "blockNickel");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,15), "blockNickel"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 16), "blockInvar");
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots,9,16), "blockInvar"); CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.rockCutter, 1, 27), Items.apple);
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.rockCutter,1,27), Items.apple);
LogHelper.info("Shapless Recipes Added"); LogHelper.info("Shapless Recipes Added");
} }
public static void addSmeltingRecipes() public static void addSmeltingRecipes() {
{ GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 27), new ItemStack(Items.iron_ingot), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,27), new ItemStack(Items.iron_ingot), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 23), new ItemStack(Items.gold_ingot), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,23), new ItemStack(Items.gold_ingot), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 14), IC2Items.getItem("copperIngot"), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,14), IC2Items.getItem("copperIngot"), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 51), IC2Items.getItem("tinIngot"), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,51), IC2Items.getItem("tinIngot"), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 7), IC2Items.getItem("bronzeIngot"), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,7), IC2Items.getItem("bronzeIngot"), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 29), IC2Items.getItem("leadIngot"), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,29), IC2Items.getItem("leadIngot"), 1F); GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 45), IC2Items.getItem("silverIngot"), 1F);
GameRegistry.addSmelting(new ItemStack(ModItems.dusts,1 ,45), IC2Items.getItem("silverIngot"), 1F);
LogHelper.info("Smelting Recipes Added"); LogHelper.info("Smelting Recipes Added");
} }
public static void addMachineRecipes() public static void addMachineRecipes() {
{ TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.apple, 4, Items.beef, Items.baked_potato, null, null, 120, 4));
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.apple, 4, Items.beef, Items.baked_potato, null, null, 120, 4)); TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.nether_star, 1, Items.diamond, Items.emerald, Items.bed, Items.cake, 500, 8));
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.nether_star, 1, Items.diamond, Items.emerald, Items.bed, Items.cake, 500, 8)); TechRebornAPI.registerRollingMachineRecipe(new RollingMachineRecipie(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.furnace), 4));
TechRebornAPI.registerRollingMachineRecipe(new RollingMachineRecipie(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.furnace), 4)); LogHelper.info("Machine Recipes Added");
LogHelper.info("Machine Recipes Added"); }
}
} }

View file

@ -5,11 +5,10 @@ import net.minecraft.item.ItemMultiTexture;
import techreborn.blocks.BlockOre; import techreborn.blocks.BlockOre;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
public class ItemBlockOre extends ItemMultiTexture{ public class ItemBlockOre extends ItemMultiTexture {
public ItemBlockOre(Block block) public ItemBlockOre(Block block) {
{ super(ModBlocks.ore, ModBlocks.ore, BlockOre.types);
super(ModBlocks.ore, ModBlocks.ore, BlockOre.types); }
}
} }

View file

@ -1,7 +1,7 @@
package techreborn.itemblocks; package techreborn.itemblocks;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -9,8 +9,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.tiles.TileQuantumChest; import techreborn.tiles.TileQuantumChest;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import java.util.List;
public class ItemBlockQuantumChest extends ItemBlock { public class ItemBlockQuantumChest extends ItemBlock {
@ -19,7 +19,7 @@ public class ItemBlockQuantumChest extends ItemBlock {
super(p_i45328_1_); super(p_i45328_1_);
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
@ -31,8 +31,7 @@ public class ItemBlockQuantumChest extends ItemBlock {
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
{
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) { if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
return false; return false;
} }

View file

@ -15,8 +15,7 @@ public class ItemBlockQuantumTank extends ItemBlock {
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
{
if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3)) { if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3)) {
return false; return false;
} }

View file

@ -2,15 +2,13 @@ package techreborn.itemblocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemMultiTexture; import net.minecraft.item.ItemMultiTexture;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockStorage; import techreborn.blocks.BlockStorage;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
public class ItemBlockStorage extends ItemMultiTexture{ public class ItemBlockStorage extends ItemMultiTexture {
public ItemBlockStorage(Block block) public ItemBlockStorage(Block block) {
{ super(ModBlocks.storage, ModBlocks.storage, BlockStorage.types);
super(ModBlocks.storage, ModBlocks.storage, BlockStorage.types); }
}
} }

View file

@ -1,7 +1,5 @@
package techreborn.items; package techreborn.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -10,79 +8,70 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
public class ItemDusts extends ItemTR import java.util.List;
{
public static final String[] types = new String[]
{
"Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite", "Brass", "Bronze",
"Calcite","Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "DarkAshes", "Diamond",
"Electrum","Emerald", "EnderEye", "EnderPearl", "Endstone", "Flint", "Gold", "GreenSapphire", "Grossular",
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
"Olivine","Phosphor", "Platinum", "Pyrite", "Pyrope", "RedGarnet", "Redrock", "Ruby", "Saltpeter", "Sapphire",
"Silver", "Sodalite", "Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten", "Uranium",
"Uvarovite", "YellowGarnet", "Zinc", "Cobalt", "Ardite" , "Manyullyn" , "AlBrass", "Alumite"
};
private IIcon[] textures; public class ItemDusts extends ItemTR {
public static final String[] types = new String[]
{
"Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite", "Brass", "Bronze",
"Calcite", "Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "DarkAshes", "Diamond",
"Electrum", "Emerald", "EnderEye", "EnderPearl", "Endstone", "Flint", "Gold", "GreenSapphire", "Grossular",
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
"Olivine", "Phosphor", "Platinum", "Pyrite", "Pyrope", "RedGarnet", "Redrock", "Ruby", "Saltpeter", "Sapphire",
"Silver", "Sodalite", "Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten", "Uranium",
"Uvarovite", "YellowGarnet", "Zinc", "Cobalt", "Ardite", "Manyullyn", "AlBrass", "Alumite"
};
public ItemDusts() private IIcon[] textures;
{
setUnlocalizedName("techreborn.dust");
setHasSubtypes(true);
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override public ItemDusts() {
// Registers Textures For All Dusts setUnlocalizedName("techreborn.dust");
public void registerIcons(IIconRegister iconRegister) setHasSubtypes(true);
{ setCreativeTab(TechRebornCreativeTab.instance);
textures = new IIcon[types.length]; }
for (int i = 0; i < types.length; ++i) @Override
{ // Registers Textures For All Dusts
textures[i] = iconRegister.registerIcon("techreborn:" + "dust/" +types[i]+ "Dust"); public void registerIcons(IIconRegister iconRegister) {
} textures = new IIcon[types.length];
}
@Override for (int i = 0; i < types.length; ++i) {
// Adds Texture what match's meta data textures[i] = iconRegister.registerIcon("techreborn:" + "dust/" + types[i] + "Dust");
public IIcon getIconFromDamage(int meta) }
{ }
if (meta < 0 || meta >= textures.length)
{
meta = 0;
}
return textures[meta]; @Override
} // Adds Texture what match's meta data
public IIcon getIconFromDamage(int meta) {
if (meta < 0 || meta >= textures.length) {
meta = 0;
}
@Override return textures[meta];
// gets Unlocalized Name depending on meta data }
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length)
{
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta]; @Override
} // gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;
}
// Adds Dusts SubItems To Creative Tab return super.getUnlocalizedName() + "." + types[meta];
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) }
{
for (int meta = 0; meta < types.length; ++meta)
{
list.add(new ItemStack(item, 1, meta));
}
}
@Override // Adds Dusts SubItems To Creative Tab
public EnumRarity getRarity(ItemStack itemstack) public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; ++meta) {
return EnumRarity.uncommon; list.add(new ItemStack(item, 1, meta));
} }
}
@Override
public EnumRarity getRarity(ItemStack itemstack) {
return EnumRarity.uncommon;
}
} }

View file

@ -1,7 +1,5 @@
package techreborn.items; package techreborn.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -10,71 +8,63 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
public class ItemGems extends Item{ import java.util.List;
public static final String[] types = new String[]
{
"Ruby", "Sapphire", "GreenSapphire", "Olivine", "RedGarnet", "YellowGarnet"
};
private IIcon[] textures; public class ItemGems extends Item {
public static final String[] types = new String[]
{
"Ruby", "Sapphire", "GreenSapphire", "Olivine", "RedGarnet", "YellowGarnet"
};
public ItemGems() private IIcon[] textures;
{
setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.gem");
setHasSubtypes(true);
}
@Override public ItemGems() {
// Registers Textures For All Dusts setCreativeTab(TechRebornCreativeTab.instance);
public void registerIcons(IIconRegister iconRegister) setUnlocalizedName("techreborn.gem");
{ setHasSubtypes(true);
textures = new IIcon[types.length]; }
for (int i = 0; i < types.length; ++i) @Override
{ // Registers Textures For All Dusts
textures[i] = iconRegister.registerIcon("techreborn:" + "gem/" +types[i]); public void registerIcons(IIconRegister iconRegister) {
} textures = new IIcon[types.length];
}
@Override for (int i = 0; i < types.length; ++i) {
// Adds Texture what match's meta data textures[i] = iconRegister.registerIcon("techreborn:" + "gem/" + types[i]);
public IIcon getIconFromDamage(int meta) }
{ }
if (meta < 0 || meta >= textures.length)
{
meta = 0;
}
return textures[meta]; @Override
} // Adds Texture what match's meta data
public IIcon getIconFromDamage(int meta) {
if (meta < 0 || meta >= textures.length) {
meta = 0;
}
@Override return textures[meta];
// gets Unlocalized Name depending on meta data }
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length)
{
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta]; @Override
} // gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;
}
// Adds Dusts SubItems To Creative Tab return super.getUnlocalizedName() + "." + types[meta];
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) }
{
for (int meta = 0; meta < types.length; ++meta)
{
list.add(new ItemStack(item, 1, meta));
}
}
@Override // Adds Dusts SubItems To Creative Tab
public EnumRarity getRarity(ItemStack itemstack) public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; ++meta) {
return EnumRarity.uncommon; list.add(new ItemStack(item, 1, meta));
} }
}
@Override
public EnumRarity getRarity(ItemStack itemstack) {
return EnumRarity.uncommon;
}
} }

View file

@ -1,7 +1,5 @@
package techreborn.items; package techreborn.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -10,73 +8,65 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
public class ItemIngots extends Item{ import java.util.List;
public static final String[] types = new String[]
{
"IridiumAlloy", "HotTungstenSteel", "TungstenSteel", "Iridium", "Silver", "Aluminium", "Titanium", "Chrome",
"Electrum","Tungsten", "Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
"Cobalt", "Ardite" , "Manyullyn" , "AlBrass", "Alumite"
};
private IIcon[] textures; public class ItemIngots extends Item {
public static final String[] types = new String[]
{
"IridiumAlloy", "HotTungstenSteel", "TungstenSteel", "Iridium", "Silver", "Aluminium", "Titanium", "Chrome",
"Electrum", "Tungsten", "Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
"Cobalt", "Ardite", "Manyullyn", "AlBrass", "Alumite"
};
public ItemIngots() private IIcon[] textures;
{
setCreativeTab(TechRebornCreativeTab.instance);
setHasSubtypes(true);
setUnlocalizedName("techreborn.ingot");
}
@Override public ItemIngots() {
// Registers Textures For All Dusts setCreativeTab(TechRebornCreativeTab.instance);
public void registerIcons(IIconRegister iconRegister) setHasSubtypes(true);
{ setUnlocalizedName("techreborn.ingot");
textures = new IIcon[types.length]; }
for (int i = 0; i < types.length; ++i) @Override
{ // Registers Textures For All Dusts
textures[i] = iconRegister.registerIcon("techreborn:" + "ingot/" +types[i]+ "Ingot"); public void registerIcons(IIconRegister iconRegister) {
} textures = new IIcon[types.length];
}
@Override for (int i = 0; i < types.length; ++i) {
// Adds Texture what match's meta data textures[i] = iconRegister.registerIcon("techreborn:" + "ingot/" + types[i] + "Ingot");
public IIcon getIconFromDamage(int meta) }
{ }
if (meta < 0 || meta >= textures.length)
{
meta = 0;
}
return textures[meta]; @Override
} // Adds Texture what match's meta data
public IIcon getIconFromDamage(int meta) {
if (meta < 0 || meta >= textures.length) {
meta = 0;
}
@Override return textures[meta];
// gets Unlocalized Name depending on meta data }
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length)
{
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta]; @Override
} // gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;
}
// Adds Dusts SubItems To Creative Tab return super.getUnlocalizedName() + "." + types[meta];
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) }
{
for (int meta = 0; meta < types.length; ++meta)
{
list.add(new ItemStack(item, 1, meta));
}
}
@Override // Adds Dusts SubItems To Creative Tab
public EnumRarity getRarity(ItemStack itemstack) public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; ++meta) {
return EnumRarity.uncommon; list.add(new ItemStack(item, 1, meta));
} }
}
@Override
public EnumRarity getRarity(ItemStack itemstack) {
return EnumRarity.uncommon;
}
} }

View file

@ -1,7 +1,5 @@
package techreborn.items; package techreborn.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -10,73 +8,66 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
public class ItemParts extends Item{ import java.util.List;
public static final String[] types = new String[]
{
"LazuriteChunk", "SiliconPlate", "MagnaliumPlate", "EnergeyFlowCircuit", "DataControlCircuit", "SuperConductor",
"DataStorageCircuit", "ComputerMonitor", "DiamondSawBlade","DiamondGrinder", "KanthalHeatingCoil",
"NichromeHeatingCoil", "CupronickelHeatingCoil", "MachineParts", "WolframiamGrinder",
"AluminiumMachineHull", "BronzeMachineHull","SteelMachineHull","TitaniumMachineHull", "BrassMachineHull"
};
private IIcon[] textures; public class ItemParts extends Item {
public ItemParts() public static final String[] types = new String[]
{ {
setCreativeTab(TechRebornCreativeTab.instance); "LazuriteChunk", "SiliconPlate", "MagnaliumPlate", "EnergeyFlowCircuit", "DataControlCircuit", "SuperConductor",
setHasSubtypes(true); "DataStorageCircuit", "ComputerMonitor", "DiamondSawBlade", "DiamondGrinder", "KanthalHeatingCoil",
setUnlocalizedName("techreborn.part"); "NichromeHeatingCoil", "CupronickelHeatingCoil", "MachineParts", "WolframiamGrinder",
} "AluminiumMachineHull", "BronzeMachineHull", "SteelMachineHull", "TitaniumMachineHull", "BrassMachineHull"
};
@Override private IIcon[] textures;
// Registers Textures For All Dusts
public void registerIcons(IIconRegister iconRegister)
{
textures = new IIcon[types.length];
for (int i = 0; i < types.length; ++i) public ItemParts() {
{ setCreativeTab(TechRebornCreativeTab.instance);
textures[i] = iconRegister.registerIcon("techreborn:" + "part/" +types[i]); setHasSubtypes(true);
} setUnlocalizedName("techreborn.part");
} }
@Override @Override
// Adds Texture what match's meta data // Registers Textures For All Dusts
public IIcon getIconFromDamage(int meta) public void registerIcons(IIconRegister iconRegister) {
{ textures = new IIcon[types.length];
if (meta < 0 || meta >= textures.length)
{
meta = 0;
}
return textures[meta]; for (int i = 0; i < types.length; ++i) {
} textures[i] = iconRegister.registerIcon("techreborn:" + "part/" + types[i]);
}
}
@Override @Override
// gets Unlocalized Name depending on meta data // Adds Texture what match's meta data
public String getUnlocalizedName(ItemStack itemStack) public IIcon getIconFromDamage(int meta) {
{ if (meta < 0 || meta >= textures.length) {
int meta = itemStack.getItemDamage(); meta = 0;
if (meta < 0 || meta >= types.length) }
{
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta]; return textures[meta];
} }
// Adds Dusts SubItems To Creative Tab @Override
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) // gets Unlocalized Name depending on meta data
{ public String getUnlocalizedName(ItemStack itemStack) {
for (int meta = 0; meta < types.length; ++meta) int meta = itemStack.getItemDamage();
{ if (meta < 0 || meta >= types.length) {
list.add(new ItemStack(item, 1, meta)); meta = 0;
} }
}
@Override return super.getUnlocalizedName() + "." + types[meta];
public EnumRarity getRarity(ItemStack itemstack) }
{
return EnumRarity.rare; // Adds Dusts SubItems To Creative Tab
} public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
for (int meta = 0; meta < types.length; ++meta) {
list.add(new ItemStack(item, 1, meta));
}
}
@Override
public EnumRarity getRarity(ItemStack itemstack) {
return EnumRarity.rare;
}
} }

View file

@ -5,18 +5,16 @@ import net.minecraft.item.Item;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTR extends Item{ public class ItemTR extends Item {
public ItemTR() public ItemTR() {
{ setNoRepair();
setNoRepair(); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); }
}
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{ itemIcon = iconRegister.registerIcon(ModInfo.MOD_ID + ":" + getUnlocalizedName().toLowerCase().substring(5));
itemIcon = iconRegister.registerIcon(ModInfo.MOD_ID + ":" + getUnlocalizedName().toLowerCase().substring(5)); }
}
} }

View file

@ -1,11 +1,9 @@
package techreborn.items.armor; package techreborn.items.armor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -19,125 +17,108 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.ISpecialArmor;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemGravityChest extends ItemArmor implements IElectricItem, ISpecialArmor{ import java.util.List;
public static int maxCharge = ConfigTechReborn.GravityCharge; public class ItemGravityChest extends ItemArmor implements IElectricItem, ISpecialArmor {
public static int maxCharge = ConfigTechReborn.GravityCharge;
public int tier = 3; public int tier = 3;
public int cost = 100; public int cost = 100;
public double transferLimit = 1000; public double transferLimit = 1000;
public int energyPerDamage = 100; public int energyPerDamage = 100;
public ItemGravityChest(ArmorMaterial material, int par3, int par4) public ItemGravityChest(ArmorMaterial material, int par3, int par4) {
{ super(material, par3, par4);
super(material, par3, par4); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setUnlocalizedName("techreborn.gravity");
setUnlocalizedName("techreborn.gravity"); setMaxStackSize(1);
setMaxStackSize(1); setMaxDamage(120);
setMaxDamage(120);
// isDamageable(); // isDamageable();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "items/gravity");
this.itemIcon = iconRegister.registerIcon("techreborn:" + "items/gravity"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
{ return "techreborn:" + "textures/models/gravity.png";
return "techreborn:" + "textures/models/gravity.png"; }
}
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
{ ItemStack itemStack = new ItemStack(this, 1);
ItemStack itemStack = new ItemStack(this, 1); if (getChargedItem(itemStack) == this) {
if (getChargedItem(itemStack) == this) ItemStack charged = new ItemStack(this, 1);
{ ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
ItemStack charged = new ItemStack(this, 1); itemList.add(charged);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); }
itemList.add(charged); if (getEmptyItem(itemStack) == this) {
} itemList.add(new ItemStack(this, 1, getMaxDamage()));
if (getEmptyItem(itemStack) == this) }
{ }
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
@Override @Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
{ if (world.isRemote) ;
if (world.isRemote); if (ElectricItem.manager.canUse(stack, cost)) {
if (ElectricItem.manager.canUse(stack, cost)) player.capabilities.allowFlying = true;
{
player.capabilities.allowFlying = true;
if (player.fallDistance > 0.0F) if (player.fallDistance > 0.0F)
player.fallDistance = 0; player.fallDistance = 0;
if(player.capabilities.allowFlying == true & !player.onGround) if (player.capabilities.allowFlying == true & !player.onGround)
ElectricItem.manager.discharge(stack, cost, tier, false, true, false); ElectricItem.manager.discharge(stack, cost, tier, false, true, false);
if(!ElectricItem.manager.canUse(stack, cost)) if (!ElectricItem.manager.canUse(stack, cost))
player.capabilities.allowFlying = false; player.capabilities.allowFlying = false;
} }
if (player.fallDistance > 0.0F) player.fallDistance = 0; if (player.fallDistance > 0.0F) player.fallDistance = 0;
} }
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack) {
{ return true;
return true; }
}
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack) {
{ return maxCharge;
return maxCharge; }
}
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack) {
{ return tier;
return tier; }
}
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack) {
{ return transferLimit;
return transferLimit; }
}
public int getEnergyPerDamage() public int getEnergyPerDamage() {
{
return energyPerDamage; return energyPerDamage;
} }
@Override @Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
{ if (source.isUnblockable()) {
if (source.isUnblockable())
{
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 3); return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 3);
} else { } else {
double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio(); double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
@ -148,10 +129,8 @@ public class ItemGravityChest extends ItemArmor implements IElectricItem, ISpeci
} }
@Override @Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
{ if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) {
if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage())
{
return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio()); return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio());
} else { } else {
return 0; return 0;
@ -159,18 +138,15 @@ public class ItemGravityChest extends ItemArmor implements IElectricItem, ISpeci
} }
@Override @Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
{
ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false, false); ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false, false);
} }
public double getDamageAbsorptionRatio() public double getDamageAbsorptionRatio() {
{
return 1.1000000000000001D; return 1.1000000000000001D;
} }
private double getBaseAbsorptionRatio() private double getBaseAbsorptionRatio() {
{
return 0.14999999999999999D; return 0.14999999999999999D;
} }

View file

@ -1,99 +1,87 @@
package techreborn.items.armor; package techreborn.items.armor;
import java.util.List;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn;
public class ItemLapotronPack extends ItemArmor implements IElectricItem{ import java.util.List;
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge; public class ItemLapotronPack extends ItemArmor implements IElectricItem {
public static final int tier = ConfigTechReborn.LapotronPackTier;
public double transferLimit = 100000;
public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3) public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
{ public static final int tier = ConfigTechReborn.LapotronPackTier;
super(armormaterial, par2, par3); public double transferLimit = 100000;
setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.lapotronpack");
setMaxStackSize(1);
}
@SideOnly(Side.CLIENT) public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3) {
@Override super(armormaterial, par2, par3);
public void registerIcons(IIconRegister iconRegister) setCreativeTab(TechRebornCreativeTab.instance);
{ setUnlocalizedName("techreborn.lapotronpack");
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lapotronicEnergyOrb"); setMaxStackSize(1);
} }
@Override @SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT) @Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lapotronicEnergyOrb");
return "techreborn:" + "textures/models/lapotronpack.png"; }
}
@SuppressWarnings({"rawtypes", "unchecked"}) @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
{ return "techreborn:" + "textures/models/lapotronpack.png";
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 @SuppressWarnings({"rawtypes", "unchecked"})
public boolean canProvideEnergy(ItemStack itemStack) @SideOnly(Side.CLIENT)
{ public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
return true; 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 @Override
public Item getChargedItem(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack) {
{ return true;
return this; }
}
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public double getMaxCharge(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack) {
{ return this;
return maxCharge; }
}
@Override @Override
public int getTier(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack) {
{ return maxCharge;
return tier; }
}
@Override @Override
public double getTransferLimit(ItemStack itemStack) public int getTier(ItemStack itemStack) {
{ return tier;
return transferLimit; }
}
@Override
public double getTransferLimit(ItemStack itemStack) {
return transferLimit;
}
} }

View file

@ -1,7 +1,7 @@
package techreborn.items.armor; package techreborn.items.armor;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -12,88 +12,76 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemLithiumBatpack extends ItemArmor implements IElectricItem{ import java.util.List;
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge; public class ItemLithiumBatpack extends ItemArmor implements IElectricItem {
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
public double transferLimit = 10000;
public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4) public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
{ public static final int tier = ConfigTechReborn.LithiumBatpackTier;
super(armorMaterial, par3, par4); public double transferLimit = 10000;
setMaxStackSize(1);
setUnlocalizedName("techreborn.lithiumbatpack");
setCreativeTab(TechRebornCreativeTab.instance);
}
@SideOnly(Side.CLIENT) public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4) {
@Override super(armorMaterial, par3, par4);
public void registerIcons(IIconRegister iconRegister) setMaxStackSize(1);
{ setUnlocalizedName("techreborn.lithiumbatpack");
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lithiumBatpack"); setCreativeTab(TechRebornCreativeTab.instance);
} }
@Override @SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT) @Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lithiumBatpack");
return "techreborn:" + "textures/models/lithiumbatpack.png"; }
}
@SuppressWarnings({"rawtypes", "unchecked"}) @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
{ return "techreborn:" + "textures/models/lithiumbatpack.png";
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 @SuppressWarnings({"rawtypes", "unchecked"})
public boolean canProvideEnergy(ItemStack itemStack) @SideOnly(Side.CLIENT)
{ public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
return true; 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 @Override
public Item getChargedItem(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack) {
{ return true;
return this; }
}
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public double getMaxCharge(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack) {
{ return this;
return maxCharge; }
}
@Override @Override
public int getTier(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack) {
{ return maxCharge;
return tier; }
}
@Override @Override
public double getTransferLimit(ItemStack itemStack) public int getTier(ItemStack itemStack) {
{ return tier;
return transferLimit; }
}
@Override
public double getTransferLimit(ItemStack itemStack) {
return transferLimit;
}
} }

View file

@ -1,11 +1,9 @@
package techreborn.items.tools; package techreborn.items.tools;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import java.util.List;
import mcp.mobius.waila.api.impl.ConfigHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -13,26 +11,24 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.util.TorchHelper; import techreborn.util.TorchHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem{ import java.util.List;
public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
public static final int maxCharge = ConfigTechReborn.AdvancedDrillCharge; public static final int maxCharge = ConfigTechReborn.AdvancedDrillCharge;
public int cost = 250;; public int cost = 250;
;
public static final int tier = ConfigTechReborn.AdvancedDrillTier; public static final int tier = ConfigTechReborn.AdvancedDrillTier;
public double transferLimit = 100; public double transferLimit = 100;
public ItemAdvancedDrill() public ItemAdvancedDrill() {
{
super(ToolMaterial.EMERALD); super(ToolMaterial.EMERALD);
efficiencyOnProperMaterial = 20F; efficiencyOnProperMaterial = 20F;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
@ -43,31 +39,26 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/advancedDrill"); this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/advancedDrill");
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
{
ItemStack itemStack = new ItemStack(this, 1); ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) if (getChargedItem(itemStack) == this) {
{
ItemStack charged = new ItemStack(this, 1); ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
itemList.add(charged); itemList.add(charged);
} }
if (getEmptyItem(itemStack) == this) if (getEmptyItem(itemStack) == this) {
{
itemList.add(new ItemStack(this, 1, getMaxDamage())); itemList.add(new ItemStack(this, 1, getMaxDamage()));
} }
} }
@Override @Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
{
ElectricItem.manager.use(stack, cost, entityLiving); ElectricItem.manager.use(stack, cost, entityLiving);
return true; return true;
} }
@ -79,13 +70,11 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem{
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) { public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!ElectricItem.manager.canUse(stack, cost)) if (!ElectricItem.manager.canUse(stack, cost)) {
{
return 4.0F; return 4.0F;
} }
if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F) if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F) {
{
return efficiencyOnProperMaterial; return efficiencyOnProperMaterial;
} else { } else {
return super.getDigSpeed(stack, block, meta); return super.getDigSpeed(stack, block, meta);
@ -93,14 +82,12 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem{
} }
@Override @Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
{
return true; return true;
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
{
return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
} }

View file

@ -1,14 +1,9 @@
package techreborn.items.tools; package techreborn.items.tools;
import java.util.List;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn;
import techreborn.util.TorchHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -16,139 +11,122 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory; import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn;
import techreborn.util.TorchHelper;
public class ItemOmniTool extends ItemPickaxe implements IElectricItem{ import java.util.List;
public static final int maxCharge = ConfigTechReborn.OmniToolCharge; public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
public static final int tier = ConfigTechReborn.OmniToolTier;
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
public static final int tier = ConfigTechReborn.OmniToolTier;
public int cost = 100; public int cost = 100;
public int hitCost = 125; public int hitCost = 125;
public ItemOmniTool(ToolMaterial toolMaterial) public ItemOmniTool(ToolMaterial toolMaterial) {
{ super(toolMaterial);
super(toolMaterial); efficiencyOnProperMaterial = 13F;
efficiencyOnProperMaterial = 13F;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setMaxDamage(200); setMaxDamage(200);
setUnlocalizedName("techreborn.omniTool"); setUnlocalizedName("techreborn.omniTool");
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/omnitool");
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/omnitool"); }
}
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
{ ItemStack itemStack = new ItemStack(this, 1);
ItemStack itemStack = new ItemStack(this, 1); if (getChargedItem(itemStack) == this) {
if (getChargedItem(itemStack) == this) ItemStack charged = new ItemStack(this, 1);
{ ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
ItemStack charged = new ItemStack(this, 1); itemList.add(charged);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,false); }
itemList.add(charged); if (getEmptyItem(itemStack) == this) {
} itemList.add(new ItemStack(this, 1, getMaxDamage()));
if (getEmptyItem(itemStack) == this) }
{ }
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
@Override @Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
{ ElectricItem.manager.use(stack, cost, entityLiving);
ElectricItem.manager.use(stack, cost, entityLiving); return true;
return true; }
}
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack) 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);
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 @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) public float getDigSpeed(ItemStack stack, Block block, int meta) {
{ if (!ElectricItem.manager.canUse(stack, cost)) {
if (!ElectricItem.manager.canUse(stack, cost)) return 5.0F;
{ }
return 5.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) 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;
return efficiencyOnProperMaterial; } else {
} else { return super.getDigSpeed(stack, block, meta);
return super.getDigSpeed(stack, block, meta); }
} }
}
@Override @Override
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
{ if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
{ }
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F); return false;
} }
return false;
}
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
{ return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); }
}
@Override @Override
public boolean isRepairable() public boolean isRepairable() {
{ return false;
return false; }
}
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack) {
{ return false;
return false; }
}
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack) {
{ return maxCharge;
return maxCharge; }
}
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack) {
{ return 2;
return 2; }
}
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack) {
{ return 200;
return 200; }
}
} }

View file

@ -1,7 +1,7 @@
package techreborn.items.tools; package techreborn.items.tools;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem; import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItem;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -16,101 +16,87 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemRockCutter extends ItemPickaxe implements IElectricItem{ import java.util.List;
public static final int maxCharge = ConfigTechReborn.RockCutterCharge; public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
public int cost = 500; public int cost = 500;
public static final int tier = ConfigTechReborn.RockCutterTier; public static final int tier = ConfigTechReborn.RockCutterTier;
public ItemRockCutter(ToolMaterial toolMaterial) public ItemRockCutter(ToolMaterial toolMaterial) {
{ super(toolMaterial);
super(toolMaterial); setUnlocalizedName("techreborn.rockcutter");
setUnlocalizedName("techreborn.rockcutter"); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setMaxStackSize(1);
setMaxStackSize(1);
setMaxDamage(27); setMaxDamage(27);
efficiencyOnProperMaterial = 16F; efficiencyOnProperMaterial = 16F;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/rockcutter");
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/rockcutter"); }
}
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
{ ItemStack itemStack = new ItemStack(this, 1);
ItemStack itemStack = new ItemStack(this, 1); if (getChargedItem(itemStack) == this) {
if (getChargedItem(itemStack) == this) ItemStack charged = new ItemStack(this, 1);
{ ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
ItemStack charged = new ItemStack(this, 1); itemList.add(charged);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); }
itemList.add(charged); if (getEmptyItem(itemStack) == this) {
} itemList.add(new ItemStack(this, 1, getMaxDamage()));
if (getEmptyItem(itemStack) == this) }
{ }
itemList.add(new ItemStack(this, 1, getMaxDamage()));
}
}
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack) public boolean canHarvestBlock(Block block, ItemStack stack) {
{ return Items.diamond_pickaxe.canHarvestBlock(block, stack);
return Items.diamond_pickaxe.canHarvestBlock(block, stack); }
}
@Override @Override
public boolean isRepairable() public boolean isRepairable() {
{ return false;
return false; }
}
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
{ par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
par1ItemStack.addEnchantment(Enchantment.silkTouch, 1); }
}
@Override @Override
public boolean canProvideEnergy(ItemStack itemStack) public boolean canProvideEnergy(ItemStack itemStack) {
{ return false;
return false; }
}
@Override @Override
public Item getChargedItem(ItemStack itemStack) public Item getChargedItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public Item getEmptyItem(ItemStack itemStack) public Item getEmptyItem(ItemStack itemStack) {
{ return this;
return this; }
}
@Override @Override
public double getMaxCharge(ItemStack itemStack) public double getMaxCharge(ItemStack itemStack) {
{ return maxCharge;
return maxCharge; }
}
@Override @Override
public int getTier(ItemStack itemStack) public int getTier(ItemStack itemStack) {
{ return tier;
return tier; }
}
@Override @Override
public double getTransferLimit(ItemStack itemStack) public double getTransferLimit(ItemStack itemStack) {
{ return 300;
return 300; }
}
} }

View file

@ -1,12 +1,11 @@
package techreborn.lib; package techreborn.lib;
public class ModInfo public class ModInfo {
{ public static final String MOD_NAME = "TechReborn";
public static final String MOD_NAME = "TechReborn"; public static final String MOD_ID = "techreborn";
public static final String MOD_ID = "techreborn"; public static final String MOD_VERSION = "@MODVERSION@";
public static final String MOD_VERSION = "@MODVERSION@"; public static final String MOD_DEPENDENCUIES = "required-after:IC2@:";
public static final String MOD_DEPENDENCUIES = "required-after:IC2@:"; public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy"; public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy"; public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
} }

View file

@ -1,20 +1,19 @@
package techreborn.packets; package techreborn.packets;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import java.util.EnumMap;
import java.util.logging.Logger;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.FMLEmbeddedChannel; import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import cpw.mods.fml.common.network.FMLOutboundHandler; import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import java.io.IOException;
import java.util.EnumMap;
import java.util.logging.Logger;
public class PacketHandler extends FMLIndexedMessageToMessageCodec<SimplePacket> { public class PacketHandler extends FMLIndexedMessageToMessageCodec<SimplePacket> {
private static EnumMap<Side, FMLEmbeddedChannel> channels; private static EnumMap<Side, FMLEmbeddedChannel> channels;

View file

@ -1,9 +1,7 @@
package techreborn.packets; package techreborn.packets;
import com.google.common.base.Charsets;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -11,7 +9,7 @@ import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import com.google.common.base.Charsets; import java.io.IOException;
public abstract class SimplePacket { public abstract class SimplePacket {
protected EntityPlayer player; protected EntityPlayer player;

View file

@ -38,35 +38,35 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
energy.updateEntity(); energy.updateEntity();
if(!worldObj.isRemote){ if (!worldObj.isRemote) {
if(isRunning){ if (isRunning) {
if(ItemUtils.isItemEqual(currentRecipe.getInputItem(), getStackInSlot(0), true, true)){ if (ItemUtils.isItemEqual(currentRecipe.getInputItem(), getStackInSlot(0), true, true)) {
if(!hasTakenCells){ if (!hasTakenCells) {
if(getStackInSlot(1) != null && getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().equals("ic2.itemFluidCell")){ if (getStackInSlot(1) != null && getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().equals("ic2.itemFluidCell")) {
if(getStackInSlot(1).stackSize >= currentRecipe.getCells()){ if (getStackInSlot(1).stackSize >= currentRecipe.getCells()) {
decrStackSize(1, currentRecipe.getCells()); decrStackSize(1, currentRecipe.getCells());
hasTakenCells = true; hasTakenCells = true;
} }
} }
} }
if(hasTakenCells && hasTakenItem){ if (hasTakenCells && hasTakenItem) {
if(tickTime == currentRecipe.getTickTime()) { if (tickTime == currentRecipe.getTickTime()) {
if(areAnyOutputsFull()){ if (areAnyOutputsFull()) {
return; return;
} }
if(areOutputsEmpty()){ if (areOutputsEmpty()) {
setOutput(1, currentRecipe.getOutput1()); setOutput(1, currentRecipe.getOutput1());
setOutput(2, currentRecipe.getOutput2()); setOutput(2, currentRecipe.getOutput2());
setOutput(3, currentRecipe.getOutput3()); setOutput(3, currentRecipe.getOutput3());
setOutput(4, currentRecipe.getOutput4()); setOutput(4, currentRecipe.getOutput4());
} else if(areOutputsEqual()){ } else if (areOutputsEqual()) {
if(currentRecipe.getOutput1() != null) if (currentRecipe.getOutput1() != null)
increacseItemStack(1, 1); increacseItemStack(1, 1);
if(currentRecipe.getOutput2() != null) if (currentRecipe.getOutput2() != null)
increacseItemStack(2, 1); increacseItemStack(2, 1);
if(currentRecipe.getOutput3() != null) if (currentRecipe.getOutput3() != null)
increacseItemStack(3, 1); increacseItemStack(3, 1);
if(currentRecipe.getOutput4() != null) if (currentRecipe.getOutput4() != null)
increacseItemStack(4, 1); increacseItemStack(4, 1);
} }
tickTime = 0; tickTime = 0;
@ -76,10 +76,10 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
syncWithAll(); syncWithAll();
return; return;
} }
if(energy.canUseEnergy(euTick)){ if (energy.canUseEnergy(euTick)) {
if(getStackInSlot(0) != null && ItemUtils.isItemEqual(getStackInSlot(0), currentRecipe.getInputItem(), true, true)){ if (getStackInSlot(0) != null && ItemUtils.isItemEqual(getStackInSlot(0), currentRecipe.getInputItem(), true, true)) {
if(energy.useEnergy(5)){ if (energy.useEnergy(5)) {
tickTime ++; tickTime++;
} }
} }
} }
@ -87,17 +87,17 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
} }
} else { } else {
//sets a new recipe //sets a new recipe
if(getStackInSlot(0) != null && currentRecipe == null){ if (getStackInSlot(0) != null && currentRecipe == null) {
for(CentrifugeRecipie recipie: TechRebornAPI.centrifugeRecipies){ for (CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies) {
if(ItemUtils.isItemEqual(recipie.getInputItem(), getStackInSlot(0), true, true)){ if (ItemUtils.isItemEqual(recipie.getInputItem(), getStackInSlot(0), true, true)) {
currentRecipe = new CentrifugeRecipie(recipie); currentRecipe = new CentrifugeRecipie(recipie);
} }
} }
} }
if(!isRunning && currentRecipe != null){ if (!isRunning && currentRecipe != null) {
if(areOutputsEqual() || !areAnyOutputsFull()){ if (areOutputsEqual() || !areAnyOutputsFull()) {
if(getStackInSlot(0) != null && currentRecipe.getInputItem().stackSize <= getStackInSlot(0).stackSize){ if (getStackInSlot(0) != null && currentRecipe.getInputItem().stackSize <= getStackInSlot(0).stackSize) {
if(energy.canUseEnergy(euTick)){ if (energy.canUseEnergy(euTick)) {
decrStackSize(0, currentRecipe.getInputItem().stackSize); decrStackSize(0, currentRecipe.getInputItem().stackSize);
hasTakenItem = true; hasTakenItem = true;
tickTime = 0; tickTime = 0;
@ -111,59 +111,59 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
} }
} }
public boolean areOutputsEqual(){ public boolean areOutputsEqual() {
if(currentRecipe == null){ if (currentRecipe == null) {
return false; return false;
} }
boolean boo = false; boolean boo = false;
if(currentRecipe.getOutput1() != null && ItemUtils.isItemEqual(getOutputItemStack(1), currentRecipe.getOutput1(), false, true)){ if (currentRecipe.getOutput1() != null && ItemUtils.isItemEqual(getOutputItemStack(1), currentRecipe.getOutput1(), false, true)) {
boo = true;
}
if(currentRecipe.getOutput2() != null && ItemUtils.isItemEqual(getOutputItemStack(2), currentRecipe.getOutput2(), false, true)){
boo = true; boo = true;
} }
if(currentRecipe.getOutput3() != null && ItemUtils.isItemEqual(getOutputItemStack(3), currentRecipe.getOutput3(), false, true)){ if (currentRecipe.getOutput2() != null && ItemUtils.isItemEqual(getOutputItemStack(2), currentRecipe.getOutput2(), false, true)) {
boo = true; boo = true;
} }
if(currentRecipe.getOutput4() != null && ItemUtils.isItemEqual(getOutputItemStack(4), currentRecipe.getOutput4(), false, true)){ if (currentRecipe.getOutput3() != null && ItemUtils.isItemEqual(getOutputItemStack(3), currentRecipe.getOutput3(), false, true)) {
boo = true;
}
if (currentRecipe.getOutput4() != null && ItemUtils.isItemEqual(getOutputItemStack(4), currentRecipe.getOutput4(), false, true)) {
boo = true; boo = true;
} }
return boo; return boo;
} }
public boolean areOutputsEmpty(){ public boolean areOutputsEmpty() {
return getOutputItemStack(1) == null && getOutputItemStack(2) == null && getOutputItemStack(3) == null && getOutputItemStack(4) == null; return getOutputItemStack(1) == null && getOutputItemStack(2) == null && getOutputItemStack(3) == null && getOutputItemStack(4) == null;
} }
public boolean areAnyOutputsFull(){ public boolean areAnyOutputsFull() {
if(currentRecipe.getOutput1() != null && getOutputItemStack(1) != null && getOutputItemStack(1).stackSize + currentRecipe.getOutput1().stackSize > currentRecipe.getOutput1().getMaxStackSize()){ if (currentRecipe.getOutput1() != null && getOutputItemStack(1) != null && getOutputItemStack(1).stackSize + currentRecipe.getOutput1().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
if(currentRecipe.getOutput2() != null && getOutputItemStack(2) != null && getOutputItemStack(2).stackSize + currentRecipe.getOutput2().stackSize > currentRecipe.getOutput1().getMaxStackSize()){
return true; return true;
} }
if(currentRecipe.getOutput3() != null && getOutputItemStack(3) != null && getOutputItemStack(3).stackSize + currentRecipe.getOutput3().stackSize > currentRecipe.getOutput1().getMaxStackSize()){ if (currentRecipe.getOutput2() != null && getOutputItemStack(2) != null && getOutputItemStack(2).stackSize + currentRecipe.getOutput2().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true; return true;
} }
if(currentRecipe.getOutput4() != null && getOutputItemStack(4) != null && getOutputItemStack(4).stackSize + currentRecipe.getOutput4().stackSize > currentRecipe.getOutput1().getMaxStackSize()){ if (currentRecipe.getOutput3() != null && getOutputItemStack(3) != null && getOutputItemStack(3).stackSize + currentRecipe.getOutput3().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
if (currentRecipe.getOutput4() != null && getOutputItemStack(4) != null && getOutputItemStack(4).stackSize + currentRecipe.getOutput4().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true; return true;
} }
return false; return false;
} }
public ItemStack getOutputItemStack(int slot){ public ItemStack getOutputItemStack(int slot) {
return getStackInSlot(slot + 1); return getStackInSlot(slot + 1);
} }
public void increacseItemStack(int slot, int amount) { public void increacseItemStack(int slot, int amount) {
if(getOutputItemStack(slot) == null){ if (getOutputItemStack(slot) == null) {
return; return;
} }
decrStackSize(slot + 1, -amount); decrStackSize(slot + 1, -amount);
} }
public void setOutput(int slot, ItemStack stack){ public void setOutput(int slot, ItemStack stack) {
if(stack == null){ if (stack == null) {
return; return;
} }
setInventorySlotContents(slot + 1, stack); setInventorySlotContents(slot + 1, stack);
@ -174,8 +174,8 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
super.readFromNBT(tagCompound); super.readFromNBT(tagCompound);
inventory.readFromNBT(tagCompound); inventory.readFromNBT(tagCompound);
String recipeName = tagCompound.getString("recipe"); String recipeName = tagCompound.getString("recipe");
for(CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies){ for (CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies) {
if(recipie.getInputItem().getUnlocalizedName().equals(recipeName)){ if (recipie.getInputItem().getUnlocalizedName().equals(recipeName)) {
currentRecipe = new CentrifugeRecipie(recipie); currentRecipe = new CentrifugeRecipie(recipie);
} }
} }
@ -193,7 +193,7 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
} }
public void writeUpdateToNBT(NBTTagCompound tagCompound) { public void writeUpdateToNBT(NBTTagCompound tagCompound) {
if(currentRecipe != null){ if (currentRecipe != null) {
tagCompound.setString("recipe", currentRecipe.getInputItem().getUnlocalizedName()); tagCompound.setString("recipe", currentRecipe.getInputItem().getUnlocalizedName());
} else { } else {
tagCompound.setString("recipe", "none"); tagCompound.setString("recipe", "none");
@ -297,7 +297,8 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
} }
@Override @Override
public void setFacing(short facing) {} public void setFacing(short facing) {
}
@Override @Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) { public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
@ -317,11 +318,11 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
@Override @Override
public int[] getAccessibleSlotsFromSide(int side) { public int[] getAccessibleSlotsFromSide(int side) {
//Top //Top
if(side == 1){ if (side == 1) {
return new int[]{0}; return new int[]{0};
} }
//Bottom //Bottom
if(side == 0){ if (side == 0) {
return new int[]{1}; return new int[]{1};
} }
//Not bottom or top //Not bottom or top
@ -331,11 +332,11 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
@Override @Override
public boolean canInsertItem(int slot, ItemStack stack, int side) { public boolean canInsertItem(int slot, ItemStack stack, int side) {
//Bottom //Bottom
if(side == 0){ if (side == 0) {
return stack.getUnlocalizedName().equals("ic2.itemFluidCell"); return stack.getUnlocalizedName().equals("ic2.itemFluidCell");
} }
//Not bottom or top //Not bottom or top
if(side >= 2){ if (side >= 2) {
return false; return false;
} }
return true; return true;

View file

@ -21,9 +21,9 @@ public class TileMachineBase extends TileEntity {
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addWailaInfo(List<String> info) { public void addWailaInfo(List<String> info) {
} }
public void syncWithAll() { public void syncWithAll() {
if (!worldObj.isRemote) { if (!worldObj.isRemote) {

View file

@ -15,7 +15,7 @@ import techreborn.util.ItemUtils;
import java.util.List; import java.util.List;
public class TileQuantumChest extends TileMachineBase implements IInventory ,IWrenchable{ public class TileQuantumChest extends TileMachineBase implements IInventory, IWrenchable {
//Slot 0 = Input //Slot 0 = Input
//Slot 1 = Output //Slot 1 = Output
@ -27,7 +27,7 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
@Override @Override
public void updateEntity() { public void updateEntity() {
if(storedItem != null){ if (storedItem != null) {
ItemStack fakeStack = storedItem.copy(); ItemStack fakeStack = storedItem.copy();
fakeStack.stackSize = 1; fakeStack.stackSize = 1;
setInventorySlotContents(2, fakeStack); setInventorySlotContents(2, fakeStack);
@ -35,26 +35,26 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
setInventorySlotContents(2, null); setInventorySlotContents(2, null);
} }
if(getStackInSlot(0) != null){ if (getStackInSlot(0) != null) {
if(storedItem == null){ if (storedItem == null) {
storedItem = getStackInSlot(0); storedItem = getStackInSlot(0);
setInventorySlotContents(0, null); setInventorySlotContents(0, null);
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)){ } else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
if(storedItem.stackSize <=Integer.MAX_VALUE - getStackInSlot(0).stackSize){ if (storedItem.stackSize <= Integer.MAX_VALUE - getStackInSlot(0).stackSize) {
storedItem.stackSize += getStackInSlot(0).stackSize; storedItem.stackSize += getStackInSlot(0).stackSize;
decrStackSize(0, getStackInSlot(0).stackSize); decrStackSize(0, getStackInSlot(0).stackSize);
} }
} }
} }
if(storedItem != null && getStackInSlot(1) == null){ if (storedItem != null && getStackInSlot(1) == null) {
ItemStack itemStack = storedItem.copy(); ItemStack itemStack = storedItem.copy();
itemStack.stackSize = itemStack.getMaxStackSize(); itemStack.stackSize = itemStack.getMaxStackSize();
setInventorySlotContents(1, itemStack); setInventorySlotContents(1, itemStack);
storedItem.stackSize -= itemStack.getMaxStackSize(); storedItem.stackSize -= itemStack.getMaxStackSize();
} else if(ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)){ } else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize; int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
if(storedItem.stackSize >= wanted){ if (storedItem.stackSize >= wanted) {
decrStackSize(1, -wanted); decrStackSize(1, -wanted);
storedItem.stackSize -= wanted; storedItem.stackSize -= wanted;
} else { } else {
@ -89,13 +89,12 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
storedItem = null; storedItem = null;
if (tagCompound.hasKey("storedStack")) if (tagCompound.hasKey("storedStack")) {
{
storedItem = ItemStack. storedItem = ItemStack.
loadItemStackFromNBT((NBTTagCompound)tagCompound.getTag("storedStack")); loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
} }
if(storedItem != null){ if (storedItem != null) {
storedItem.stackSize = tagCompound.getInteger("storedQuantity"); storedItem.stackSize = tagCompound.getInteger("storedQuantity");
} }
} }
@ -108,12 +107,10 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
public void writeToNBTWithoutCoords(NBTTagCompound tagCompound) { public void writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
inventory.writeToNBT(tagCompound); inventory.writeToNBT(tagCompound);
if (storedItem != null) if (storedItem != null) {
{
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound())); tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
tagCompound.setInteger("storedQuantity", storedItem.stackSize); tagCompound.setInteger("storedQuantity", storedItem.stackSize);
} } else
else
tagCompound.setInteger("storedQuantity", 0); tagCompound.setInteger("storedQuantity", 0);
} }
@ -177,34 +174,34 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
return inventory.isItemValidForSlot(slot, stack); return inventory.isItemValidForSlot(slot, stack);
} }
@Override @Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false; return false;
} }
@Override @Override
public short getFacing() { public short getFacing() {
return 0; return 0;
} }
@Override @Override
public void setFacing(short facing) { public void setFacing(short facing) {
} }
@Override @Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) { public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true; return true;
} }
@Override @Override
public float getWrenchDropRate() { public float getWrenchDropRate() {
return 1F; return 1F;
} }
@Override @Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return getDropWithNBT(); return getDropWithNBT();
} }
public ItemStack getDropWithNBT() { public ItemStack getDropWithNBT() {
NBTTagCompound tileEntity = new NBTTagCompound(); NBTTagCompound tileEntity = new NBTTagCompound();
@ -220,11 +217,11 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
super.addWailaInfo(info); super.addWailaInfo(info);
int size = 0; int size = 0;
String name = "of nothing"; String name = "of nothing";
if(storedItem != null){ if (storedItem != null) {
name = storedItem.getDisplayName(); name = storedItem.getDisplayName();
size += storedItem.stackSize; size += storedItem.stackSize;
} }
if( getStackInSlot(1) != null){ if (getStackInSlot(1) != null) {
name = getStackInSlot(1).getDisplayName(); name = getStackInSlot(1).getDisplayName();
size += getStackInSlot(1).stackSize; size += getStackInSlot(1).stackSize;
} }

View file

@ -1,9 +1,6 @@
package techreborn.tiles; package techreborn.tiles;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -21,6 +18,8 @@ import techreborn.util.FluidUtils;
import techreborn.util.Inventory; import techreborn.util.Inventory;
import techreborn.util.Tank; import techreborn.util.Tank;
import java.util.List;
public class TileQuantumTank extends TileMachineBase implements IFluidHandler, IInventory, IWrenchable { public class TileQuantumTank extends TileMachineBase implements IFluidHandler, IInventory, IWrenchable {
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this); public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
@ -66,9 +65,9 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler, I
super.updateEntity(); super.updateEntity();
FluidUtils.drainContainers(this, inventory, 0, 1); FluidUtils.drainContainers(this, inventory, 0, 1);
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType()); FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
if(tank.getFluidType() != null && getStackInSlot(2) == null){ if (tank.getFluidType() != null && getStackInSlot(2) == null) {
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock())); inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
} else if(tank.getFluidType() == null && getStackInSlot(2) != null){ } else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
setInventorySlotContents(2, null); setInventorySlotContents(2, null);
} }
} }
@ -206,7 +205,7 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler, I
@Override @Override
public void addWailaInfo(List<String> info) { public void addWailaInfo(List<String> info) {
super.addWailaInfo(info); super.addWailaInfo(info);
if(tank.getFluid() != null){ if (tank.getFluid() != null) {
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName()); info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
} else { } else {
info.add("Empty"); info.add("Empty");

View file

@ -1,20 +1,16 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.energy.prefab.BasicSink; import ic2.api.energy.prefab.BasicSink;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import techreborn.api.CentrifugeRecipie; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.api.RollingMachineRecipie; import techreborn.api.RollingMachineRecipie;
import techreborn.api.TechRebornAPI;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.util.Inventory; import techreborn.util.Inventory;
public class TileRollingMachine extends TileMachineBase implements IWrenchable{ public class TileRollingMachine extends TileMachineBase implements IWrenchable {
public BasicSink energy; public BasicSink energy;
public Inventory inventory = new Inventory(10, "TileRollingMachine", 64); public Inventory inventory = new Inventory(10, "TileRollingMachine", 64);
public boolean isRunning; public boolean isRunning;
@ -23,44 +19,43 @@ public class TileRollingMachine extends TileMachineBase implements IWrenchable{
public int euTick = 5; public int euTick = 5;
public TileRollingMachine() public TileRollingMachine() {
{
energy = new BasicSink(this, 100000, 1); energy = new BasicSink(this, 100000, 1);
} }
@Override @Override
public void updateEntity() public void updateEntity() {
{ super.updateEntity();
super.updateEntity(); energy.updateEntity();
energy.updateEntity();
} }
@Override @Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false; return false;
} }
@Override @Override
public short getFacing() { public short getFacing() {
return 0; return 0;
} }
@Override @Override
public void setFacing(short facing) {} public void setFacing(short facing) {
}
@Override @Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) { public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true; return true;
} }
@Override @Override
public float getWrenchDropRate() { public float getWrenchDropRate() {
return 1.0F; return 1.0F;
} }
@Override @Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.RollingMachine, 1); return new ItemStack(ModBlocks.RollingMachine, 1);
} }
} }

View file

@ -11,12 +11,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.util.FluidUtils; import techreborn.util.FluidUtils;
@ -45,7 +40,8 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
} }
@Override @Override
public void setFacing(short facing) {} public void setFacing(short facing) {
}
@Override @Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) { public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
@ -69,7 +65,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
@Override @Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return tank.drain(resource.amount, doDrain); return tank.drain(resource.amount, doDrain);
} }
@Override @Override
@ -130,13 +126,13 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
super.updateEntity(); super.updateEntity();
FluidUtils.drainContainers(this, inventory, 0, 1); FluidUtils.drainContainers(this, inventory, 0, 1);
energySource.updateEntity(); energySource.updateEntity();
if(tank.getFluidAmount() > 0 && energySource.getCapacity() - energySource.getEnergyStored() >= euTick){ if (tank.getFluidAmount() > 0 && energySource.getCapacity() - energySource.getEnergyStored() >= euTick) {
tank.drain(1, true); tank.drain(1, true);
energySource.addEnergy(euTick); energySource.addEnergy(euTick);
} }
if(tank.getFluidType() != null && getStackInSlot(2) == null){ if (tank.getFluidType() != null && getStackInSlot(2) == null) {
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock())); inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
} else if(tank.getFluidType() == null && getStackInSlot(2) != null){ } else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
setInventorySlotContents(2, null); setInventorySlotContents(2, null);
} }
} }

View file

@ -7,14 +7,12 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CraftingHelper { public class CraftingHelper {
public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
{ CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(outputItemStack, objectInputs));
CraftingManager.getInstance().getRecipeList() .add(new ShapedOreRecipe(outputItemStack, objectInputs)); }
}
public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
{ CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(outputItemStack, objectInputs));
CraftingManager.getInstance().getRecipeList() .add(new ShapelessOreRecipe(outputItemStack, objectInputs)); }
}
} }

View file

@ -7,27 +7,27 @@ import net.minecraftforge.oredict.OreDictionary;
* Created by mark on 12/04/15. * Created by mark on 12/04/15.
*/ */
public class ItemUtils { public class ItemUtils {
public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) { public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
if (a == null || b == null) if (a == null || b == null)
return false; return false;
if (a.getItem() != b.getItem()) if (a.getItem() != b.getItem())
return false; return false;
if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b)) if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b))
return false; return false;
if (matchDamage && a.getHasSubtypes()) { if (matchDamage && a.getHasSubtypes()) {
if (isWildcard(a) || isWildcard(b)) if (isWildcard(a) || isWildcard(b))
return true; return true;
if (a.getItemDamage() != b.getItemDamage()) if (a.getItemDamage() != b.getItemDamage())
return false; return false;
} }
return true; return true;
} }
public static boolean isWildcard(ItemStack stack) { public static boolean isWildcard(ItemStack stack) {
return isWildcard(stack.getItemDamage()); return isWildcard(stack.getItemDamage());
} }
public static boolean isWildcard(int damage) { public static boolean isWildcard(int damage) {
return damage == -1 || damage == OreDictionary.WILDCARD_VALUE; return damage == -1 || damage == OreDictionary.WILDCARD_VALUE;
} }
} }

View file

@ -1,55 +1,45 @@
package techreborn.util; package techreborn.util;
import org.apache.logging.log4j.Level;
import techreborn.lib.ModInfo;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import techreborn.lib.ModInfo;
public class LogHelper { public class LogHelper {
public static void log(Level logLevel, Object object) public static void log(Level logLevel, Object object) {
{ FMLLog.log(ModInfo.MOD_NAME, logLevel, String.valueOf(object));
FMLLog.log(ModInfo.MOD_NAME, logLevel, String.valueOf(object)); }
}
public static void all(Object object) public static void all(Object object) {
{ log(Level.ALL, object);
log(Level.ALL, object); }
}
public static void debug(Object object) public static void debug(Object object) {
{ log(Level.DEBUG, object);
log(Level.DEBUG, object); }
}
public static void error(Object object) public static void error(Object object) {
{ log(Level.ERROR, object);
log(Level.ERROR, object); }
}
public static void fatal(Object object) public static void fatal(Object object) {
{ log(Level.FATAL, object);
log(Level.FATAL, object); }
}
public static void info(Object object) public static void info(Object object) {
{ log(Level.INFO, object);
log(Level.INFO, object); }
}
public static void off(Object object) public static void off(Object object) {
{ log(Level.OFF, object);
log(Level.OFF, object); }
}
public static void trace(Object object) public static void trace(Object object) {
{ log(Level.TRACE, object);
log(Level.TRACE, object); }
}
public static void warn(Object object) public static void warn(Object object) {
{ log(Level.WARN, object);
log(Level.WARN, object); }
}
} }

View file

@ -1,50 +1,41 @@
package techreborn.util; package techreborn.util;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapedRecipes;
public class RecipeRemover import java.util.List;
{
public static void removeShapedRecipes(List<ItemStack> removelist)
{
for (ItemStack stack : removelist)
removeShapedRecipe(stack);
}
public static void removeAnyRecipe(ItemStack resultItem) public class RecipeRemover {
{ public static void removeShapedRecipes(List<ItemStack> removelist) {
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); for (ItemStack stack : removelist)
for (int i = 0; i < recipes.size(); i++) removeShapedRecipe(stack);
{ }
IRecipe tmpRecipe = recipes.get(i);
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i--);
}
}
}
public static void removeShapedRecipe(ItemStack resultItem) public static void removeAnyRecipe(ItemStack resultItem) {
{ List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); for (int i = 0; i < recipes.size(); i++) {
for (int i = 0; i < recipes.size(); i++) IRecipe tmpRecipe = recipes.get(i);
{ ItemStack recipeResult = tmpRecipe.getRecipeOutput();
IRecipe tmpRecipe = recipes.get(i); if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
if (tmpRecipe instanceof ShapedRecipes) recipes.remove(i--);
{ }
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe; }
ItemStack recipeResult = recipe.getRecipeOutput(); }
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) public static void removeShapedRecipe(ItemStack resultItem) {
{ List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
recipes.remove(i++); for (int i = 0; i < recipes.size(); i++) {
} IRecipe tmpRecipe = recipes.get(i);
} if (tmpRecipe instanceof ShapedRecipes) {
} ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
} ItemStack recipeResult = recipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
recipes.remove(i++);
}
}
}
}
} }

View file

@ -9,10 +9,8 @@ import net.minecraftforge.event.ForgeEventFactory;
public class TorchHelper { public class TorchHelper {
public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
{ for (int i = 0; i < player.inventory.mainInventory.length; i++) {
for (int i = 0; i < player.inventory.mainInventory.length; i++)
{
ItemStack torchStack = player.inventory.mainInventory[i]; ItemStack torchStack = player.inventory.mainInventory[i];
if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) continue; if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) continue;
Item item = torchStack.getItem(); Item item = torchStack.getItem();
@ -20,12 +18,10 @@ public class TorchHelper {
int oldMeta = torchStack.getItemDamage(); int oldMeta = torchStack.getItemDamage();
int oldSize = torchStack.stackSize; int oldSize = torchStack.stackSize;
boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset); boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset);
if (player.capabilities.isCreativeMode) if (player.capabilities.isCreativeMode) {
{
torchStack.setItemDamage(oldMeta); torchStack.setItemDamage(oldMeta);
torchStack.stackSize = oldSize; torchStack.stackSize = oldSize;
} else if (torchStack.stackSize <= 0) } else if (torchStack.stackSize <= 0) {
{
ForgeEventFactory.onPlayerDestroyItem(player, torchStack); ForgeEventFactory.onPlayerDestroyItem(player, torchStack);
player.inventory.mainInventory[i] = null; player.inventory.mainInventory[i] = null;
} }

View file

@ -1,7 +1,6 @@
package techreborn.world; package techreborn.world;
import java.util.Random; import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.IChunkProvider;
@ -9,109 +8,92 @@ import net.minecraft.world.gen.feature.WorldGenMinable;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.util.LogHelper; import techreborn.util.LogHelper;
import cpw.mods.fml.common.IWorldGenerator;
public class TROreGen implements IWorldGenerator{ import java.util.Random;
public static ConfigTechReborn config;
WorldGenMinable oreGalena; public class TROreGen implements IWorldGenerator {
WorldGenMinable oreIridium; public static ConfigTechReborn config;
WorldGenMinable oreRuby;
WorldGenMinable oreSapphire;
WorldGenMinable oreBauxite;
WorldGenMinable orePyrite;
WorldGenMinable oreCinnabar;
WorldGenMinable oreSphalerite;
WorldGenMinable oreTungston;
WorldGenMinable oreSheldonite;
WorldGenMinable oreOlivine;
WorldGenMinable oreSodalite;
public TROreGen() WorldGenMinable oreGalena;
{ WorldGenMinable oreIridium;
//World WorldGenMinable oreRuby;
oreGalena = new WorldGenMinable(ModBlocks.ore, 0, 8, Blocks.stone); WorldGenMinable oreSapphire;
oreIridium = new WorldGenMinable(ModBlocks.ore, 1, 2, Blocks.stone); WorldGenMinable oreBauxite;
oreRuby = new WorldGenMinable(ModBlocks.ore, 2, 8, Blocks.stone); WorldGenMinable orePyrite;
oreSapphire = new WorldGenMinable(ModBlocks.ore, 3, 8, Blocks.stone); WorldGenMinable oreCinnabar;
oreBauxite = new WorldGenMinable(ModBlocks.ore, 4, 8, Blocks.stone); WorldGenMinable oreSphalerite;
//Nether WorldGenMinable oreTungston;
orePyrite = new WorldGenMinable(ModBlocks.ore, 5, 8, Blocks.netherrack); WorldGenMinable oreSheldonite;
oreCinnabar = new WorldGenMinable(ModBlocks.ore, 6, 8, Blocks.netherrack); WorldGenMinable oreOlivine;
oreSphalerite = new WorldGenMinable(ModBlocks.ore, 7, 8, Blocks.netherrack); WorldGenMinable oreSodalite;
//End
oreTungston = new WorldGenMinable(ModBlocks.ore, 8, 8, Blocks.end_stone);
oreSheldonite = new WorldGenMinable(ModBlocks.ore, 9, 8, Blocks.end_stone);
oreOlivine = new WorldGenMinable(ModBlocks.ore, 10, 8, Blocks.end_stone);
oreSodalite = new WorldGenMinable(ModBlocks.ore, 11, 8, Blocks.end_stone);
LogHelper.info("WorldGen Loaded");
}
@Override public TROreGen() {
public void generate(Random random, int xChunk, int zChunk, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) //World
{ oreGalena = new WorldGenMinable(ModBlocks.ore, 0, 8, Blocks.stone);
if(world.provider.isSurfaceWorld()) oreIridium = new WorldGenMinable(ModBlocks.ore, 1, 2, Blocks.stone);
{ oreRuby = new WorldGenMinable(ModBlocks.ore, 2, 8, Blocks.stone);
generateUndergroundOres(random, xChunk * 16, zChunk * 16, world); oreSapphire = new WorldGenMinable(ModBlocks.ore, 3, 8, Blocks.stone);
} oreBauxite = new WorldGenMinable(ModBlocks.ore, 4, 8, Blocks.stone);
else if(world.provider.isHellWorld) //Nether
{ orePyrite = new WorldGenMinable(ModBlocks.ore, 5, 8, Blocks.netherrack);
generateHellOres(random, xChunk * 16, zChunk * 16, world); oreCinnabar = new WorldGenMinable(ModBlocks.ore, 6, 8, Blocks.netherrack);
} oreSphalerite = new WorldGenMinable(ModBlocks.ore, 7, 8, Blocks.netherrack);
else //End
{ oreTungston = new WorldGenMinable(ModBlocks.ore, 8, 8, Blocks.end_stone);
generateEndOres(random, xChunk * 16, zChunk * 16, world); oreSheldonite = new WorldGenMinable(ModBlocks.ore, 9, 8, Blocks.end_stone);
} oreOlivine = new WorldGenMinable(ModBlocks.ore, 10, 8, Blocks.end_stone);
oreSodalite = new WorldGenMinable(ModBlocks.ore, 11, 8, Blocks.end_stone);
LogHelper.info("WorldGen Loaded");
}
} @Override
public void generate(Random random, int xChunk, int zChunk, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
if (world.provider.isSurfaceWorld()) {
generateUndergroundOres(random, xChunk * 16, zChunk * 16, world);
} else if (world.provider.isHellWorld) {
generateHellOres(random, xChunk * 16, zChunk * 16, world);
} else {
generateEndOres(random, xChunk * 16, zChunk * 16, world);
}
void generateUndergroundOres (Random random, int xChunk, int zChunk, World world) }
{
void generateUndergroundOres(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos; int xPos, yPos, zPos;
if (config.GalenaOreTrue) if (config.GalenaOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreGalena.generate(world, random, xPos, yPos, zPos); oreGalena.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.IridiumOreTrue) if (config.IridiumOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreIridium.generate(world, random, xPos, yPos, zPos); oreIridium.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.RubyOreTrue) if (config.RubyOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreRuby.generate(world, random, xPos, yPos, zPos); oreRuby.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.SapphireOreTrue) if (config.SapphireOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreSapphire.generate(world, random, xPos, yPos, zPos); oreSapphire.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.BauxiteOreTrue) if (config.BauxiteOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
@ -120,33 +102,26 @@ public class TROreGen implements IWorldGenerator{
} }
} }
void generateHellOres (Random random, int xChunk, int zChunk, World world) void generateHellOres(Random random, int xChunk, int zChunk, World world) {
{ int xPos, yPos, zPos;
int xPos, yPos, zPos; if (config.PyriteOreTrue) {
if (config.PyriteOreTrue) for (int i = 0; i <= 16; i++) {
{
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
orePyrite.generate(world, random, xPos, yPos, zPos); orePyrite.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.CinnabarOreTrue) if (config.CinnabarOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreCinnabar.generate(world, random, xPos, yPos, zPos); oreCinnabar.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.SphaleriteOreTrue) if (config.SphaleriteOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
@ -155,43 +130,34 @@ public class TROreGen implements IWorldGenerator{
} }
} }
void generateEndOres (Random random, int xChunk, int zChunk, World world) void generateEndOres(Random random, int xChunk, int zChunk, World world) {
{ int xPos, yPos, zPos;
int xPos, yPos, zPos; if (config.TungstonOreTrue) {
if (config.TungstonOreTrue) for (int i = 0; i <= 16; i++) {
{
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreTungston.generate(world, random, xPos, yPos, zPos); oreTungston.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.SheldoniteOreTrue) if (config.SheldoniteOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreSheldonite.generate(world, random, xPos, yPos, zPos); oreSheldonite.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.OlivineOreTrue) if (config.OlivineOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);
oreOlivine.generate(world, random, xPos, yPos, zPos); oreOlivine.generate(world, random, xPos, yPos, zPos);
} }
} }
if (config.SodaliteOreTrue) if (config.SodaliteOreTrue) {
{ for (int i = 0; i <= 16; i++) {
for (int i = 0; i <= 16; i++)
{
xPos = xChunk + random.nextInt(16); xPos = xChunk + random.nextInt(16);
yPos = 60 + random.nextInt(60 - 20); yPos = 60 + random.nextInt(60 - 20);
zPos = zChunk + random.nextInt(16); zPos = zChunk + random.nextInt(16);