2015-06-23 22:29:05 +00:00
|
|
|
package gregtech.common.items.behaviors;
|
|
|
|
|
|
|
|
import gregtech.api.items.GT_MetaBase_Item;
|
|
|
|
import gregtech.api.items.GT_MetaGenerated_Tool;
|
|
|
|
import gregtech.api.util.GT_LanguageManager;
|
|
|
|
import ic2.api.crops.ICropTile;
|
|
|
|
import java.util.List;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.entity.player.PlayerCapabilities;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class Behaviour_Sense
|
|
|
|
extends Behaviour_None
|
|
|
|
{
|
|
|
|
private final int mCosts;
|
|
|
|
|
|
|
|
public Behaviour_Sense(int aCosts)
|
|
|
|
{
|
|
|
|
this.mCosts = aCosts;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ)
|
|
|
|
{
|
|
|
|
if (aWorld.isRemote) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
|
|
|
|
if ((tTileEntity instanceof ICropTile))
|
|
|
|
{
|
|
|
|
for (int i = -1; i < 2; i++) {
|
|
|
|
for (int j = -1; j < 2; j++) {
|
|
|
|
for (int k = -1; k < 2; k++) {
|
|
|
|
if ((aStack.stackSize > 0) && (((tTileEntity = aWorld.getTileEntity(aX + i, aY + j, aZ + k)) instanceof ICropTile)) && (((ICropTile)tTileEntity).harvest(true)) && (!aPlayer.capabilities.isCreativeMode)) {
|
|
|
|
((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sense", "Rightclick to harvest Crop Sticks");
|
|
|
|
|
|
|
|
public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
|
|
|
|
{
|
|
|
|
aList.add(this.mTooltip);
|
|
|
|
return aList;
|
|
|
|
}
|
|
|
|
}
|
2015-04-23 16:14:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar
|
|
|
|
* Qualified Name: gregtech.common.items.behaviors.Behaviour_Sense
|
|
|
|
* JD-Core Version: 0.7.0.1
|
|
|
|
*/
|