Changed formatting to have bracing on a new line
This commit is contained in:
parent
e5eddd6c45
commit
e48eedb874
189 changed files with 6092 additions and 4041 deletions
|
@ -25,7 +25,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
public class ItemBoundTool extends ItemBindable {
|
||||
public class ItemBoundTool extends ItemBindable
|
||||
{
|
||||
|
||||
private Set<Block> effectiveBlocks;
|
||||
protected final String tooltipBase;
|
||||
|
@ -36,7 +37,8 @@ public class ItemBoundTool extends ItemBindable {
|
|||
|
||||
public final int chargeTime = 30;
|
||||
|
||||
public ItemBoundTool(String name, int lpUsed, Set<Block> effectiveBlocks) {
|
||||
public ItemBoundTool(String name, int lpUsed, Set<Block> effectiveBlocks)
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".bound." + name);
|
||||
setHasSubtypes(true);
|
||||
|
@ -48,36 +50,43 @@ public class ItemBoundTool extends ItemBindable {
|
|||
this.effectiveBlocks = effectiveBlocks;
|
||||
}
|
||||
|
||||
public ItemBoundTool(String name, int lpUsed) {
|
||||
public ItemBoundTool(String name, int lpUsed)
|
||||
{
|
||||
this(name, lpUsed, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, Block block) {
|
||||
public float getStrVsBlock(ItemStack stack, Block block)
|
||||
{
|
||||
return this.effectiveBlocks.contains(block) ? 8.0F : 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (entityIn instanceof EntityPlayer && getActivated(stack) && isSelected && isBeingHeldDown() && stack == ((EntityPlayer) entityIn).getCurrentEquippedItem()) {
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (entityIn instanceof EntityPlayer && getActivated(stack) && isSelected && isBeingHeldDown() && stack == ((EntityPlayer) entityIn).getCurrentEquippedItem())
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entityIn;
|
||||
heldDownCount = Math.min(player.getItemInUseDuration(), chargeTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
|
||||
BindableHelper.checkAndSetItemOwner(stack, player);
|
||||
|
||||
// if (!world.isRemote)
|
||||
// if (!world.isRemote)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
setActivated(stack, !getActivated(stack));
|
||||
// if (getActivated(stack) && ItemBindable.syphonBatteries(stack, player, getLPUsed()))
|
||||
// return stack;
|
||||
// if (getActivated(stack) && ItemBindable.syphonBatteries(stack,
|
||||
// player, getLPUsed()))
|
||||
// return stack;
|
||||
|
||||
if (!player.isSneaking() && getActivated(stack)) {
|
||||
if (!player.isSneaking() && getActivated(stack))
|
||||
{
|
||||
BoundToolEvent.Charge event = new BoundToolEvent.Charge(player, stack);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return event.result;
|
||||
|
@ -91,7 +100,8 @@ public class ItemBoundTool extends ItemBindable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed()))
|
||||
return false;
|
||||
|
||||
|
@ -99,15 +109,18 @@ public class ItemBoundTool extends ItemBindable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
this.onItemRightClick(stack, world, player);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) {
|
||||
if (!playerIn.isSneaking() && getActivated(stack)) {
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
|
||||
{
|
||||
if (!playerIn.isSneaking() && getActivated(stack))
|
||||
{
|
||||
int i = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
BoundToolEvent.Release event = new BoundToolEvent.Release(playerIn, stack, i);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
|
@ -120,33 +133,39 @@ public class ItemBoundTool extends ItemBindable {
|
|||
}
|
||||
}
|
||||
|
||||
protected void onBoundRelease(ItemStack stack, World world, EntityPlayer player, int charge) {
|
||||
protected void onBoundRelease(ItemStack stack, World world, EntityPlayer player, int charge)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) {
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
public EnumAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
|
||||
if (StatCollector.canTranslate(tooltipBase + "desc"))
|
||||
tooltip.add(TextHelper.localizeEffect(tooltipBase + "desc"));
|
||||
|
@ -159,22 +178,27 @@ public class ItemBoundTool extends ItemBindable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
return getActivated(stack) && beingHeldDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
return ((double) -Math.min(getHeldDownCount(), chargeTime) / chargeTime) + 1;
|
||||
}
|
||||
|
||||
protected static void dropStacks(Multiset<ItemStackWrapper> drops, World world, BlockPos posToDrop) {
|
||||
for (Multiset.Entry<ItemStackWrapper> entry : drops.entrySet()) {
|
||||
protected static void dropStacks(Multiset<ItemStackWrapper> drops, World world, BlockPos posToDrop)
|
||||
{
|
||||
for (Multiset.Entry<ItemStackWrapper> entry : drops.entrySet())
|
||||
{
|
||||
int count = entry.getCount();
|
||||
ItemStackWrapper stack = entry.getElement();
|
||||
int maxStackSize = stack.item.getItemStackLimit(stack.toStack(1));
|
||||
|
||||
while (count >= maxStackSize) {
|
||||
while (count >= maxStackSize)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityItem(world, posToDrop.getX(), posToDrop.getY(), posToDrop.getZ(), stack.toStack(maxStackSize)));
|
||||
count -= maxStackSize;
|
||||
}
|
||||
|
@ -184,11 +208,13 @@ public class ItemBoundTool extends ItemBindable {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean getActivated(ItemStack stack) {
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
public ItemStack setActivated(ItemStack stack, boolean activated) {
|
||||
public ItemStack setActivated(ItemStack stack, boolean activated)
|
||||
{
|
||||
stack.setItemDamage(activated ? 1 : 0);
|
||||
|
||||
return stack;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue