Manually apply: 4fe5b68aaa100eeca675a596fcad9329403ecab8
This commit is contained in:
parent
145124e3dd
commit
f669e8b47b
1 changed files with 38 additions and 16 deletions
|
@ -3,6 +3,7 @@ package techreborn.items.tools;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
|
@ -132,26 +133,47 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||||
EnumHand hand) {
|
EnumHand hand) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
stack.getTagCompound().setBoolean("isActive", true);
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
+ TextFormatting.GOLD + I18n
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
.translateToLocal("techreborn.message.nanosaberActivate")));
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
|
||||||
+ TextFormatting.GOLD + I18n
|
|
||||||
.translateToLocal("techreborn.message.nanosaberActive")));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
stack.getTagCompound().setBoolean("isActive", false);
|
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
if (stack.getTagCompound() == null) {
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
}
|
||||||
+ TextFormatting.GOLD + I18n
|
stack.getTagCompound().setBoolean("isActive", true);
|
||||||
.translateToLocal("techreborn.message.nanosaberInactive")));
|
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||||
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||||
|
+ TextFormatting.GOLD + I18n
|
||||||
|
.translateToLocal("techreborn.message.nanosaberActive")));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stack.getTagCompound().setBoolean("isActive", false);
|
||||||
|
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||||
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||||
|
+ TextFormatting.GOLD + I18n
|
||||||
|
.translateToLocal("techreborn.message.nanosaberInactive")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||||
|
}
|
||||||
|
return new ActionResult<>(EnumActionResult.PASS, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||||
|
if (stack.getTagCompound() != null && stack.getTagCompound().getBoolean("isActive") && !PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
|
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||||
|
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberEnergyError") + " "
|
||||||
|
+ TextFormatting.GOLD + I18n
|
||||||
|
.translateToLocal("techreborn.message.nanosaberDeactivating")));
|
||||||
|
stack.getTagCompound().setBoolean("isActive", false);
|
||||||
}
|
}
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue