Skip to content

Commit

Permalink
Tinker and Blade 2: Warconstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerokyuuni authored and Sunstrike committed Sep 12, 2013
1 parent 631935c commit 65b851c
Show file tree
Hide file tree
Showing 47 changed files with 1,467 additions and 2 deletions.
55 changes: 55 additions & 0 deletions src/mods/battlegear2/api/IArrowContainer.java
@@ -0,0 +1,55 @@
package mods.battlegear2.api;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@Deprecated
public interface IArrowContainer{

/**
*
* @param stack The {@link #ItemStack} representing this item
* @param bow The bow trying to use this container
* @param player The {@link #EntityPlayer} using the bow
* @return true if the item contains at least one arrow
*/
public boolean hasArrowFor(ItemStack stack, ItemStack bow, EntityPlayer player);
/**
* The arrow spawned when bow is used with this non empty container equipped
* @param stack The {@link #ItemStack} representing this item
* @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @return the arrow entity to spawn when bow is used
*/
public EntityArrow getArrowType(ItemStack stack, World world, EntityPlayer player, float charge);
/**
* Action to take after an arrow has been fired
* Usually equal to removing an arrow from the container
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @param stack The {@link #ItemStack} representing this item
* @param bow The bow which fired
* @param arrow the arrow fired
*/
public void onArrowFired(World world, EntityPlayer player, ItemStack stack, ItemStack bow, EntityArrow arrow);
/**
* Called before the arrow is fired from this container
* @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment
*/
public void onPreArrowFired(QuiverArrowEvent arrowEvent);
/**
* Called when the container is put on a crafting bench with vanilla arrows
* @param stack
* @return True to receive {@link #addArrows(ItemStack, int)}
*/
public boolean isCraftableWithArrows(ItemStack stack);
/**
* Crafts the item with vanilla arrows
* @param stack
* @param arrows Number of vanilla arrows on the crafting bench
* @return Number of vanilla arrows that couldn't fit in
*/
public int addArrows(ItemStack stack, int arrows);
}
99 changes: 99 additions & 0 deletions src/mods/battlegear2/api/IArrowContainer2.java
@@ -0,0 +1,99 @@
package mods.battlegear2.api;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public interface IArrowContainer2 {

/**
* Returns the maximum amout of slots in the arrow container
* @param container {@link #ItemStack} representing this item
* @return the amount of slots
*/
public int getSlotCount(ItemStack container);

/**
* Returns the currently selected slot in the arrow container
* @param container {@link #ItemStack} representing this item
* @return the currently selected slot
*/
public int getSelectedSlot(ItemStack container);

/**
* Sets the currently selected slot to the given value
* @param container {@link #ItemStack} representing this item
* @param newSlot the new slot index
*/
public void setSelectedSlot(ItemStack container, int newSlot);

/**
* Returns the itemStack in the currently selected slot
* @param container The {@link #ItemStack} representing this item
* @param slot the slot index
* @return The {@link #ItemStack} in the given slot.
*/
public ItemStack getStackInSlot(ItemStack container, int slot);

/**
* Sets places the given item stack in the give slot
* @param container {@link #ItemStack} representing this item
* @param slot the slot index
* @param container {@link #ItemStack} representing the new stack
*/
public void setStackInSlot(ItemStack container, int slot, ItemStack stack);


/**
*
* @param container The {@link #ItemStack} representing this item
* @param bow The bow trying to use this container
* @param player The {@link #EntityPlayer} using the bow
* @return true if the item contains at least one arrow in the selected slot
*/
public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot);

/**
* The arrow spawned when bow is used with this non empty container equipped
* @param container The {@link #ItemStack} representing this item
* @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @return the arrow entity to spawn when bow is used
*/
public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge);
/**
* Action to take after an arrow has been fired
* Usually equal to removing an arrow from the container
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @param container The {@link #ItemStack} representing this item
* @param bow The bow which fired
* @param arrow the arrow fired
*/
public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow);
/**
* Called before the arrow is fired from this container
* @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment
*/
public void onPreArrowFired(QuiverArrowEvent arrowEvent);
/**
* Called when the container is put on a crafting bench with other items
* @param container The {@link #ItemStack} representing this item
* @param arrowStack The {@link #ItemStack} representing other items
* @return True to receive {@link #addArrows(ItemStack, ItemStack)}
*/
public boolean isCraftableWithArrows(ItemStack contaner, ItemStack arrowStack);

/**
* Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)}
* @param container The {@link #ItemStack} representing this item
* @param arrows Another valid item on the crafting bench
* @return Number of arrows that couldn't fit in
*/
public ItemStack addArrows(ItemStack container, ItemStack newStack);



}
14 changes: 14 additions & 0 deletions src/mods/battlegear2/api/IBackStabbable.java
@@ -0,0 +1,14 @@
package mods.battlegear2.api;

import net.minecraft.entity.EntityLivingBase;

public interface IBackStabbable {

/**
* Action to perform on back stabbing
* @param entityHit
* @param entityHitting
* @return true if it adds an hitting action
*/
public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting);
}
70 changes: 70 additions & 0 deletions src/mods/battlegear2/api/IBattlegearWeapon.java
@@ -0,0 +1,70 @@
package mods.battlegear2.api;

import cpw.mods.fml.relauncher.Side;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;

