diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-01-20 14:24:34 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-01-20 14:24:34 +1000 |
commit | 869c206c4fcc8001bd2e1d66f704290331813835 (patch) | |
tree | 96735ce8fe4665e2759c3374221d6f06f4527df2 /src/Java/miscutil/core | |
parent | ec2c72827f01dd4bb2174137f1ab162f9ddaab62 (diff) | |
download | GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.gz GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.bz2 GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.zip |
Initial Commit
Diffstat (limited to 'src/Java/miscutil/core')
40 files changed, 2158 insertions, 0 deletions
diff --git a/src/Java/miscutil/core/CommonProxy.java b/src/Java/miscutil/core/CommonProxy.java new file mode 100644 index 0000000000..8b0f6c8b2a --- /dev/null +++ b/src/Java/miscutil/core/CommonProxy.java @@ -0,0 +1,70 @@ +package miscutil.core; + +import miscutil.core.block.ModBlocks; +import miscutil.core.gui.ModGUI; +import miscutil.core.item.ModItems; +import miscutil.core.lib.Strings; +import miscutil.core.tileentities.ModTileEntities; +import miscutil.core.util.Utils; +import miscutil.gregtech.init.InitGregtech; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class CommonProxy { + + public void preInit(FMLPreInitializationEvent e) { + ModItems.init(); + ModBlocks.init(); + + + //Register Gregtech related items + if (Loader.isModLoaded("gregtech") == true) { + Utils.LOG_INFO("Gregtech Found - Loading Resources."); + Strings.GREGTECH = true; + Utils.LOG_INFO("Begining registration & initialization of Gregtech related content."); + // Init Gregtech + InitGregtech.run(); + + } + else { + Utils.LOG_WARNING("Gregtech not Found - Skipping Resources."); + Strings.GREGTECH = false; + } + + } + + public void init(FMLInitializationEvent e) { + + + + } + + public void postInit(FMLPostInitializationEvent e) { + + } + + public void registerNetworkStuff(){ + ModGUI.init(); + //NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new BloodSteelFurnaceGuiHandler()); + + } + + public void registerTileEntities(){ + ModTileEntities.init(); + //GameRegistry.registerTileEntity(TileEntityBloodSteelChest.class, "tileEntityBloodSteelChest"); + //GameRegistry.registerTileEntity(TileEntityBloodSteelFurnace.class, "tileEntityBloodSteelFurnace"); + //GameRegistry.registerTileEntity(TileEntityBloodSteelChest.class, Strings.MODID); + //GameRegistry.registerTileEntity(TileEntityArcaneInfuser.class, "TileEntityArcaneInfuser"); + } + + public void registerRenderThings() { + + } + + public int addArmor(String armor) { + return 0; + } + +} diff --git a/src/Java/miscutil/core/block/AdvancedBlock.java b/src/Java/miscutil/core/block/AdvancedBlock.java new file mode 100644 index 0000000000..2a81341838 --- /dev/null +++ b/src/Java/miscutil/core/block/AdvancedBlock.java @@ -0,0 +1,31 @@ +package miscutil.core.block; + +import miscutil.core.lib.Strings; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class AdvancedBlock extends Block { + + protected AdvancedBlock(String unlocalizedName, Material material, CreativeTabs x, float blockHardness, float blockResistance, float blockLightLevel, + String blockHarvestTool, int blockHarvestLevel, SoundType BlockSound) { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(Strings.MODID + ":" + unlocalizedName); + this.setCreativeTab(x); + this.setHardness(blockHardness); //block Hardness + this.setResistance(blockResistance); + this.setLightLevel(blockLightLevel); + this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); + this.setStepSound(BlockSound); + } + + @Override + public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) + { + return false; + } + +} diff --git a/src/Java/miscutil/core/block/BasicBlock.java b/src/Java/miscutil/core/block/BasicBlock.java new file mode 100644 index 0000000000..63c1044b03 --- /dev/null +++ b/src/Java/miscutil/core/block/BasicBlock.java @@ -0,0 +1,22 @@ +package miscutil.core.block; + +import miscutil.core.creativetabs.TMCreativeTabs; +import miscutil.core.lib.Strings; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +public class BasicBlock extends Block { + + protected BasicBlock(String unlocalizedName, Material material) { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(Strings.MODID + ":" + unlocalizedName); + this.setCreativeTab(TMCreativeTabs.tabBlock); + this.setHardness(2.0F); + this.setResistance(6.0F); + this.setLightLevel(0.0F); + this.setHarvestLevel("pickaxe", 2); + this.setStepSound(soundTypeMetal); + } + +} diff --git a/src/Java/miscutil/core/block/ModBlocks.java b/src/Java/miscutil/core/block/ModBlocks.java new file mode 100644 index 0000000000..7f1df843be --- /dev/null +++ b/src/Java/miscutil/core/block/ModBlocks.java @@ -0,0 +1,90 @@ +package miscutil.core.block; + +import miscutil.core.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import cpw.mods.fml.common.registry.GameRegistry; + +public final class ModBlocks { + + //Blood Steel + public static Block blockBloodSteel; + public static Block blockStaballoy; + public static Block blockToolBuilder; + //public static Block blockBloodSteelChest; + + //BloodSteelorial Furnace + //public static Block tutFurnace; + //public static Block tutFurnaceActive; + + //BloodSteelorial Chest + //public static Block tutChest; + + //Arcane Infuser + //public static Block arcaneInfuser; + //public static Block arcaneInfuserActive; + + //Block Storage + //public static Block emxBlockStorage; + + + public static void init() { + Utils.LOG_INFO("Initializing Blocks."); + //BloodSteelorial Furnace - Must Init blocks first as they're not static. + /** if (Strings.DEBUG){ + FMLLog.info("Loading Furnace.");} + tutFurnace= new BloodSteelFurnace(false).setBlockName("BloodSteelFurnace").setCreativeTab(TMCreativeTabs.tabBlock); + tutFurnaceActive= new BloodSteelFurnace(true).setBlockName("BloodSteelFurnaceActive"); + + //Arcane Infuser - Must Init blocks first as they're not static. + if (Strings.DEBUG){ + FMLLog.info("Loading Arcane Infuser.");} + arcaneInfuser = new ArcaneInfuser(false).setBlockName("ArcaneInfuser").setCreativeTab(TMCreativeTabs.tabBlock); + arcaneInfuserActive = new ArcaneInfuser(true).setBlockName("ArcaneInfuserActive"); + + //Blood Steel Chest + if (Strings.DEBUG){ + FMLLog.info("Loading Blood Steel Chest.");} + tutChest = new BloodSteelChest(0).setBlockName("BloodSteelChest").setCreativeTab(TMCreativeTabs.tabBlock); + + */ + //BlockStorage + //emxBlockStorage = new BlockStorage(); + + //Register Blocks next - TODO + registerBlocks(); + } + + public static void registerBlocks(){ + + Utils.LOG_INFO("Registering Blocks."); + + //Blood Steel Block + GameRegistry.registerBlock(blockBloodSteel = new BasicBlock("blockBloodSteel", Material.iron), "blockBloodSteel"); + + //Staballoy Block + GameRegistry.registerBlock(blockStaballoy = new BasicBlock("blockStaballoy", Material.iron), "blockStaballoy"); + + //Blood Steel Block //Name, Material, Hardness, Resistance, Light level, Tool, tool level, sound + //GameRegistry.registerBlock(blockToolBuilder = new AdvancedBlock("blockToolBuilder", Material.circuits, TMCreativeTabs.tabMachines, 1F, 5F, 0F, "pickaxe", 1, Block.soundTypeWood), "blockToolBuilder"); + + /** TODO re-enable blocks when working. + + + //Blood Steel Chest + GameRegistry.registerBlock(tutChest, tutChest.getUnlocalizedName()); + + //BloodSteelorial Furnace + GameRegistry.registerBlock(tutFurnace, tutFurnace.getUnlocalizedName()); + GameRegistry.registerBlock(tutFurnaceActive, tutFurnaceActive.getUnlocalizedName()); + + //Arcane Infuser + GameRegistry.registerBlock(arcaneInfuser, arcaneInfuser.getUnlocalizedName()); + GameRegistry.registerBlock(arcaneInfuserActive, arcaneInfuserActive.getUnlocalizedName()); + **/ + + //Block Storage + //GameRegistry.registerBlock(emxBlockStorage, emxBlockStorage.getUnlocalizedName()); + } + +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/commands/CommandMath.java b/src/Java/miscutil/core/commands/CommandMath.java new file mode 100644 index 0000000000..933684d277 --- /dev/null +++ b/src/Java/miscutil/core/commands/CommandMath.java @@ -0,0 +1,195 @@ +package miscutil.core.commands; + +import java.util.ArrayList; +import java.util.List; + +import miscutil.core.util.Utils; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + + +public class CommandMath implements ICommand +{ + private final List aliases; + + protected String fullEntityName; + protected Entity conjuredEntity; + + public CommandMath() + { + aliases = new ArrayList(); + + aliases.add("hometele"); + + aliases.add("warphome"); + + } + + @Override + public int compareTo(Object o) + { + return 0; + + } + + @Override + public String getCommandName() + { + return "bed"; + + } + + @Override + public String getCommandUsage(ICommandSender var1) + { + return "/bed [Teleports you to your bed for XP]"; + + } + + @Override + public List getCommandAliases() + { + return this.aliases; + + } + + public void processCommand(ICommandSender S, String[] argString) + { + World W = S.getEntityWorld(); + CommandUtils C = new CommandUtils(); + EntityPlayer P = C.getPlayer(S); + //System.out.println(P.getCommandSenderName()); + //System.out.println(P.getDisplayName()); + if (W.isRemote) + + { + + System.out.println("Not processing on Client side"); + + } + + else + + { + + System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName()); + + int XP_TOTAL = P.experienceTotal; + Utils.LOG_WARNING("Total Xp:" + XP_TOTAL); + ChunkCoordinates X = P.getPlayerCoordinates(); + Utils.LOG_WARNING("Player Location: "+X); + ChunkCoordinates Y = null; + Utils.LOG_WARNING("Bed Location: "+Y); + if (!P.getBedLocation(0).equals(null)){ + Y = P.getBedLocation(0); + Utils.LOG_WARNING("Bed Location: "+Y); + } + else { + Y = W.getSpawnPoint(); + Utils.LOG_WARNING("Spawn Location: "+Y); + } + if (Y == null) { + Y = W.getSpawnPoint(); + Utils.LOG_WARNING("Spawn Location: "+Y); + } + + int x1 = X.posX; + Utils.LOG_WARNING("X1: "+x1); + int x2 = Y.posX; + Utils.LOG_WARNING("X2: "+x2); + int y1 = X.posY; + Utils.LOG_WARNING("Y1: "+y1); + int y2 = Y.posY; + Utils.LOG_WARNING("Y2: "+y2); + int z1 = X.posZ; + Utils.LOG_WARNING("Z1: "+z1); + int z2 = Y.posZ; + Utils.LOG_WARNING("Z2: "+z2); + + + double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); + String xpCost = String.valueOf((int)(d*0.15)); + + Utils.LOG_WARNING("d:" + d); + Utils.LOG_WARNING("-----------------------------------------"); + Utils.LOG_WARNING("Actual math formulae"); + Utils.LOG_WARNING(String.valueOf(d)); + Utils.LOG_WARNING("-----------------------------------------"); + Utils.LOG_WARNING("Xp Cost based on answer B."); + Utils.LOG_WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost)); + Utils.LOG_WARNING("-----------------------------------------"); + Utils.LOG_WARNING("Xp Total"); + Utils.LOG_WARNING(String.valueOf(XP_TOTAL)); + Utils.LOG_WARNING("-----------------------------------------"); + + + + if ((XP_TOTAL-Float.valueOf(xpCost)) > 0){ + EntityXPOrb E = new EntityXPOrb(W, P.posX, P.posY + 1.62D - (double) P.yOffset, P.posZ, 1); + //E.moveTowards((double) Y.posX + 0.5D, (int) Y.posY + 3, (double) Y.posZ + 0.5D); + E.setVelocity((double) Y.posX + 0.5D, (int) Y.posY + 0.1, (double) Y.posZ + 0.5D); + W.spawnEntityInWorld(E); + W.playAuxSFXAtEntity((EntityPlayer) null, 1002, (int) P.posX, (int) P.posY, (int) P.posZ, 0); + P.setPositionAndUpdate(x2, y2+1, z2); + + //gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Movement | X:"+x2+" | Y:"+y2+" | Z:"+z2); + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Distance Traveled | "+String.valueOf((int)(d)) + " Blocks & " + xpCost + "xp"); + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You suddenly feel at home."); + P.experienceTotal = (int) (XP_TOTAL-Float.valueOf(xpCost)); + if (!xpCost.equals("0") && Float.valueOf(xpCost) > 0){ + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of "+xpCost+" xp."); + } + else if (xpCost.equals("0")){ + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of very little xp."); + } + else { + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Something went wrong with the math, have this one on the house. :)"); + } + } + + else { + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You don't feel you're able to do this yet."); + } + + } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender var1) + { + return true; + + } + + @Override + public List addTabCompletionOptions(ICommandSender var1, String[] var2) + { + // TODO Auto-generated method stub + + return null; + + } + + @Override + public boolean isUsernameIndex(String[] var1, int var2) + { + // TODO Auto-generated method stub + + return false; + + } + + public boolean playerUsesCommand(World W, EntityPlayer P, int cost) + { + + + return true; + } + +} + diff --git a/src/Java/miscutil/core/commands/CommandUtils.java b/src/Java/miscutil/core/commands/CommandUtils.java new file mode 100644 index 0000000000..f33263fa40 --- /dev/null +++ b/src/Java/miscutil/core/commands/CommandUtils.java @@ -0,0 +1,20 @@ +package miscutil.core.commands; + +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandUtils { + + public EntityPlayer getPlayer(ICommandSender icommandsender){ + EntityPlayer player; + + if(icommandsender instanceof EntityPlayer){ + player = (EntityPlayer)icommandsender; + return player; + } + else { + return null; + } + } + +} diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java new file mode 100644 index 0000000000..2db845e04c --- /dev/null +++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabBlock.java @@ -0,0 +1,18 @@ +package miscutil.core.creativetabs; + +import miscutil.core.block.ModBlocks; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabBlock extends CreativeTabs { + + public MiscUtilCreativeTabBlock(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return Item.getItemFromBlock(ModBlocks.blockBloodSteel); + } + +} diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java new file mode 100644 index 0000000000..620648d6c0 --- /dev/null +++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMachines.java @@ -0,0 +1,18 @@ +package miscutil.core.creativetabs; + +import miscutil.core.block.ModBlocks; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabMachines extends CreativeTabs { + + public MiscUtilCreativeTabMachines(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return Item.getItemFromBlock(ModBlocks.blockToolBuilder); + } + +} diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java new file mode 100644 index 0000000000..2893146f93 --- /dev/null +++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabMisc.java @@ -0,0 +1,18 @@ +package miscutil.core.creativetabs; + +import miscutil.core.item.ModItems; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabMisc extends CreativeTabs { + + public MiscUtilCreativeTabMisc(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return ModItems.itemIngotBloodSteel; + } + +} diff --git a/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java new file mode 100644 index 0000000000..aa7cf227aa --- /dev/null +++ b/src/Java/miscutil/core/creativetabs/MiscUtilCreativeTabTools.java @@ -0,0 +1,18 @@ +package miscutil.core.creativetabs; + +import miscutil.core.item.ModItems; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabTools extends CreativeTabs { + + public MiscUtilCreativeTabTools(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return ModItems.itemStaballoyPickaxe; + } + +} diff --git a/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java b/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java new file mode 100644 index 0000000000..05d170d6e1 --- /dev/null +++ b/src/Java/miscutil/core/creativetabs/TMCreativeTabs.java @@ -0,0 +1,20 @@ +package miscutil.core.creativetabs; + +import net.minecraft.creativetab.CreativeTabs; + +public class TMCreativeTabs { + + public static CreativeTabs tabBlock; + public static CreativeTabs tabMisc; + public static CreativeTabs tabCombat; + public static CreativeTabs tabTools; + public static CreativeTabs tabMachines; + + public static void initialiseTabs(){ + tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab"); + tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab"); + //tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); + //tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab"); + tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); + } +} diff --git a/src/Java/miscutil/core/gui/GUI_Bat_Buf.java b/src/Java/miscutil/core/gui/GUI_Bat_Buf.java new file mode 100644 index 0000000000..efe42c7257 --- /dev/null +++ b/src/Java/miscutil/core/gui/GUI_Bat_Buf.java @@ -0,0 +1,247 @@ +package miscutil.core.gui; + +import miscutil.core.lib.Strings; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + + +public class GUI_Bat_Buf extends GuiScreen +{ + private final int bookImageHeight = 192; + private final int bookImageWidth = 192; + private int currPage = 0; + private static final int bookTotalPages = 4; + private static ResourceLocation[] bookPageTextures = + + new ResourceLocation[bookTotalPages]; + private static String[] stringPageText = new String[bookTotalPages]; + private GuiButton buttonDone; + private NextPageButton buttonNextPage; + private NextPageButton buttonPreviousPage; + + public GUI_Bat_Buf() + { + + bookPageTextures[0] = new ResourceLocation( + + Strings.MODID+":textures/gui/book_cover.png"); + + bookPageTextures[1] = new ResourceLocation( + + Strings.MODID+":textures/gui/book.png"); + + bookPageTextures[2] = new ResourceLocation( + + Strings.MODID+":textures/gui/book.png"); + + stringPageText[0] = ""; + + stringPageText[1] = "The Mysterious Stranger admired your family cow and asked if it was for sale.\n\nWhen you nodded, he offered to trade some Magic Beans, that (if planted in tilled dirt) would lead to more wealth than you could imagine."; + + stringPageText[2]="So you handed him your cow, and grabbed the Magic Beans.\n\nPleased with yourself, you hurried away, looking for tilled dirt in which to plant the Magic Beans.\n\nYou couldn't wait to see how proud your mother would be for"; + stringPageText[3]="being so shrewd! Untold wealth in return for an old, milkless cow; what a good deal you made!\n\nSo off you went, looking for a place to plant the Magic Beans with room to grow..."; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + @Override + public void initGui() + { + // DEBUG + System.out.println("GuiMysteriousStranger initGUI()"); + buttonList.clear(); + Keyboard.enableRepeatEvents(true); + + buttonDone = new GuiButton(0, width / 2 + 2, 4 + bookImageHeight, + + 98, 20, I18n.format("gui.done", new Object[0])); + + buttonList.add(buttonDone); + int offsetFromScreenLeft = (width - bookImageWidth) / 2; + buttonList.add(buttonNextPage = new NextPageButton(1, + + offsetFromScreenLeft + 120, 156, true)); + buttonList.add(buttonPreviousPage = new NextPageButton(2, + + offsetFromScreenLeft + 38, 156, false)); + } + + /** + * Called from the main game loop to update the screen. + */ + @Override + public void updateScreen() + { + buttonDone.visible = (currPage == bookTotalPages - 1); + buttonNextPage.visible = (currPage < bookTotalPages - 1); + buttonPreviousPage.visible = currPage > 0; + } + + /** + * Draws the screen and all the components in it. + */ + @Override + public void drawScreen(int parWidth, int parHeight, float p_73863_3_) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if (currPage == 0) + { + mc.getTextureManager().bindTexture(bookPageTextures[0]); + } + else + { + mc.getTextureManager().bindTexture(bookPageTextures[1]); + } + int offsetFromScreenLeft = (width - bookImageWidth ) / 2; + drawTexturedModalRect(offsetFromScreenLeft, 2, 0, 0, bookImageWidth, + + bookImageHeight); + int widthOfString; + String stringPageIndicator = I18n.format("book.pageIndicator", + + new Object[] {Integer.valueOf(currPage + 1), bookTotalPages}); + + widthOfString = fontRendererObj.getStringWidth(stringPageIndicator); + fontRendererObj.drawString(stringPageIndicator, + + offsetFromScreenLeft - widthOfString + bookImageWidth - 44, + + 18, 0); + + fontRendererObj.drawSplitString(stringPageText[currPage], + + offsetFromScreenLeft + 36, 34, 116, 0); + + super.drawScreen(parWidth, parHeight, p_73863_3_); + + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. + + * Parameters are : mouseX, mouseY, lastButtonClicked & + + * timeSinceMouseClick. + */ + @Override + protected void mouseClickMove(int parMouseX, int parMouseY, + + int parLastButtonClicked, long parTimeSinceMouseClick) + + { + + } + + @Override + protected void actionPerformed(GuiButton parButton) + { + if (parButton == buttonDone) + { + // You can send a packet to server here if you need server to do + + // something + mc.displayGuiScreen((GuiScreen)null); + } + else if (parButton == buttonNextPage) + { + if (currPage < bookTotalPages - 1) + { + ++currPage; + } + } + else if (parButton == buttonPreviousPage) + { + if (currPage > 0) + { + --currPage; + } + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat + + * events + */ + @Override + public void onGuiClosed() + { + + } + + /** + * Returns true if this GUI should pause the game when it is displayed in + + * single-player + */ + @Override + public boolean doesGuiPauseGame() + { + return true; + } + + @SideOnly(Side.CLIENT) + static class NextPageButton extends GuiButton + { + private final boolean isNextButton; + + public NextPageButton(int parButtonId, int parPosX, int parPosY, + + boolean parIsNextButton) + { + super(parButtonId, parPosX, parPosY, 23, 13, ""); + isNextButton = parIsNextButton; + } + + /** + * Draws this button to the screen. + */ + @Override + public void drawButton(Minecraft mc, int parX, int parY) + { + if (visible) + { + boolean isButtonPressed = (parX >= xPosition + + && parY >= yPosition + + && parX < xPosition + width + + && parY < yPosition + height); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.getTextureManager().bindTexture(bookPageTextures[1]); + int textureX = 0; + int textureY = 192; + + if (isButtonPressed) + { + textureX += 23; + } + + if (!isNextButton) + { + textureY += 13; + } + + drawTexturedModalRect(xPosition, yPosition, + + textureX, textureY, + + 23, 13); + } + } + } +} + diff --git a/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java b/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java new file mode 100644 index 0000000000..c4bdf3666b --- /dev/null +++ b/src/Java/miscutil/core/gui/GUI_Battery_Buffer.java @@ -0,0 +1,51 @@ +package miscutil.core.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; + +public class GUI_Battery_Buffer extends GuiScreen { + + private GuiButton a; + private GuiButton b; + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + /* + @SuppressWarnings("unchecked") + public void initGui() { + this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a")); + this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b")); + }*/ + + /* @Override + protected void actionPerformed(GuiButton button) { + if (button == this.a) { + //Main.packetHandler.sendToServer(...); + this.mc.displayGuiScreen(null); + if (this.mc.currentScreen == null) + this.mc.setIngameFocus(); + } + if (button == this.b){ + //Main.packetHandler.sendToServer(...); + this.mc.displayGuiScreen(null); + if (this.mc.currentScreen == null) + this.mc.setIngameFocus(); + } + }*/ + /** + * if (worldIn.isRemote) { + playerIn.openGui(Main.instance, 0, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); + } + */ + + +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/gui/GUI_Tool_Builder.java b/src/Java/miscutil/core/gui/GUI_Tool_Builder.java new file mode 100644 index 0000000000..e6a81a7d80 --- /dev/null +++ b/src/Java/miscutil/core/gui/GUI_Tool_Builder.java @@ -0,0 +1,5 @@ +package miscutil.core.gui; + +public class GUI_Tool_Builder { + +} diff --git a/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java b/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java new file mode 100644 index 0000000000..7a8f7d3e97 --- /dev/null +++ b/src/Java/miscutil/core/gui/Gui_No_Inventory_Base.java @@ -0,0 +1,51 @@ +package miscutil.core.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; + +public class Gui_No_Inventory_Base extends GuiScreen { + + private GuiButton a; + private GuiButton b; + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + /* + @SuppressWarnings("unchecked") + public void initGui() { + this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a")); + this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b")); + }*/ + + /* @Override + protected void actionPerformed(GuiButton button) { + if (button == this.a) { + //Main.packetHandler.sendToServer(...); + this.mc.displayGuiScreen(null); + if (this.mc.currentScreen == null) + this.mc.setIngameFocus(); + } + if (button == this.b){ + //Main.packetHandler.sendToServer(...); + this.mc.displayGuiScreen(null); + if (this.mc.currentScreen == null) + this.mc.setIngameFocus(); + } + }*/ + /** + * if (worldIn.isRemote) { + playerIn.openGui(Main.instance, 0, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); + } + */ + + +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/gui/ModGUI.java b/src/Java/miscutil/core/gui/ModGUI.java new file mode 100644 index 0000000000..28987ccc1b --- /dev/null +++ b/src/Java/miscutil/core/gui/ModGUI.java @@ -0,0 +1,15 @@ +package miscutil.core.gui; + +import miscutil.core.util.Utils; + +public class ModGUI { + + + public static void init(){ + + Utils.LOG_INFO("Registering GUIs."); + + //Register GuiHandler + //NetworkRegistry.INSTANCE.registerGuiHandler(MiscUtils.instance, new GuiHandler()); + } +} diff --git a/src/Java/miscutil/core/handler/CraftingManager.java b/src/Java/miscutil/core/handler/CraftingManager.java new file mode 100644 index 0000000000..42b602440d --- /dev/null +++ b/src/Java/miscutil/core/handler/CraftingManager.java @@ -0,0 +1,21 @@ +package miscutil.core.handler; + +public class CraftingManager { + + public static void mainRegistry() { + addCraftingRecipies(); + addSmeltingRecipies(); + } + + public static void addCraftingRecipies() { + // Shaped Recipie + //GameRegistry.addRecipe(new ItemStack(ModItems.tutPickaxe, 1), new Object[] { "###", " S ", " S ", '#', ModItems.tutItem, 'S', Items.stick }); + + //Shapeless Recipie + //GameRegistry.addShapelessRecipe(new ItemStack(ModItems.tutItem, 10), new Object[]{Blocks.dirt , Blocks.cobblestone}); + } + + public static void addSmeltingRecipies() { + //GameRegistry.addSmelting(ModItems.tutItem, new ItemStack(Blocks.diamond_block, 5), 20.0F); + } +} diff --git a/src/Java/miscutil/core/handler/GuiHandler.java b/src/Java/miscutil/core/handler/GuiHandler.java new file mode 100644 index 0000000000..9412ed8983 --- /dev/null +++ b/src/Java/miscutil/core/handler/GuiHandler.java @@ -0,0 +1,39 @@ +package miscutil.core.handler; + +import miscutil.core.gui.GUI_Bat_Buf; +import miscutil.core.gui.GUI_Battery_Buffer; +import miscutil.core.util.Utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import cpw.mods.fml.common.network.IGuiHandler; + +public class GuiHandler implements IGuiHandler { + + private static final int GUI1 = 0; //Nothing Yet + private static final int GUI2 = 1; //Energy Buffer + + + + @Override //ContainerModTileEntity + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == GUI1) + return new GUI_Battery_Buffer(); + + return null; + } + + @Override //GuiModTileEntity + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + Utils.LOG_WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+"."); + if (ID == GUI1){ + Utils.LOG_WARNING("Opening Gui with Id: "+ID); + return new GUI_Battery_Buffer(); + } + else if (ID == GUI2){ + Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Energy Buffer"); + return new GUI_Bat_Buf(); + } + return null; + } + +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/handler/ResourceHandler.java b/src/Java/miscutil/core/handler/ResourceHandler.java new file mode 100644 index 0000000000..e8f81f4d02 --- /dev/null +++ b/src/Java/miscutil/core/handler/ResourceHandler.java @@ -0,0 +1,83 @@ +package miscutil.core.handler; + +import org.apache.commons.lang3.Validate; + +public class ResourceHandler +{ + private final String resourceDomain; + private final String resourcePath; + private static final String __OBFID = "CL_00001082"; + + public ResourceHandler(String p_i1292_1_, String p_i1292_2_) + { + Validate.notNull(p_i1292_2_); + + if (p_i1292_1_ != null && p_i1292_1_.length() != 0) + { + this.resourceDomain = p_i1292_1_; + } + else + { + this.resourceDomain = "minecraft"; + } + + this.resourcePath = p_i1292_2_; + } + + public ResourceHandler(String p_i1293_1_) + { + String s1 = "miscUtils"; + String s2 = p_i1293_1_; + int i = p_i1293_1_.indexOf(58); + + if (i >= 0) + { + s2 = p_i1293_1_.substring(i + 1, p_i1293_1_.length()); + + if (i > 1) + { + s1 = p_i1293_1_.substring(0, i); + } + } + + this.resourceDomain = s1.toLowerCase(); + this.resourcePath = s2; + } + + public String getResourcePath() + { + return this.resourcePath; + } + + public String getResourceDomain() + { + return this.resourceDomain; + } + + public String toString() + { + return this.resourceDomain + ":" + this.resourcePath; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ResourceHandler)) + { + return false; + } + else + { + ResourceHandler resourcelocation = (ResourceHandler)p_equals_1_; + return this.resourceDomain.equals(resourcelocation.resourceDomain) && this.resourcePath.equals(resourcelocation.resourcePath); + } + } + + public int hashCode() + { + return 31 * this.resourceDomain.hashCode() + this.resourcePath.hashCode(); + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/item/BaseMetaItemTool.java b/src/Java/miscutil/core/item/BaseMetaItemTool.java new file mode 100644 index 0000000000..c0b552f721 --- /dev/null +++ b/src/Java/miscutil/core/item/BaseMetaItemTool.java @@ -0,0 +1,5 @@ +package miscutil.core.item; + +public class BaseMetaItemTool { + +} diff --git a/src/Java/miscutil/core/item/EntityTeleportFX.java b/src/Java/miscutil/core/item/EntityTeleportFX.java new file mode 100644 index 0000000000..d67ee77968 --- /dev/null +++ b/src/Java/miscutil/core/item/EntityTeleportFX.java @@ -0,0 +1,236 @@ +package miscutil.core.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class EntityTeleportFX extends Entity +{ + /** 'x' location the eye should float towards. */ + private double targetX; + /** 'y' location the eye should float towards. */ + private double targetY; + /** 'z' location the eye should float towards. */ + private double targetZ; + private int despawnTimer; + private boolean shatterOrDrop; + private static final String __OBFID = "CL_00001716"; + + public EntityTeleportFX(World p_i1757_1_) + { + super(p_i1757_1_); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double p_70112_1_) + { + double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; + d1 *= 64.0D; + return p_70112_1_ < d1 * d1; + } + + public EntityTeleportFX(World p_i1758_1_, double p_i1758_2_, double p_i1758_4_, double p_i1758_6_) + { + super(p_i1758_1_); + this.despawnTimer = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_); + this.yOffset = 0.0F; + } + + /** + * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: + * strongholdX, strongholdY, strongholdZ + */ + public void moveTowards(double p_70220_1_, int p_70220_3_, double p_70220_4_) + { + double d2 = p_70220_1_ - this.posX; + double d3 = p_70220_4_ - this.posZ; + float f = MathHelper.sqrt_double(d2 * d2 + d3 * d3); + + if (f > 12.0F) + { + this.targetX = this.posX + d2 / (double)f * 12.0D; + this.targetZ = this.posZ + d3 / (double)f * 12.0D; + this.targetY = this.posY + 8.0D; + } + else + { + this.targetX = p_70220_1_; + this.targetY = (double)p_70220_3_; + this.targetZ = p_70220_4_; + } + + this.despawnTimer = 0; + this.shatterOrDrop = this.rand.nextInt(5) > 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + @SideOnly(Side.CLIENT) + public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_) + { + this.motionX = p_70016_1_; + this.motionY = p_70016_3_; + this.motionZ = p_70016_5_; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, (double)f) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + + if (!this.worldObj.isRemote) + { + double d0 = this.targetX - this.posX; + double d1 = this.targetZ - this.posZ; + float f1 = (float)Math.sqrt(d0 * d0 + d1 * d1); + float f2 = (float)Math.atan2(d1, d0); + double d2 = (double)f + (double)(f1 - f) * 0.0025D; + + if (f1 < 1.0F) + { + d2 *= 0.8D; + this.motionY *= 0.8D; + } + + this.motionX = Math.cos((double)f2) * d2; + this.motionZ = Math.sin((double)f2) * d2; + + if (this.posY < this.targetY) + { + this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; + } + else + { + this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; + } + } + + float f3 = 0.25F; + + if (this.isInWater()) + { + for (int i = 0; i < 4; ++i) + { + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); + } + } + else + { + this.worldObj.spawnParticle("portal", this.posX - this.motionX * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.posY - this.motionY * (double)f3 - 0.5D, this.posZ - this.motionZ * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.motionX, this.motionY, this.motionZ); + } + + if (!this.worldObj.isRemote) + { + this.setPosition(this.posX, this.posY, this.posZ); + ++this.despawnTimer; + + if (this.despawnTimer > 80 && !this.worldObj.isRemote) + { + this.setDead(); + + if (this.shatterOrDrop) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); + } + else + { + this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound p_70014_1_) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound p_70037_1_) {} + + @SideOnly(Side.CLIENT) + public float getShadowSize() + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float p_70013_1_) + { + return 1.0F; + } + + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(float p_70070_1_) + { + return 15728880; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/item/ModItems.java b/src/Java/miscutil/core/item/ModItems.java new file mode 100644 index 0000000000..7b84f3c589 --- /dev/null +++ b/src/Java/miscutil/core/item/ModItems.java @@ -0,0 +1,311 @@ +package miscutil.core.item; + +import miscutil.core.creativetabs.TMCreativeTabs; +import miscutil.core.item.effects.RarityUncommon; +import miscutil.core.item.tool.staballoy.StaballoyPickaxe; +import miscutil.core.lib.Strings; +import miscutil.core.util.Utils; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraftforge.common.util.EnumHelper; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; + +public final class ModItems { +/* A name for the material. This should be the same as the name of the variable we use to store the material (in this case "TUTORIAL"). + A harvest level for pickaxes. This is a value between 0 and 3 and defines which blocks can be mined with this tool. Its also possible to create blocks which need a higher harvest level than 3, but then you are not able to mine them with vanilla tools. + Common values for the harvest level are: + Wood/Gold Tool: 0 + Stone Tool: 1 + Iron Tool: 2 + Diamond Tool: 3 + The durability of the tool or sword. This value defines how often you can use a tool until it breaks. The tools always last one use longer than the entered value. + Common values for the durability are: + Wood Tool: 59 + Stone Tool: 131 + Iron Tool: 250 + Diamond Tool: 1561 + Gold Tool: 32 + The mining speed of the tool. This value defines how much faster you are with this tool than with your hand. + Common values for the mining speed are: + Wood Tool: 2.0F + Stone Tool: 4.0F + Iron Tool: 6.0F + Diamond Tool: 8.0F + Gold Tool: 12.0F + The damage versus Entites. This value is used to calculate the damage an entity takes if you hit it with this tool/sword. This value defines the basic damage to which different values are added, depending on the type of tool. A sword always causes 4 more damage than written in the ToolMaterial. So, if you want to create a sword which adds 10 damage to your normal damage, the value in the ToolMaterial needs to be 6.0F. Of course the values can be below zero. + Common values for the damage versus Entities are: + Wood Tool: 0.0F (Sword adds 4.0 damage) + Stone Tool: 1.0F (Sword adds 5.0 damage) + Iron Tool: 2.0F (Sword adds 6.0 damage) + Diamond Tool: 3.0F (Sword adds 7.0 damage) + Gold Tool: 0.0F (Sword adds 4.0 damage) + The enchantability of this tool. This value is quite complex to understand and I have to admit that I don't quite know how it is calculated. Basically you can say that a higher enchantability leads to better enchantements with the same amount of XP. + Common values for the enchantability are: + Wood Tool: 15 + Stone Tool: 5 + Iron Tool: 14 + Diamond Tool: 10 + Gold Tool: 22*/ + + //Tool Materials + //public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", harvestLevel, durability, miningSpeed, damageVsEntities, enchantability); + public static ToolMaterial tutMaterial = EnumHelper.addToolMaterial("BloodSteel Tool Material", 3, 200, 15.0F, 4.0F, 10); + public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18); + + //Armour Materials + public static ArmorMaterial tutArmorMaterial = EnumHelper.addArmorMaterial("BloodSteel Armor Material", 33, new int[]{2, 5, 4, 2}, 10); + + //Base Classes For Items + public static Item tutPickaxe; + public static Item tutAxe; + public static Item tutSword; + public static Item tutHoe; + public static Item tutSpade; + + //Base Classes For Armour + public static Item tutHelmet; + public static Item tutPlate; + public static Item tutPants; + public static Item tutBoots; + + //EnderIO + public static Item itemPlateSoularium; + public static Item itemPlateRedstoneAlloy; + public static Item itemPlateElectricalSteel; + public static Item itemPlatePulsatingIron; + public static Item itemPlateEnergeticAlloy; + public static Item itemPlateVibrantAlloy; + public static Item itemPlateConductiveIron; + public static Item itemPlateDarkSteel; + + //Big Reactors + public static Item itemPlateBlutonium; + public static Item itemPlateCyanite; + public static Item itemPlateLudicrite; + + //Thaumcraft + public static Item itemPlateVoidMetal; + + //ExtraUtils + public static Item itemPlateBedrockium; + + //Pneumaticraft + public static Item itemPlateCompressedIron; + + //SimplyJetpacks + public static Item itemPlateEnrichedSoularium; + + //rfTools + public static Item itemPlateDimensionShard; + + //Misc Items + public static Item itemIngotBloodSteel; + public static Item itemPlateBloodSteel; + + //Staballoy + public static Item itemStaballoyPickaxe; + public static Item itemPlateStaballoy; + public static Item itemIngotStaballoy; + + + + + //@SuppressWarnings("unused") + @SuppressWarnings("unused") + public static final void init(){ + + /* + * + * Strings.DEBUG Parameters area + * + */ + //Logs + if (!Strings.DEBUG){ + Utils.LOG_INFO("Development mode not enabled."); + } + else if (Strings.DEBUG){ + Utils.LOG_INFO("Development mode enabled."); + } + else { + Utils.LOG_WARNING("Development mode not set."); + } + /* + * End Strings.DEBUG + */ + + + + /* //Blood Steel Equipment + + //Item Init + tutPickaxe = new BloodSteelPickaxe(tutMaterial).setUnlocalizedName("BloodSteelPickaxe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelPickaxe"); + tutAxe = new BloodSteelAxe(tutMaterial).setUnlocalizedName("BloodSteelAxe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelAxe"); + tutSword = new BloodSteelSword(tutMaterial).setUnlocalizedName("BloodSteelSword").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelSword"); + tutHoe = new BloodSteelHoe(tutMaterial).setUnlocalizedName("BloodSteelHoe").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelHoe"); + tutSpade = new BloodSteelSpade(tutMaterial).setUnlocalizedName("BloodSteelSpade").setCreativeTab(TMCreativeTabs.tabTools).setTextureName(Strings.MODID + ":BloodSteelSpade"); + tutHelmet = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 0).setUnlocalizedName("BloodSteelHelmet").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelHelmet"); + tutPlate = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 1).setUnlocalizedName("BloodSteelPlate").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelPlate"); + tutPants = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 2).setUnlocalizedName("BloodSteelPants").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelPants"); + tutBoots = new BloodSteelArmor(tutArmorMaterial, MiscUtils.proxy.addArmor("BloodSteelArmor"), 3).setUnlocalizedName("BloodSteelBoots").setCreativeTab(TMCreativeTabs.tabCombat).setTextureName(Strings.MODID + ":BloodSteelBoots"); + + //Registry + GameRegistry.registerItem(tutPickaxe, tutPickaxe.getUnlocalizedName()); + GameRegistry.registerItem(tutAxe, tutAxe.getUnlocalizedName()); + GameRegistry.registerItem(tutSword, tutSword.getUnlocalizedName()); + GameRegistry.registerItem(tutHoe, tutHoe.getUnlocalizedName()); + GameRegistry.registerItem(tutSpade, tutSpade.getUnlocalizedName()); + GameRegistry.registerItem(tutHelmet, tutHelmet.getUnlocalizedName()); + GameRegistry.registerItem(tutPlate, tutPlate.getUnlocalizedName()); + GameRegistry.registerItem(tutPants, tutPants.getUnlocalizedName()); + GameRegistry.registerItem(tutBoots, tutBoots.getUnlocalizedName()); */ + + + + + + + //EnderIO Resources + if (Loader.isModLoaded("EnderIO") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("EnderIO Found - Loading Resources."); + //Item Init + itemPlateSoularium = new Item().setUnlocalizedName("itemPlateSoularium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateSoularium");; + itemPlateRedstoneAlloy = new Item().setUnlocalizedName("itemPlateRedstoneAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateRedstoneAlloy");; + itemPlateElectricalSteel = new Item().setUnlocalizedName("itemPlateElectricalSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateElectricalSteel");; + itemPlatePulsatingIron = new Item().setUnlocalizedName("itemPlatePulsatingIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlatePulsatingIron");; + itemPlateEnergeticAlloy = new Item().setUnlocalizedName("itemPlateEnergeticAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateEnergeticAlloy");; + itemPlateVibrantAlloy = new Item().setUnlocalizedName("itemPlateVibrantAlloy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateVibrantAlloy");; + itemPlateConductiveIron = new Item().setUnlocalizedName("itemPlateConductiveIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateConductiveIron");; + itemPlateDarkSteel = new Item().setUnlocalizedName("itemPlateDarkSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateDarkSteel");; + + + //Registry + GameRegistry.registerItem(itemPlateSoularium, "itemPlateSoularium"); + GameRegistry.registerItem(itemPlateRedstoneAlloy, "itemPlateRedstoneAlloy"); + GameRegistry.registerItem(itemPlateElectricalSteel, "itemPlateElectricalSteel"); + GameRegistry.registerItem(itemPlatePulsatingIron, "itemPlatePulsatingIron"); + GameRegistry.registerItem(itemPlateEnergeticAlloy, "itemPlateEnergeticAlloy"); + GameRegistry.registerItem(itemPlateVibrantAlloy, "itemPlateVibrantAlloy"); + GameRegistry.registerItem(itemPlateConductiveIron, "itemPlateConductiveIron"); + GameRegistry.registerItem(itemPlateDarkSteel, "itemPlateDarkSteel"); + } + else { + Utils.LOG_WARNING("EnderIO not Found - Skipping Resources."); + } + + //Big Reactors + if (Loader.isModLoaded("BigReactors") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("BigReactors Found - Loading Resources."); + //Item Init + itemPlateBlutonium = new Item().setUnlocalizedName("itemPlateBlutonium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateBlutonium");; + itemPlateCyanite = new Item().setUnlocalizedName("itemPlateCyanite").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateCyanite");; + itemPlateLudicrite = new Item().setUnlocalizedName("itemPlateLudicrite").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateLudicrite");; + + //Registry + GameRegistry.registerItem(itemPlateBlutonium, "itemPlateBlutonium"); + GameRegistry.registerItem(itemPlateCyanite, "itemPlateCyanite"); + GameRegistry.registerItem(itemPlateLudicrite, "itemPlateLudicrite"); + + } + else { + Utils.LOG_WARNING("BigReactors not Found - Skipping Resources."); + } + + //Thaumcraft + if (Loader.isModLoaded("Thaumcraft") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("Thaumcraft Found - Loading Resources."); + //Item Init + itemPlateVoidMetal = new Item().setUnlocalizedName("itemPlateVoidMetal").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateVoidMetal");; + + //Registry + GameRegistry.registerItem(itemPlateVoidMetal, "itemPlateVoidMetal"); + + } + else { + Utils.LOG_WARNING("Thaumcraft not Found - Skipping Resources."); + } + + //ExtraUtils + if (Loader.isModLoaded("ExtraUtilities") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("ExtraUtilities Found - Loading Resources."); + //Item Init + itemPlateBedrockium = new Item().setUnlocalizedName("itemPlateBedrockium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateBedrockium");; + + //Registry + GameRegistry.registerItem(itemPlateBedrockium, "itemPlateBedrockium"); + + } + else { + Utils.LOG_WARNING("ExtraUtilities not Found - Skipping Resources."); + } + + //Pneumaticraft + if (Loader.isModLoaded("PneumaticCraft") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("PneumaticCraft Found - Loading Resources."); + //Item Init + itemPlateCompressedIron = new Item().setUnlocalizedName("itemPlateCompressedIron").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateCompressedIron");; + + //Registry + GameRegistry.registerItem(itemPlateCompressedIron, "itemPlateCompressedIron"); + + } + else { + Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources."); + } + + //Simply Jetpacks + if (Loader.isModLoaded("simplyjetpacks") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("SimplyJetpacks Found - Loading Resources."); + //Item Init + itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateSoularium");; + + //Registry + GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium"); + + } + else { + Utils.LOG_WARNING("SimplyJetpacks not Found - Skipping Resources."); + } + + + //rfTools + if (Loader.isModLoaded("rftools") == true || Strings.LOAD_ALL_CONTENT){ + Utils.LOG_INFO("rfTools Found - Loading Resources."); + //Item Init + itemPlateDimensionShard = new Item().setUnlocalizedName("itemPlateDimensionShard").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateDimensionShard");; + + //Registry + GameRegistry.registerItem(itemPlateDimensionShard, "itemPlateDimensionShard"); + + } + else { + Utils.LOG_WARNING("rfTools not Found - Skipping Resources."); + } + + /* + * Misc Items + */ + + //Staballoy Equipment + Utils.LOG_INFO("Interest in Stablloy Found - Loading Resources."); + //Pickaxe + itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(TMCreativeTabs.tabTools); + GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName()); + //Staballoy Ingot/Plate + itemIngotStaballoy = new Item().setUnlocalizedName("itemIngotStaballoy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemIngotStaballoy");; + GameRegistry.registerItem(itemIngotStaballoy, "itemIngotStaballoy"); + itemPlateStaballoy = new Item().setUnlocalizedName("itemPlateStaballoy").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemPlateStaballoy");; + GameRegistry.registerItem(itemPlateStaballoy, "itemPlateStaballoy"); + //GregTech_API.sRecipeAdder.addAlloySmelterRecipe(, aInput2, aOutput1, aDuration, aEUt) + + + + //Blood Steel Ingot + itemIngotBloodSteel = new Item().setUnlocalizedName("itemIngotBloodSteel").setCreativeTab(TMCreativeTabs.tabMisc).setTextureName(Strings.MODID + ":itemIngotBloodSteel");; + GameRegistry.registerItem(itemIngotBloodSteel, "itemIngotBloodSteel"); + + + } + +} diff --git a/src/Java/miscutil/core/item/effects/RarityEffect.java b/src/Java/miscutil/core/item/effects/RarityEffect.java new file mode 100644 index 0000000000..41ba2d6baf --- /dev/null +++ b/src/Java/miscutil/core/item/effects/RarityEffect.java @@ -0,0 +1,41 @@ +package miscutil.core.item.effects; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/* + * +This determines the name colour. EnumRarity can be: +EnumRarity.common - the standard white colour. +EnumRarity.uncommon - a yellow colour. +EnumRarity.rare - a light blue colour. This is used for enchanted items. +EnumRarity.epic - the purple colour used on the Golden Apple. +@SideOnly is an FML annotation. It marks the method below it for existing only on one side. Possible values are: +Side.CLIENT is probably the most common one. This marks the method as existing only on the client side. +Side.SERVER marks the method as existing only on the server side. + * + */ + +public class RarityEffect extends Item { + + public RarityEffect(int par1){ + super(); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.common; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + +} diff --git a/src/Java/miscutil/core/item/effects/RarityEpic.java b/src/Java/miscutil/core/item/effects/RarityEpic.java new file mode 100644 index 0000000000..dfcaaa9007 --- /dev/null +++ b/src/Java/miscutil/core/item/effects/RarityEpic.java @@ -0,0 +1,28 @@ +package miscutil.core.item.effects; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class RarityEpic extends Item { + + public RarityEpic(int par1){ + super(); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.epic; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + +} diff --git a/src/Java/miscutil/core/item/effects/RarityRare.java b/src/Java/miscutil/core/item/effects/RarityRare.java new file mode 100644 index 0000000000..6afc9b6733 --- /dev/null +++ b/src/Java/miscutil/core/item/effects/RarityRare.java @@ -0,0 +1,28 @@ +package miscutil.core.item.effects; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class RarityRare extends Item { + + public RarityRare(int par1){ + super(); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.rare; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + +} diff --git a/src/Java/miscutil/core/item/effects/RarityUncommon.java b/src/Java/miscutil/core/item/effects/RarityUncommon.java new file mode 100644 index 0000000000..4347dc70f5 --- /dev/null +++ b/src/Java/miscutil/core/item/effects/RarityUncommon.java @@ -0,0 +1,22 @@ +package miscutil.core.item.effects; + +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class RarityUncommon extends Item { + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.uncommon; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + +} diff --git a/src/Java/miscutil/core/item/materials/MaterialHandler.java b/src/Java/miscutil/core/item/materials/MaterialHandler.java new file mode 100644 index 0000000000..3c57d21f90 --- /dev/null +++ b/src/Java/miscutil/core/item/materials/MaterialHandler.java @@ -0,0 +1,9 @@ +package miscutil.core.item.materials; + +public class MaterialHandler { + + private String Staballoy; + + + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java new file mode 100644 index 0000000000..11bc400587 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelArmor.java @@ -0,0 +1,56 @@ +package miscutil.core.item.tool.bloodsteel; + +import miscutil.core.item.ModItems; +import miscutil.core.lib.Strings; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class BloodSteelArmor extends ItemArmor { + + public BloodSteelArmor(ArmorMaterial p_i45325_1_, int p_i45325_2_, int p_i45325_3_) { + super(p_i45325_1_, p_i45325_2_, p_i45325_3_); + // TODO Auto-generated constructor stub + } + + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (stack.getItem() == ModItems.tutHelmet || stack.getItem() == ModItems.tutPlate || stack.getItem() == ModItems.tutBoots) { + return Strings.MODID + ":textures/armor/BloodSteelArmor1.png"; + } else if (stack.getItem() == ModItems.tutPants) { + return Strings.MODID + ":textures/armor/BloodSteelArmor2.png"; + } else { + return null; + } + } + + /** + * Called to tick armor in the armor slot. Override to do something + * + * @param world + * @param player + * @param itemStack + */ + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){ + ItemStack helmet = player.getCurrentArmor(3); + ItemStack plate = player.getCurrentArmor(2); + ItemStack pants = player.getCurrentArmor(1); + if(helmet.getItem() == ModItems.tutHelmet && plate.getItem() == ModItems.tutPlate && pants.getItem() == ModItems.tutPants){ + //player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 100, 1)); + player.capabilities.allowFlying = true; + } + } + + if(player.getCurrentArmor(0) != null){ + ItemStack boots = player.getCurrentArmor(0); + if(boots.getItem() == ModItems.tutBoots){ + player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 100, 1)); + } + } + } + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java new file mode 100644 index 0000000000..6353aa3631 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelAxe.java @@ -0,0 +1,12 @@ +package miscutil.core.item.tool.bloodsteel; + +import net.minecraft.item.ItemAxe; + +public class BloodSteelAxe extends ItemAxe{ + + protected BloodSteelAxe(ToolMaterial p_i45327_1_) { + super(p_i45327_1_); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java new file mode 100644 index 0000000000..0115c08d00 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelHoe.java @@ -0,0 +1,12 @@ +package miscutil.core.item.tool.bloodsteel; + +import net.minecraft.item.ItemHoe; + +public class BloodSteelHoe extends ItemHoe{ + + public BloodSteelHoe(ToolMaterial p_i45343_1_) { + super(p_i45343_1_); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java new file mode 100644 index 0000000000..d2c5d467b5 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelPickaxe.java @@ -0,0 +1,12 @@ +package miscutil.core.item.tool.bloodsteel; + +import net.minecraft.item.ItemPickaxe; + +public class BloodSteelPickaxe extends ItemPickaxe{ + + protected BloodSteelPickaxe(ToolMaterial p_i45347_1_) { + super(p_i45347_1_); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java new file mode 100644 index 0000000000..15318d7382 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSpade.java @@ -0,0 +1,12 @@ +package miscutil.core.item.tool.bloodsteel; + +import net.minecraft.item.ItemSpade; + +public class BloodSteelSpade extends ItemSpade{ + + public BloodSteelSpade(ToolMaterial p_i45353_1_) { + super(p_i45353_1_); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java new file mode 100644 index 0000000000..96d11331a0 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/bloodsteel/BloodSteelSword.java @@ -0,0 +1,12 @@ +package miscutil.core.item.tool.bloodsteel; + +import net.minecraft.item.ItemSword; + +public class BloodSteelSword extends ItemSword{ + + public BloodSteelSword(ToolMaterial p_i45356_1_) { + super(p_i45356_1_); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java new file mode 100644 index 0000000000..2453f9f6e2 --- /dev/null +++ b/src/Java/miscutil/core/item/tool/staballoy/StaballoyPickaxe.java @@ -0,0 +1,14 @@ +package miscutil.core.item.tool.staballoy; + +import miscutil.core.lib.Strings; +import net.minecraft.item.ItemPickaxe; + +public class StaballoyPickaxe extends ItemPickaxe{ + + public StaballoyPickaxe(String unlocalizedName, ToolMaterial material) { + super(material); + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(Strings.MODID + ":" + unlocalizedName); + } + +} diff --git a/src/Java/miscutil/core/lib/Strings.java b/src/Java/miscutil/core/lib/Strings.java new file mode 100644 index 0000000000..1213dc56ef --- /dev/null +++ b/src/Java/miscutil/core/lib/Strings.java @@ -0,0 +1,19 @@ +package miscutil.core.lib; + +public class Strings { + + public static final String name = "Misc. Utils"; + public static final String MODID = "miscutils"; + public static final String VERSION = "0.7.8gtu"; + public static final boolean DEBUG = true; + public static boolean GREGTECH; + public static final boolean LOAD_ALL_CONTENT = false; + public static final int GREG_FIRST_ID = 760; + + //GUIS + public enum GUI_ENUM + { + ENERGYBUFFER, TOOLBUILDER, NULL, NULL1, NULL2 + } + +} diff --git a/src/Java/miscutil/core/proxy/ClientProxy.java b/src/Java/miscutil/core/proxy/ClientProxy.java new file mode 100644 index 0000000000..f0f21549e8 --- /dev/null +++ b/src/Java/miscutil/core/proxy/ClientProxy.java @@ -0,0 +1,42 @@ +package miscutil.core.proxy; + +import miscutil.core.CommonProxy; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class ClientProxy extends CommonProxy{ + + @Override + public void preInit(FMLPreInitializationEvent e) { + // TODO Auto-generated method stub + super.preInit(e); + } + + @Override + public void init(FMLInitializationEvent e) { + // TODO Auto-generated method stub + super.init(e); + } + + @Override + public void postInit(FMLPostInitializationEvent e) { + // TODO Auto-generated method stub + super.postInit(e); + } + + public void registerRenderThings(){ + //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0)); + //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0)); + //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade)); + + //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); + //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); + } + + public int addArmor(String armor){ + return RenderingRegistry.addNewArmourRendererPrefix(armor); + } + +} diff --git a/src/Java/miscutil/core/proxy/ServerProxy.java b/src/Java/miscutil/core/proxy/ServerProxy.java new file mode 100644 index 0000000000..59e625eaed --- /dev/null +++ b/src/Java/miscutil/core/proxy/ServerProxy.java @@ -0,0 +1,28 @@ +package miscutil.core.proxy; + +import miscutil.core.CommonProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class ServerProxy extends CommonProxy{ + + @Override + public void preInit(FMLPreInitializationEvent e) { + // TODO Auto-generated method stub + super.preInit(e); + } + + @Override + public void init(FMLInitializationEvent e) { + // TODO Auto-generated method stub + super.init(e); + } + + @Override + public void postInit(FMLPostInitializationEvent e) { + // TODO Auto-generated method stub + super.postInit(e); + } + +} diff --git a/src/Java/miscutil/core/tileentities/ModTileEntities.java b/src/Java/miscutil/core/tileentities/ModTileEntities.java new file mode 100644 index 0000000000..6126c5793e --- /dev/null +++ b/src/Java/miscutil/core/tileentities/ModTileEntities.java @@ -0,0 +1,13 @@ +package miscutil.core.tileentities; + +import miscutil.core.util.Utils; + +public class ModTileEntities { + + + public static void init(){ + Utils.LOG_INFO("Registering Tile Entities."); + //GameRegistry.registerTileEntity(TileEntityStorage.class, "TE_Storage"); + } + +} diff --git a/src/Java/miscutil/core/util/Benchmark.java b/src/Java/miscutil/core/util/Benchmark.java new file mode 100644 index 0000000000..1e17175c3b --- /dev/null +++ b/src/Java/miscutil/core/util/Benchmark.java @@ -0,0 +1,153 @@ +package miscutil.core.util; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Random; + +import cpw.mods.fml.common.FMLLog; + +@SuppressWarnings("unused") +public class Benchmark { + + public void math() throws ParseException{ + Random r = new Random(); + + FMLLog.info("Looking at the stars in the sky"); + + // generate some random boolean values + boolean[] booleans = new boolean[10]; + for (int i = 0; i < booleans.length; i++) { + booleans[i] = r.nextBoolean(); + } + + //FMLLog.info(getSha256(booleans.toString())); + + /*for (boolean b : booleans) { + FMLLog.info(b + ", "); + }*/ + + // generate a uniformly distributed int random numbers + int[] integers = new int[10]; + for (int i = 0; i < integers.length; i++) { + integers[i] = r.nextInt(); + } + + FMLLog.info(getSha256(integers.toString())); + + /*for (int i : integers) {s + FMLLog.info(i + ", "); + }*/ + + // generate a uniformly distributed float random numbers + float[] floats = new float[10]; + for (int i = 0; i < floats.length; i++) { + floats[i] = r.nextFloat(); + } + + FMLLog.info(getSha256(floats.toString())); + + /*for (float f : floats) { + FMLLog.info(f + ", "); + }*/ + + // generate a Gaussian normally distributed random numbers + double[] gaussians = new double[10]; + for (int i = 0; i < gaussians.length; i++) { + gaussians[i] = r.nextGaussian(); + } + + FMLLog.info(getSha256(gaussians.toString())); + } + + private String dateTime(){ + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd - HH:mm:ss"); + //get current date time with Calendar() + Calendar cal = Calendar.getInstance(); + return dateFormat.format(cal.getTime()); + } + + public String superhash(String a){ + FMLLog.info("Calculating the cost of life & the universe"); + int i = 1; + String b = a; + while (i < 3358 && i > 0){ + if (!b.equals(a)){ + b = a; + } + getSha256(b); + a = b; + try { + Thread.sleep(2); + } catch (InterruptedException e) { + FMLLog.info("Hashbrown order failed"); + e.printStackTrace(); + } + if (i == 500 || i == 1000 || i == 1500 || i == 2000 || i == 2500 || i == 3000 || i == 3500 || i == 4000 || i == 5000){ + //FMLLog.info("Calculating orbits around the sun: "+i); + } + i++; + } + return b; + } + + private String getSha256(String message) { + if (message == null || message.isEmpty()) { + return ""; + } + String chiper = generateString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+`~[];',./{}:<>?|'", 32); + String key = generateString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+`~[];',./{}:<>?|'", 16); // key is used to construct a new SHA-256 key/salt + + // Initialize SHA-256 + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException e) { + System.err.println(e.getMessage()); + } + + // Hashing entered key to construct a new key/salt + byte[] keyAsSHA256 = digest.digest(key.getBytes()); + + // Encoding the message with CBC + char[] messageAsChars = message.toCharArray(); + messageAsChars[0] ^= keyAsSHA256[0]; // Avoiding buffer underflow + for (int i = 1; i < messageAsChars.length; i++) { + messageAsChars[i] ^= messageAsChars[i - 1]; // XOR with previous character + messageAsChars[i] ^= keyAsSHA256[i % keyAsSHA256.length]; // XOR with keys hash + } + // build cipher from the chars + chiper = new String(messageAsChars); + String cipher = MD5(chiper); + return chiper + "|" + cipher; + } + + public String MD5(String md5) { + try { + java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); + byte[] array = md.digest(md5.getBytes()); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < array.length; ++i) { + sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3)); + } + return sb.toString(); + } catch (java.security.NoSuchAlgorithmException e) { + } + return null; + } + + public static String generateString(String characters, int length) + { + Random r = new Random(); + char[] text = new char[length]; + for (int i = 0; i < length; i++) + { + text[i] = characters.charAt(r.nextInt(characters.length())); + } + return new String(text); + } + +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java new file mode 100644 index 0000000000..00acfba45f --- /dev/null +++ b/src/Java/miscutil/core/util/Utils.java @@ -0,0 +1,61 @@ +package miscutil.core.util; + +import java.awt.Graphics; + +import miscutil.core.lib.Strings; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.FMLLog; + +public class Utils { + + public static final int WILDCARD_VALUE = Short.MAX_VALUE; + public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets) + { + for (ItemStack input : inputs) + { + for (ItemStack target : targets) + { + if (itemMatches(target, input, strict)) + { + return true; + } + } + } + return false; + } + + public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict) + { + if (input == null && target != null || input != null && target == null) + { + return false; + } + return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); + } + + //Non-Dev Comments + public static void LOG_INFO(String s){ + //if (Strings.DEBUG){ + FMLLog.info("MiscUtils: "+s); + //} + } + + //Developer Comments + public static void LOG_WARNING(String s){ + if (Strings.DEBUG){ + FMLLog.warning("MiscUtils: "+s); + } + } + + //Errors + public static void LOG_ERROR(String s){ + if (Strings.DEBUG){ + FMLLog.severe("MiscUtils: "+s); + } + } + + public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){ + g.drawRect (MinA, MinB, MaxA, MaxB); + } + +} |