-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
5,776 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.tileentity.TileEntity; | ||
|
||
public class BlockCoordinates implements Comparable | ||
{ | ||
public int x; | ||
|
||
/** the y coordinate */ | ||
public int y; | ||
|
||
/** the z coordinate */ | ||
public int z; | ||
|
||
public BlockCoordinates() {} | ||
|
||
public BlockCoordinates(int par1, int par2, int par3) | ||
{ | ||
this.x = par1; | ||
this.y = par2; | ||
this.z = par3; | ||
} | ||
|
||
public BlockCoordinates(TileEntity tile) | ||
{ | ||
this.x = tile.xCoord; | ||
this.y = tile.yCoord; | ||
this.z = tile.zCoord; | ||
} | ||
|
||
public BlockCoordinates(BlockCoordinates par1ChunkCoordinates) | ||
{ | ||
this.x = par1ChunkCoordinates.x; | ||
this.y = par1ChunkCoordinates.y; | ||
this.z = par1ChunkCoordinates.z; | ||
} | ||
|
||
public boolean equals(Object par1Obj) | ||
{ | ||
if (!(par1Obj instanceof BlockCoordinates)) | ||
{ | ||
return false; | ||
} | ||
else | ||
{ | ||
BlockCoordinates coordinates = (BlockCoordinates)par1Obj; | ||
return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z ; | ||
} | ||
} | ||
|
||
public int hashCode() | ||
{ | ||
return this.x + this.y << 8 + this.z << 16; | ||
} | ||
|
||
/** | ||
* Compare the coordinate with another coordinate | ||
*/ | ||
public int compareWorldCoordinate(BlockCoordinates par1) | ||
{ | ||
return this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y; | ||
} | ||
|
||
public void set(int par1, int par2, int par3, int d) | ||
{ | ||
this.x = par1; | ||
this.y = par2; | ||
this.z = par3; | ||
} | ||
|
||
/** | ||
* Returns the squared distance between this coordinates and the coordinates given as argument. | ||
*/ | ||
public float getDistanceSquared(int par1, int par2, int par3) | ||
{ | ||
float f = (float)(this.x - par1); | ||
float f1 = (float)(this.y - par2); | ||
float f2 = (float)(this.z - par3); | ||
return f * f + f1 * f1 + f2 * f2; | ||
} | ||
|
||
/** | ||
* Return the squared distance between this coordinates and the ChunkCoordinates given as argument. | ||
*/ | ||
public float getDistanceSquaredToWorldCoordinates(BlockCoordinates par1ChunkCoordinates) | ||
{ | ||
return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z); | ||
} | ||
|
||
public int compareTo(Object par1Obj) | ||
{ | ||
return this.compareWorldCoordinate((BlockCoordinates)par1Obj); | ||
} | ||
|
||
public void readNBT(NBTTagCompound nbt) { | ||
this.x = nbt.getInteger("b_x"); | ||
this.y = nbt.getInteger("b_y"); | ||
this.z = nbt.getInteger("b_z"); | ||
} | ||
|
||
public void writeNBT(NBTTagCompound nbt) { | ||
nbt.setInteger("b_x",x); | ||
nbt.setInteger("b_y",y); | ||
nbt.setInteger("b_z",z); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package thaumcraft.api; | ||
|
||
import java.util.ArrayList; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.world.World; | ||
|
||
public interface IArchitect { | ||
|
||
/** | ||
* Returns a list of blocks that should be highlighted in world. | ||
*/ | ||
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world, | ||
int x, int y, int z, int side, EntityPlayer player); | ||
|
||
/** | ||
* which axis should be displayed. | ||
*/ | ||
public boolean showAxis(ItemStack stack, World world, EntityPlayer player, int side, EnumAxis axis); | ||
|
||
public enum EnumAxis { | ||
X, // east / west | ||
Y, // up / down | ||
Z; // north / south | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* | ||
* @author Azanor | ||
* | ||
* Equipped head slot items that extend this class will be able to perform most functions that | ||
* goggles of revealing can apart from view nodes which is handled by IRevealer. | ||
* | ||
*/ | ||
|
||
public interface IGoggles { | ||
|
||
/* | ||
* If this method returns true things like block essentia contents will be shown. | ||
*/ | ||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package thaumcraft.api; | ||
|
||
|
||
|
||
/** | ||
* @author Azanor | ||
* Items, armor and tools with this interface can receive the Repair enchantment. | ||
* Repairs 1 point of durability every 10 seconds (2 for repair II) | ||
*/ | ||
public interface IRepairable { | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
|
||
|
||
/** | ||
* @author Azanor | ||
* Items, armor and tools with this interface can receive the Repair enchantment. | ||
* Repairs 1 point of durability every 10 seconds (2 for repair II) | ||
*/ | ||
public interface IRepairableExtended extends IRepairable { | ||
|
||
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantlevel); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* | ||
* @author Azanor | ||
* | ||
* Armor or bauble slot items that implement this interface can provide runic shielding. | ||
* Recharging, hardening, etc. is handled internally by thaumcraft. | ||
* | ||
*/ | ||
|
||
public interface IRunicArmor { | ||
|
||
/** | ||
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally. | ||
*/ | ||
public int getRunicCharge(ItemStack itemstack); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package thaumcraft.api; | ||
|
||
|
||
/** | ||
* | ||
* @author Azanor | ||
* | ||
* Interface used to identify scribing tool items used in research table | ||
* | ||
*/ | ||
|
||
public interface IScribeTools { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import thaumcraft.api.aspects.Aspect; | ||
|
||
|
||
|
||
|
||
/** | ||
* @author Azanor | ||
* ItemArmor with this interface will grant a discount to the vis cost of actions the wearer performs with casting wands. | ||
* The amount returned is the percentage by which the cost is discounted. There is a built-int max discount of 50%, but | ||
* individual items really shouldn't have a discount more than 5% | ||
*/ | ||
public interface IVisDiscountGear { | ||
|
||
int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* | ||
* @author Azanor | ||
* | ||
* Armor, held items or bauble slot items that implement this interface add warp when equipped or held. | ||
* | ||
*/ | ||
|
||
public interface IWarpingGear { | ||
|
||
/** | ||
* returns how much warp this item adds while worn or held. | ||
*/ | ||
public int getWarp(ItemStack itemstack, EntityPlayer player); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import cpw.mods.fml.common.FMLLog; | ||
|
||
/** | ||
* @author Azanor | ||
* | ||
* This is used to gain access to the items in my mod. | ||
* I only give some examples and it will probably still | ||
* require a bit of work for you to get hold of everything you need. | ||
* | ||
*/ | ||
public class ItemApi { | ||
|
||
public static ItemStack getItem(String itemString, int meta) { | ||
ItemStack item = null; | ||
|
||
try { | ||
String itemClass = "thaumcraft.common.config.ConfigItems"; | ||
Object obj = Class.forName(itemClass).getField(itemString).get(null); | ||
if (obj instanceof Item) { | ||
item = new ItemStack((Item) obj,1,meta); | ||
} else if (obj instanceof ItemStack) { | ||
item = (ItemStack) obj; | ||
} | ||
} catch (Exception ex) { | ||
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString); | ||
} | ||
|
||
return item; | ||
} | ||
|
||
public static ItemStack getBlock(String itemString, int meta) { | ||
ItemStack item = null; | ||
|
||
try { | ||
String itemClass = "thaumcraft.common.config.ConfigBlocks"; | ||
Object obj = Class.forName(itemClass).getField(itemString).get(null); | ||
if (obj instanceof Block) { | ||
item = new ItemStack((Block) obj,1,meta); | ||
} else if (obj instanceof ItemStack) { | ||
item = (ItemStack) obj; | ||
} | ||
} catch (Exception ex) { | ||
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString); | ||
} | ||
|
||
return item; | ||
} | ||
|
||
/** | ||
* | ||
* Some examples | ||
* | ||
* Casting Wands: | ||
* itemWandCasting | ||
* | ||
* Resources: | ||
* itemEssence, itemWispEssence, itemResource, itemShard, itemNugget, | ||
* itemNuggetChicken, itemNuggetBeef, itemNuggetPork, itemTripleMeatTreat | ||
* | ||
* Research: | ||
* itemResearchNotes, itemInkwell, itemThaumonomicon | ||
* | ||
*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package thaumcraft.api; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class ItemRunic extends Item implements IRunicArmor { | ||
|
||
int charge; | ||
|
||
public ItemRunic (int charge) | ||
{ | ||
super(); | ||
this.charge = charge; | ||
} | ||
|
||
@Override | ||
public int getRunicCharge(ItemStack itemstack) { | ||
return charge; | ||
} | ||
|
||
} |
Oops, something went wrong.