public interface IBattlegearWeapon {

/**
* Returns true if the weapon will allow other weapons to be placed in the partner offhand slot
*/
public boolean willAllowOffhandWeapon();

/**
* Will allow shield
*/
public boolean willAllowShield();

/**
* Returns true if the weapon be dual wielded in the offhand slot
*/
public boolean isOffhandHandDualWeapon();

/**
* Returns true if the weapon should always be sheathed on the back, false if it should be sheathed on the hip
*/
public boolean sheatheOnBack();

/**
* Perform any function when the item is held in the offhand and the user right clicks an entity.
* This is generally used to attack an entity with the offhand item. If this is the case the event should
* be canceled to prevent any default right clicking events (Eg Villager Trading)
*
* @param event the OffhandAttackEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
* @return true if the off hand swing animation should be performed
*/
public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem);

/**
* Perform any function when the item is held in the offhand and the user right clicks "Air".
*
* @param event the PlayerInteractEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
* @return true if the off hand swing animation should be performed
*/
public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem);

/**
* Perform any function when the item is held in the offhand and the user right clicks a block.
* Note that this will happen prior to the activation of any activation functions of blocks
*
* @param event the PlayerInteractEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
*/
public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem);

/**
* Perform any passive effects on each game tick when the item is held in the offhand
*
* @param effectiveSide the effective side the method was called from
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
*/
public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem);

}
31 changes: 31 additions & 0 deletions src/mods/battlegear2/api/IDyable.java
@@ -0,0 +1,31 @@
package mods.battlegear2.api;


import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

//This is a tempory fix until we get the heradry system up and running
public interface IDyable {

/**
* Return whether the specified armor ItemStack has a color.
*/
public boolean hasColor(ItemStack par1ItemStack);


/**
* Return the color for the specified armor ItemStack.
*/
public int getColor(ItemStack par1ItemStack);

public void setColor(ItemStack dyable, int rgb);

/**
* Remove the color from the specified armor ItemStack.
*/
public void removeColor(ItemStack par1ItemStack);

public int getDefaultColor(ItemStack par1ItemStack);


}
12 changes: 12 additions & 0 deletions src/mods/battlegear2/api/IExtendedReachWeapon.java
@@ -0,0 +1,12 @@
package mods.battlegear2.api;

import net.minecraft.item.ItemStack;

public interface IExtendedReachWeapon {
/**
* The distance the weapon will hit (note this will ONLY work for main hand weapons)
* @param stack
* @return
*/
public float getReachModifierInBlocks(ItemStack stack);
}
11 changes: 11 additions & 0 deletions src/mods/battlegear2/api/IHeraldyArmour.java
@@ -0,0 +1,11 @@
package mods.battlegear2.api;


import mods.battlegear2.heraldry.HeraldyPattern;

public interface IHeraldyArmour extends IHeraldyItem{

public String getBaseArmourPath(int armourSlot);

public String getPatternArmourPath(HeraldyPattern pattern, int armourSlot);
}
77 changes: 77 additions & 0 deletions src/mods/battlegear2/api/IHeraldyItem.java
@@ -0,0 +1,77 @@
package mods.battlegear2.api;

import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;

@Deprecated
public interface IHeraldyItem {

public enum HeraldyRenderPassess{
/**
* The first render pass. This will use the items base icon coloured the primary colour
*/
PrimaryColourBase,
/**
* The second render pass. This will use the selected pattern overlayed on top of the base icon with the apropriate colour
*/
SecondaryColourPattern,
/**
* The third render pass. The sigil(s) will be rendered on top of the pattern in the apropriate positions
*/
Sigil,
/**
* Fourth render pass. The items trim icon will be rendered in the secondady colour
*/
SecondaryColourTrim,
/**
* Fifth Render pass, the Items post render icon will be rendered in the default colour
*/
PostRenderIcon
}

/**
* Returns the "base" icon. This icon will be coloured the primary colour
*/
public Icon getBaseIcon(ItemStack stack);
/**
* Returns the trim icon, This will be coloured the secondary colour
*/
public Icon getTrimIcon(ItemStack stack);
/**
* Returns the post render icon, this Icon will render after all other rendering passess in it's default colour
*/
public Icon getPostRenderIcon(ItemStack stack);


/**
* Returns true if the given itemstack has heraldy attached
*/
public boolean hasHeraldry(ItemStack stack);
/**
* Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldrybackup using the hasHeraldryMethod
*/
public byte[] getHeraldryCode(ItemStack stack);

/**
* Saves the given heraldy code in the given stack. It is recommended to use the stacks NBT Tag compound for this
*/
public void setHeraldryCode(ItemStack stack, byte[] code);

/**
* Removes the heraldy code from the item
*/
public void removeHeraldry(ItemStack item);

/**
* Returns true if the default renderer should perform the given render pass
*/
public boolean shouldDoPass(HeraldyRenderPassess pass);

/**
* Returns true if the default renderer should be used.
* If the method returns true, the default renderer will be attached.
* If this method returns false it is the modders responsibility to attach an appropriate renderer
*/
public boolean useDefaultRenderer();

}
15 changes: 15 additions & 0 deletions src/mods/battlegear2/api/IHitTimeModifier.java
@@ -0,0 +1,15 @@
package mods.battlegear2.api;

import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

public interface IHitTimeModifier {
/**
*
* @param entityHit
* @return The amount to modify the hit shield
*/
public int getHitTime(ItemStack stack, EntityLivingBase entityHit);

}

0 comments on commit 65b851c

Please sign in to comment.