public void tryFocusChange(EntityLivingBase entityLiving, ItemStack stack) { ISceptreFocus focus; if (entityLiving.isSneaking()) { changeFocus(null, stack); return; } if (stack.stackTagCompound.hasKey("focus")) focus = SceptreFocusRegistry.getNextFocus(getFocus(stack), (EntityPlayer) entityLiving, stack); else focus = SceptreFocusRegistry.getNextFocus(null, (EntityPlayer) entityLiving, stack); changeFocus(focus, stack); }
public String getItemStackDisplayName(ItemStack item) { // String baseName = EnumChatFormatting.GOLD + "Sceptre"; String baseName = EnumChatFormatting.GOLD + StatCollector.translateToLocal("qa.sceptre.name"); String nullFocus = StatCollector.translateToLocal("qa.sceptre.focus.null"); if (item.stackTagCompound != null) if (item.stackTagCompound.hasKey("focus")) { String focusName = getFocus(item).getName(); EnumChatFormatting focusColour = SceptreFocusRegistry.getFocus(item.stackTagCompound.getString("focus")).getNameColour(); return String.format( "%s %s[%s]%s", baseName, focusColour, StatCollector.translateToLocal(focusName), EnumChatFormatting.WHITE); } else return String.format( "%s %s[%s]%s", baseName, EnumChatFormatting.LIGHT_PURPLE, nullFocus, EnumChatFormatting.WHITE); else return baseName; }
ISceptreFocus getFocus(ItemStack stack) { return SceptreFocusRegistry.getFocus(stack.stackTagCompound.getString("focus")); }